зеркало из
1
0
Форкнуть 0

Merge branch 'main' into ninhu/qa_to_qr

This commit is contained in:
Billy Hu 2024-09-18 15:53:22 -07:00
Родитель 01f36171ec 186410e47a
Коммит 01d663e790
605 изменённых файлов: 16152 добавлений и 4533 удалений

4
.github/workflows/event-processor.yml поставляемый
Просмотреть файл

@ -58,7 +58,7 @@ jobs:
run: >
dotnet tool install
Azure.Sdk.Tools.GitHubEventProcessor
--version 1.0.0-dev.20240909.2
--version 1.0.0-dev.20240917.2
--add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json
--global
shell: bash
@ -114,7 +114,7 @@ jobs:
run: >
dotnet tool install
Azure.Sdk.Tools.GitHubEventProcessor
--version 1.0.0-dev.20240909.2
--version 1.0.0-dev.20240917.2
--add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json
--global
shell: bash

Просмотреть файл

@ -39,7 +39,7 @@ jobs:
run: >
dotnet tool install
Azure.Sdk.Tools.GitHubEventProcessor
--version 1.0.0-dev.20240909.2
--version 1.0.0-dev.20240917.2
--add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json
--global
shell: bash

Просмотреть файл

@ -31,7 +31,7 @@ stages:
vmImage: ubuntu-22.04
variables:
CodeownersLinterVersion: '1.0.0-dev.20240614.4'
CodeownersLinterVersion: '1.0.0-dev.20240917.2'
DotNetDevOpsFeed: "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json"
RepoLabelUri: "https://azuresdkartifacts.blob.core.windows.net/azure-sdk-write-teams/repository-labels-blob"
TeamUserUri: "https://azuresdkartifacts.blob.core.windows.net/azure-sdk-write-teams/azure-sdk-write-teams-blob"

Просмотреть файл

@ -120,6 +120,10 @@ jobs:
ServiceDirectory: ${{ parameters.ServiceDirectory }}
Location: westus
ResourceType: perf
ServiceConnection: azure-sdk-tests
SubscriptionConfigurationFilePaths:
- eng/common/TestResources/sub-config/AzurePublicMsft.json
UseFederatedAuth: true
- script: >-
dotnet run -- run
@ -179,3 +183,7 @@ jobs:
parameters:
ServiceDirectory: ${{ parameters.ServiceDirectory }}
ResourceType: perf
ServiceConnection: azure-sdk-tests
SubscriptionConfigurationFilePaths:
- eng/common/TestResources/sub-config/AzurePublicMsft.json
UseFederatedAuth: true

Просмотреть файл

@ -10,7 +10,7 @@ function Generate-AadToken ($TenantId, $ClientId, $ClientSecret)
"grant_type" = "client_credentials"
"client_id" = $ClientId
"client_secret" = $ClientSecret
"resource" = "api://2789159d-8d8b-4d13-b90b-ca29c1707afd"
"resource" = "api://2efaf292-00a0-426c-ba7d-f5d2b214b8fc"
}
Write-Host "Generating aad token..."
$resp = Invoke-RestMethod $LoginAPIBaseURI -Method 'POST' -Headers $headers -Body $body

Просмотреть файл

@ -15,6 +15,9 @@ class PackageProps
[boolean]$IsNewSdk
[string]$ArtifactName
[string]$ReleaseStatus
# was this package purely included because other packages included it as an AdditionalValidationPackage?
[boolean]$IncludedForValidation
# does this package include other packages that we should trigger validation for?
[string[]]$AdditionalValidationPackages
PackageProps([string]$name, [string]$version, [string]$directoryPath, [string]$serviceDirectory)
@ -38,6 +41,7 @@ class PackageProps
$this.Version = $version
$this.DirectoryPath = $directoryPath
$this.ServiceDirectory = $serviceDirectory
$this.IncludedForValidation = $false
if (Test-Path (Join-Path $directoryPath "README.md"))
{
@ -143,6 +147,7 @@ function Get-PrPkgProperties([string]$InputDiffJson) {
$key = $addition.Replace($RepoRoot, "").TrimStart('\/')
if ($lookup[$key]) {
$lookup[$key].IncludedForValidation = $true
$packagesWithChanges += $lookup[$key]
}
}

Просмотреть файл

@ -470,7 +470,6 @@ setenv =
PROXY_URL=http://localhost:5015
deps =
{[base]deps}
importlib-metadata<5.0
commands =
python {repository_root}/eng/tox/create_package_and_install.py \
-d {envtmpdir} \

Просмотреть файл

@ -1,5 +1,10 @@
# Release History
## 1.0.0b9 (2024-09-16)
### Bugs Fixed
security bug - code injection
## 1.0.0b8 (2024-03-27)
### Other Changes

Просмотреть файл

@ -2,4 +2,4 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
VERSION = "1.0.0b8"
VERSION = "1.0.0b9"

Просмотреть файл

@ -5,7 +5,6 @@ verifytypes = false
pyright = false
pylint = true
black = false
bandit = false
sphinx=true
breaking = false
whl_no_aio = false

Просмотреть файл

@ -5,7 +5,6 @@ verifytypes = false
pyright = false
pylint = false
black = false
bandit = false
sphinx = true
breaking = false

Просмотреть файл

@ -48,8 +48,8 @@ extends:
Artifacts:
- name: azure-ai-inference
safeName: azureaiinference
- name: azure-ai-generative
safeName: azureaigenerative
# These packages are deprecated:
#- name: azure-ai-generative
# safeName: azureaigenerative
#- name: azure-ai-resources
# safeName: azureairesources

Просмотреть файл

@ -1,5 +1,17 @@
# Release History
## 9.6.0 (2024-09-18)
### Features Added
- Model `ResourceRestoreParameters` added property `restore_with_ttl_disabled`
- Model `RestoreParameters` added parameter `restore_with_ttl_disabled` in method `__init__`
- Model `RestoreParametersBase` added property `restore_with_ttl_disabled`
- Enum `ServerVersion` added member `SEVEN0`
- Added model `ErrorAdditionalInfo`
- Added model `ErrorDetail`
- Added model `ErrorResponseAutoGenerated`
## 9.5.1 (2024-06-19)
### Features Added

Просмотреть файл

@ -1,11 +1,11 @@
{
"commit": "f1546dc981fa5d164d7ecd13588520457462c22c",
"commit": "3519c80fe510a268f6e59a29ccac8a53fdec15b6",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.10.2",
"use": [
"@autorest/python@6.13.19",
"@autorest/python@6.19.0",
"@autorest/modelerfour@4.27.0"
],
"autorest_command": "autorest specification/cosmos-db/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-2024-05 --use=@autorest/python@6.13.19 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False",
"autorest_command": "autorest specification/cosmos-db/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-08 --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False",
"readme": "specification/cosmos-db/resource-manager/readme.md"
}

Просмотреть файл

@ -28,13 +28,13 @@ class CosmosDBManagementClientConfiguration: # pylint: disable=too-many-instanc
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2024-05-15". Note that overriding this
:keyword api_version: Api Version. Default value is "2024-08-15". 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", "2024-05-15")
api_version: str = kwargs.pop("api_version", "2024-08-15")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")

Просмотреть файл

@ -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
@ -161,7 +162,7 @@ class CosmosDBManagementClient: # pylint: disable=client-accepts-api-version-ke
: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 "2024-05-15". Note that overriding this
:keyword api_version: Api Version. Default value is "2024-08-15". 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
@ -323,7 +324,7 @@ class CosmosDBManagementClient: # pylint: disable=client-accepts-api-version-ke
def close(self) -> None:
self._client.close()
def __enter__(self) -> "CosmosDBManagementClient":
def __enter__(self) -> Self:
self._client.__enter__()
return self

Просмотреть файл

@ -144,6 +144,8 @@ class RawDeserializer:
# 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

Просмотреть файл

@ -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

Просмотреть файл

@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
VERSION = "9.5.1"
VERSION = "9.6.0"

Просмотреть файл

@ -28,13 +28,13 @@ class CosmosDBManagementClientConfiguration: # pylint: disable=too-many-instanc
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2024-05-15". Note that overriding this
:keyword api_version: Api Version. Default value is "2024-08-15". 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", "2024-05-15")
api_version: str = kwargs.pop("api_version", "2024-08-15")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")

Просмотреть файл

@ -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
@ -164,7 +165,7 @@ class CosmosDBManagementClient: # pylint: disable=client-accepts-api-version-ke
: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 "2024-05-15". Note that overriding this
:keyword api_version: Api Version. Default value is "2024-08-15". 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
@ -328,7 +329,7 @@ class CosmosDBManagementClient: # pylint: disable=client-accepts-api-version-ke
async def close(self) -> None:
await self._client.close()
async def __aenter__(self) -> "CosmosDBManagementClient":
async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self

Просмотреть файл

@ -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 @@ from azure.core.exceptions import (
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.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._cassandra_clusters_operations import (
build_create_update_request,
build_deallocate_request,
@ -103,7 +103,6 @@ class CassandraClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -119,7 +118,6 @@ class CassandraClustersOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_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 @@ class CassandraClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -201,7 +198,6 @@ class CassandraClustersOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_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 +261,6 @@ class CassandraClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -279,16 +274,14 @@ class CassandraClustersOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ClusterResource", pipeline_response)
deserialized = self._deserialize("ClusterResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, cluster_name: str, **kwargs: Any
) -> None:
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,
@ -301,7 +294,7 @@ class CassandraClustersOperations:
_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,
@ -311,10 +304,10 @@ class CassandraClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -322,11 +315,19 @@ class CassandraClustersOperations:
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)
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, cluster_name: str, **kwargs: Any) -> AsyncLROPoller[None]:
@ -350,7 +351,7 @@ class CassandraClustersOperations:
lro_delay = kwargs.pop("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,
@ -359,6 +360,7 @@ class CassandraClustersOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -386,7 +388,7 @@ class CassandraClustersOperations:
cluster_name: str,
body: Union[_models.ClusterResource, IO[bytes]],
**kwargs: Any
) -> _models.ClusterResource:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -400,7 +402,7 @@ class CassandraClustersOperations:
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.ClusterResource] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -421,10 +423,10 @@ class CassandraClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -432,14 +434,14 @@ class CassandraClustersOperations:
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("ClusterResource", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("ClusterResource", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -551,10 +553,11 @@ class CassandraClustersOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ClusterResource", pipeline_response)
deserialized = self._deserialize("ClusterResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -582,7 +585,7 @@ class CassandraClustersOperations:
cluster_name: str,
body: Union[_models.ClusterResource, IO[bytes]],
**kwargs: Any
) -> _models.ClusterResource:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -596,7 +599,7 @@ class CassandraClustersOperations:
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.ClusterResource] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -617,10 +620,10 @@ class CassandraClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -628,14 +631,14 @@ class CassandraClustersOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
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("ClusterResource", pipeline_response)
if response.status_code == 202:
deserialized = self._deserialize("ClusterResource", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -742,10 +745,11 @@ class CassandraClustersOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ClusterResource", pipeline_response)
deserialized = self._deserialize("ClusterResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -773,7 +777,7 @@ class CassandraClustersOperations:
cluster_name: str,
body: Union[_models.CommandPostBody, IO[bytes]],
**kwargs: Any
) -> _models.CommandOutput:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -787,7 +791,7 @@ class CassandraClustersOperations:
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.CommandOutput] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -808,10 +812,10 @@ class CassandraClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -819,10 +823,14 @@ class CassandraClustersOperations:
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)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("CommandOutput", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -929,10 +937,11 @@ class CassandraClustersOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("CommandOutput", pipeline_response)
deserialized = self._deserialize("CommandOutput", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -954,9 +963,9 @@ class CassandraClustersOperations:
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
async def _deallocate_initial( # pylint: disable=inconsistent-return-statements
async def _deallocate_initial(
self, resource_group_name: str, cluster_name: str, **kwargs: Any
) -> None:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -969,7 +978,7 @@ class CassandraClustersOperations:
_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_deallocate_request(
resource_group_name=resource_group_name,
@ -979,10 +988,10 @@ class CassandraClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -990,11 +999,19 @@ class CassandraClustersOperations:
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)
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_deallocate(
@ -1022,7 +1039,7 @@ class CassandraClustersOperations:
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._deallocate_initial( # type: ignore
raw_result = await self._deallocate_initial(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
api_version=api_version,
@ -1031,6 +1048,7 @@ class CassandraClustersOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -1052,9 +1070,7 @@ class CassandraClustersOperations:
)
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, cluster_name: str, **kwargs: Any
) -> None:
async def _start_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1067,7 +1083,7 @@ class CassandraClustersOperations:
_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,
@ -1077,10 +1093,10 @@ class CassandraClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1088,11 +1104,19 @@ class CassandraClustersOperations:
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)
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(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> AsyncLROPoller[None]:
@ -1118,7 +1142,7 @@ class CassandraClustersOperations:
lro_delay = kwargs.pop("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,
cluster_name=cluster_name,
api_version=api_version,
@ -1127,6 +1151,7 @@ class CassandraClustersOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -1185,7 +1210,6 @@ class CassandraClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -1199,7 +1223,7 @@ class CassandraClustersOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("CassandraClusterPublicStatus", pipeline_response)
deserialized = self._deserialize("CassandraClusterPublicStatus", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore

Просмотреть файл

@ -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 @@ from azure.core.exceptions import (
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.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._cassandra_data_centers_operations import (
build_create_update_request,
build_delete_request,
@ -107,7 +107,6 @@ class CassandraDataCentersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -123,7 +122,6 @@ class CassandraDataCentersOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_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 +190,6 @@ class CassandraDataCentersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -206,16 +203,16 @@ class CassandraDataCentersOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("DataCenterResource", pipeline_response)
deserialized = self._deserialize("DataCenterResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
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, data_center_name: str, **kwargs: Any
) -> None:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -228,7 +225,7 @@ class CassandraDataCentersOperations:
_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,
@ -239,10 +236,10 @@ class CassandraDataCentersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -250,11 +247,19 @@ class CassandraDataCentersOperations:
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)
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(
@ -282,7 +287,7 @@ class CassandraDataCentersOperations:
lro_delay = kwargs.pop("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,
data_center_name=data_center_name,
@ -292,6 +297,7 @@ class CassandraDataCentersOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -320,7 +326,7 @@ class CassandraDataCentersOperations:
data_center_name: str,
body: Union[_models.DataCenterResource, IO[bytes]],
**kwargs: Any
) -> _models.DataCenterResource:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -334,7 +340,7 @@ class CassandraDataCentersOperations:
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.DataCenterResource] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -356,10 +362,10 @@ class CassandraDataCentersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -367,14 +373,14 @@ class CassandraDataCentersOperations:
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("DataCenterResource", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("DataCenterResource", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -494,10 +500,11 @@ class CassandraDataCentersOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("DataCenterResource", pipeline_response)
deserialized = self._deserialize("DataCenterResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -526,7 +533,7 @@ class CassandraDataCentersOperations:
data_center_name: str,
body: Union[_models.DataCenterResource, IO[bytes]],
**kwargs: Any
) -> _models.DataCenterResource:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -540,7 +547,7 @@ class CassandraDataCentersOperations:
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.DataCenterResource] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -562,10 +569,10 @@ class CassandraDataCentersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -573,14 +580,14 @@ class CassandraDataCentersOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
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("DataCenterResource", pipeline_response)
if response.status_code == 202:
deserialized = self._deserialize("DataCenterResource", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -697,10 +704,11 @@ class CassandraDataCentersOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("DataCenterResource", pipeline_response)
deserialized = self._deserialize("DataCenterResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized

Просмотреть файл

@ -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 @@ from azure.core.exceptions import (
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.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._cassandra_resources_operations import (
build_create_update_cassandra_keyspace_request,
build_create_update_cassandra_table_request,
@ -120,7 +120,6 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -136,7 +135,6 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@ -206,7 +204,6 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -220,7 +217,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("CassandraKeyspaceGetResults", pipeline_response)
deserialized = self._deserialize("CassandraKeyspaceGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -234,7 +231,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
keyspace_name: str,
create_update_cassandra_keyspace_parameters: Union[_models.CassandraKeyspaceCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Optional[_models.CassandraKeyspaceGetResults]:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -248,7 +245,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
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.CassandraKeyspaceGetResults]] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -272,10 +269,10 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -283,20 +280,22 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (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("CassandraKeyspaceGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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,10 +419,11 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("CassandraKeyspaceGetResults", pipeline_response)
deserialized = self._deserialize("CassandraKeyspaceGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -445,9 +445,9 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
async def _delete_cassandra_keyspace_initial( # pylint: disable=inconsistent-return-statements
async def _delete_cassandra_keyspace_initial(
self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any
) -> None:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -460,7 +460,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
_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_cassandra_keyspace_request(
resource_group_name=resource_group_name,
@ -471,10 +471,10 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -482,6 +482,10 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
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)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@ -492,8 +496,12 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
)
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_cassandra_keyspace(
@ -521,7 +529,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
lro_delay = kwargs.pop("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_cassandra_keyspace_initial( # type: ignore
raw_result = await self._delete_cassandra_keyspace_initial(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
@ -531,6 +539,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -593,7 +602,6 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -607,7 +615,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -621,7 +629,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
keyspace_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Optional[_models.ThroughputSettingsGetResults]:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -635,7 +643,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
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.ThroughputSettingsGetResults]] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -657,10 +665,10 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -668,20 +676,22 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (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("ThroughputSettingsGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -805,10 +815,11 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -832,7 +843,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
async def _migrate_cassandra_keyspace_to_autoscale_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any
) -> Optional[_models.ThroughputSettingsGetResults]:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -845,7 +856,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
_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.ThroughputSettingsGetResults]] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_cassandra_keyspace_to_autoscale_request(
resource_group_name=resource_group_name,
@ -856,10 +867,10 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -867,20 +878,22 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (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("ThroughputSettingsGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -924,10 +937,11 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -951,7 +965,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
async def _migrate_cassandra_keyspace_to_manual_throughput_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any
) -> Optional[_models.ThroughputSettingsGetResults]:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -964,7 +978,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
_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.ThroughputSettingsGetResults]] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_cassandra_keyspace_to_manual_throughput_request(
resource_group_name=resource_group_name,
@ -975,10 +989,10 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = 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,20 +1000,22 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (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("ThroughputSettingsGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -1043,10 +1059,11 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -1113,7 +1130,6 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -1129,7 +1145,6 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_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 +1216,6 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -1215,7 +1229,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("CassandraTableGetResults", pipeline_response)
deserialized = self._deserialize("CassandraTableGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -1230,7 +1244,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
table_name: str,
create_update_cassandra_table_parameters: Union[_models.CassandraTableCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Optional[_models.CassandraTableGetResults]:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1244,7 +1258,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
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.CassandraTableGetResults]] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -1269,10 +1283,10 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1280,20 +1294,22 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (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("CassandraTableGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -1427,10 +1443,11 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("CassandraTableGetResults", pipeline_response)
deserialized = self._deserialize("CassandraTableGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -1452,9 +1469,9 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
async def _delete_cassandra_table_initial( # pylint: disable=inconsistent-return-statements
async def _delete_cassandra_table_initial(
self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any
) -> None:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1467,7 +1484,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
_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_cassandra_table_request(
resource_group_name=resource_group_name,
@ -1479,10 +1496,10 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1490,6 +1507,10 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
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)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@ -1500,8 +1521,12 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
)
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_cassandra_table(
@ -1531,7 +1556,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
lro_delay = kwargs.pop("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_cassandra_table_initial( # type: ignore
raw_result = await self._delete_cassandra_table_initial(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
@ -1542,6 +1567,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -1607,7 +1633,6 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -1621,7 +1646,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -1636,7 +1661,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
table_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Optional[_models.ThroughputSettingsGetResults]:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1650,7 +1675,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
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.ThroughputSettingsGetResults]] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -1673,10 +1698,10 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1684,20 +1709,22 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (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("ThroughputSettingsGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -1831,10 +1858,11 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -1858,7 +1886,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
async def _migrate_cassandra_table_to_autoscale_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any
) -> Optional[_models.ThroughputSettingsGetResults]:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1871,7 +1899,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
_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.ThroughputSettingsGetResults]] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_cassandra_table_to_autoscale_request(
resource_group_name=resource_group_name,
@ -1883,10 +1911,10 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1894,20 +1922,22 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (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("ThroughputSettingsGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -1954,10 +1984,11 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -1981,7 +2012,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
async def _migrate_cassandra_table_to_manual_throughput_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any
) -> Optional[_models.ThroughputSettingsGetResults]:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1994,7 +2025,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
_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.ThroughputSettingsGetResults]] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_cassandra_table_to_manual_throughput_request(
resource_group_name=resource_group_name,
@ -2006,10 +2037,10 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -2017,20 +2048,22 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (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("ThroughputSettingsGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -2077,10 +2110,11 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized

Просмотреть файл

@ -20,14 +20,12 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from 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._collection_operations import (
build_list_metric_definitions_request,
build_list_metrics_request,
@ -119,7 +117,6 @@ class CollectionOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -135,7 +132,6 @@ class CollectionOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_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 +217,6 @@ class CollectionOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -237,7 +232,6 @@ class CollectionOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@ -312,7 +306,6 @@ class CollectionOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -328,7 +321,6 @@ class CollectionOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,14 +20,12 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from 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._collection_partition_operations import build_list_metrics_request, build_list_usages_request
if sys.version_info >= (3, 9):
@ -115,7 +113,6 @@ class CollectionPartitionOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -131,7 +128,6 @@ class CollectionPartitionOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_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 +213,6 @@ class CollectionPartitionOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -233,7 +228,6 @@ class CollectionPartitionOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,14 +20,12 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from 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._collection_partition_region_operations import build_list_metrics_request
if sys.version_info >= (3, 9):
@ -119,7 +117,6 @@ class CollectionPartitionRegionOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -135,7 +132,6 @@ class CollectionPartitionRegionOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,14 +20,12 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from 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._collection_region_operations import build_list_metrics_request
if sys.version_info >= (3, 9):
@ -119,7 +117,6 @@ class CollectionRegionOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -135,7 +132,6 @@ class CollectionRegionOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,14 +20,12 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from 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._database_account_region_operations import build_list_metrics_request
if sys.version_info >= (3, 9):
@ -105,7 +103,6 @@ class DatabaseAccountRegionOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -121,7 +118,6 @@ class DatabaseAccountRegionOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -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 @@ from azure.core.exceptions import (
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.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._database_accounts_operations import (
build_check_name_exists_request,
build_create_or_update_request,
@ -117,7 +117,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -131,7 +130,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("DatabaseAccountGetResults", pipeline_response)
deserialized = self._deserialize("DatabaseAccountGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -144,7 +143,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
account_name: str,
update_parameters: Union[_models.DatabaseAccountUpdateParameters, IO[bytes]],
**kwargs: Any
) -> _models.DatabaseAccountGetResults:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -158,7 +157,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
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.DatabaseAccountGetResults] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -179,10 +178,10 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -190,10 +189,14 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
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("DatabaseAccountGetResults", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -304,10 +307,11 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("DatabaseAccountGetResults", pipeline_response)
deserialized = self._deserialize("DatabaseAccountGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -335,7 +339,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
account_name: str,
create_update_parameters: Union[_models.DatabaseAccountCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> _models.DatabaseAccountGetResults:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -349,7 +353,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
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.DatabaseAccountGetResults] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -370,10 +374,10 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -381,10 +385,14 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
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("DatabaseAccountGetResults", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -501,10 +509,11 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("DatabaseAccountGetResults", pipeline_response)
deserialized = self._deserialize("DatabaseAccountGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -526,9 +535,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
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,
@ -541,7 +548,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
_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,
@ -551,10 +558,10 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -562,6 +569,10 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
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)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@ -572,8 +583,12 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
)
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, account_name: str, **kwargs: Any) -> AsyncLROPoller[None]:
@ -597,7 +612,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
lro_delay = kwargs.pop("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,
@ -606,6 +621,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -627,13 +643,13 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
)
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
async def _failover_priority_change_initial( # pylint: disable=inconsistent-return-statements
async def _failover_priority_change_initial(
self,
resource_group_name: str,
account_name: str,
failover_parameters: Union[_models.FailoverPolicies, IO[bytes]],
**kwargs: Any
) -> None:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -647,7 +663,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
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
@ -668,10 +684,10 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -679,6 +695,10 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
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)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@ -689,8 +709,12 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
)
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_failover_priority_change(
@ -787,7 +811,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
lro_delay = kwargs.pop("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_priority_change_initial( # type: ignore
raw_result = await self._failover_priority_change_initial(
resource_group_name=resource_group_name,
account_name=account_name,
failover_parameters=failover_parameters,
@ -798,6 +822,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -852,7 +877,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -868,7 +892,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@ -936,7 +959,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -952,7 +974,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@ -1018,7 +1039,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -1032,7 +1052,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("DatabaseAccountListKeysResult", pipeline_response)
deserialized = self._deserialize("DatabaseAccountListKeysResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -1076,7 +1096,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -1090,20 +1109,20 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("DatabaseAccountListConnectionStringsResult", pipeline_response)
deserialized = self._deserialize("DatabaseAccountListConnectionStringsResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
async def _offline_region_initial( # pylint: disable=inconsistent-return-statements
async def _offline_region_initial(
self,
resource_group_name: str,
account_name: str,
region_parameter_for_offline: Union[_models.RegionForOnlineOffline, IO[bytes]],
**kwargs: Any
) -> None:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1117,7 +1136,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
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
@ -1138,10 +1157,10 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1149,6 +1168,10 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the 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)
@ -1160,8 +1183,12 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
)
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_offline_region(
@ -1252,7 +1279,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._offline_region_initial( # type: ignore
raw_result = await self._offline_region_initial(
resource_group_name=resource_group_name,
account_name=account_name,
region_parameter_for_offline=region_parameter_for_offline,
@ -1263,6 +1290,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
await 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,13 +1312,13 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
)
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
async def _online_region_initial( # pylint: disable=inconsistent-return-statements
async def _online_region_initial(
self,
resource_group_name: str,
account_name: str,
region_parameter_for_online: Union[_models.RegionForOnlineOffline, IO[bytes]],
**kwargs: Any
) -> None:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1304,7 +1332,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
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
@ -1325,10 +1353,10 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1336,6 +1364,10 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the 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)
@ -1347,8 +1379,12 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
)
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_online_region(
@ -1439,7 +1475,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._online_region_initial( # type: ignore
raw_result = await self._online_region_initial(
resource_group_name=resource_group_name,
account_name=account_name,
region_parameter_for_online=region_parameter_for_online,
@ -1450,6 +1486,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -1508,7 +1545,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -1522,7 +1558,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("DatabaseAccountListReadOnlyKeysResult", pipeline_response)
deserialized = self._deserialize("DatabaseAccountListReadOnlyKeysResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -1566,7 +1602,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -1580,20 +1615,20 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("DatabaseAccountListReadOnlyKeysResult", pipeline_response)
deserialized = self._deserialize("DatabaseAccountListReadOnlyKeysResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
async def _regenerate_key_initial( # pylint: disable=inconsistent-return-statements
async def _regenerate_key_initial(
self,
resource_group_name: str,
account_name: str,
key_to_regenerate: Union[_models.DatabaseAccountRegenerateKeyParameters, IO[bytes]],
**kwargs: Any
) -> None:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1607,7 +1642,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
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
@ -1628,10 +1663,10 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1639,6 +1674,10 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@ -1649,8 +1688,12 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
)
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_regenerate_key(
@ -1739,7 +1782,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._regenerate_key_initial( # type: ignore
raw_result = await self._regenerate_key_initial(
resource_group_name=resource_group_name,
account_name=account_name,
key_to_regenerate=key_to_regenerate,
@ -1750,6 +1793,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -1803,7 +1847,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -1866,7 +1909,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -1882,7 +1924,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@ -1956,7 +1997,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -1972,7 +2012,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@ -2041,7 +2080,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -2057,7 +2095,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,14 +20,12 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from 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._database_operations import (
build_list_metric_definitions_request,
build_list_metrics_request,
@ -110,7 +108,6 @@ class DatabaseOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -126,7 +123,6 @@ class DatabaseOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@ -208,7 +204,6 @@ class DatabaseOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -224,7 +219,6 @@ class DatabaseOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@ -296,7 +290,6 @@ class DatabaseOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -312,7 +305,6 @@ class DatabaseOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -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 @@ from azure.core.exceptions import (
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.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._gremlin_resources_operations import (
build_create_update_gremlin_database_request,
build_create_update_gremlin_graph_request,
@ -121,7 +121,6 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -137,7 +136,6 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@ -207,7 +205,6 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -221,7 +218,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("GremlinDatabaseGetResults", pipeline_response)
deserialized = self._deserialize("GremlinDatabaseGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -235,7 +232,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
database_name: str,
create_update_gremlin_database_parameters: Union[_models.GremlinDatabaseCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Optional[_models.GremlinDatabaseGetResults]:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -249,7 +246,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
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.GremlinDatabaseGetResults]] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -273,10 +270,10 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -284,20 +281,22 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (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("GremlinDatabaseGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -421,10 +420,11 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("GremlinDatabaseGetResults", pipeline_response)
deserialized = self._deserialize("GremlinDatabaseGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -446,9 +446,9 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
async def _delete_gremlin_database_initial( # pylint: disable=inconsistent-return-statements
async def _delete_gremlin_database_initial(
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> None:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -461,7 +461,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
_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_gremlin_database_request(
resource_group_name=resource_group_name,
@ -472,10 +472,10 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = 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,6 +483,10 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
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)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@ -493,8 +497,12 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
)
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_gremlin_database(
@ -522,7 +530,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
lro_delay = kwargs.pop("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_gremlin_database_initial( # type: ignore
raw_result = await self._delete_gremlin_database_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
@ -532,6 +540,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
await 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,7 +603,6 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -608,7 +616,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -622,7 +630,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
database_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Optional[_models.ThroughputSettingsGetResults]:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -636,7 +644,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
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.ThroughputSettingsGetResults]] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -658,10 +666,10 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -669,20 +677,22 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (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("ThroughputSettingsGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -806,10 +816,11 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -833,7 +844,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
async def _migrate_gremlin_database_to_autoscale_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> Optional[_models.ThroughputSettingsGetResults]:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -846,7 +857,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
_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.ThroughputSettingsGetResults]] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_gremlin_database_to_autoscale_request(
resource_group_name=resource_group_name,
@ -857,10 +868,10 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -868,20 +879,22 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (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("ThroughputSettingsGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -925,10 +938,11 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -952,7 +966,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
async def _migrate_gremlin_database_to_manual_throughput_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> Optional[_models.ThroughputSettingsGetResults]:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -965,7 +979,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
_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.ThroughputSettingsGetResults]] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_gremlin_database_to_manual_throughput_request(
resource_group_name=resource_group_name,
@ -976,10 +990,10 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -987,20 +1001,22 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (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("ThroughputSettingsGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -1044,10 +1060,11 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -1114,7 +1131,6 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -1130,7 +1146,6 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_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 +1217,6 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -1216,7 +1230,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("GremlinGraphGetResults", pipeline_response)
deserialized = self._deserialize("GremlinGraphGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -1231,7 +1245,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
graph_name: str,
create_update_gremlin_graph_parameters: Union[_models.GremlinGraphCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Optional[_models.GremlinGraphGetResults]:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1245,7 +1259,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
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.GremlinGraphGetResults]] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -1268,10 +1282,10 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1279,20 +1293,22 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (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("GremlinGraphGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -1423,10 +1439,11 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("GremlinGraphGetResults", pipeline_response)
deserialized = self._deserialize("GremlinGraphGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -1448,9 +1465,9 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
async def _delete_gremlin_graph_initial( # pylint: disable=inconsistent-return-statements
async def _delete_gremlin_graph_initial(
self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any
) -> None:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1463,7 +1480,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
_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_gremlin_graph_request(
resource_group_name=resource_group_name,
@ -1475,10 +1492,10 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1486,6 +1503,10 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
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)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@ -1496,8 +1517,12 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
)
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_gremlin_graph(
@ -1527,7 +1552,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
lro_delay = kwargs.pop("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_gremlin_graph_initial( # type: ignore
raw_result = await self._delete_gremlin_graph_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
@ -1538,6 +1563,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -1603,7 +1629,6 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -1617,7 +1642,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -1632,7 +1657,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
graph_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Optional[_models.ThroughputSettingsGetResults]:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1646,7 +1671,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
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.ThroughputSettingsGetResults]] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -1669,10 +1694,10 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1680,20 +1705,22 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (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("ThroughputSettingsGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -1827,10 +1854,11 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -1854,7 +1882,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
async def _migrate_gremlin_graph_to_autoscale_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any
) -> Optional[_models.ThroughputSettingsGetResults]:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1867,7 +1895,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
_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.ThroughputSettingsGetResults]] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_gremlin_graph_to_autoscale_request(
resource_group_name=resource_group_name,
@ -1879,10 +1907,10 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1890,20 +1918,22 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (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("ThroughputSettingsGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -1950,10 +1980,11 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -1977,7 +2008,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
async def _migrate_gremlin_graph_to_manual_throughput_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any
) -> Optional[_models.ThroughputSettingsGetResults]:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1990,7 +2021,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
_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.ThroughputSettingsGetResults]] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_gremlin_graph_to_manual_throughput_request(
resource_group_name=resource_group_name,
@ -2002,10 +2033,10 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -2013,20 +2044,22 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (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("ThroughputSettingsGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -2073,10 +2106,11 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -2106,7 +2140,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
graph_name: str,
location: Union[_models.ContinuousBackupRestoreLocation, IO[bytes]],
**kwargs: Any
) -> Optional[_models.BackupInformation]:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -2120,7 +2154,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
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.BackupInformation]] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -2143,10 +2177,10 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -2154,12 +2188,14 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (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("BackupInformation", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -2286,10 +2322,11 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("BackupInformation", pipeline_response)
deserialized = self._deserialize("BackupInformation", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized

Просмотреть файл

@ -20,15 +20,13 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from 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._locations_operations import build_get_request, build_list_request
if sys.version_info >= (3, 9):
@ -89,7 +87,6 @@ class LocationsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -105,7 +102,6 @@ class LocationsOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_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 +162,6 @@ class LocationsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -180,7 +175,7 @@ class LocationsOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("LocationGetResult", pipeline_response)
deserialized = self._deserialize("LocationGetResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -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 @@ from azure.core.exceptions import (
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.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._notebook_workspaces_operations import (
build_create_or_update_request,
build_delete_request,
@ -109,7 +109,6 @@ class NotebookWorkspacesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -125,7 +124,6 @@ class NotebookWorkspacesOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@ -200,7 +198,6 @@ class NotebookWorkspacesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -215,7 +212,7 @@ class NotebookWorkspacesOperations:
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("NotebookWorkspace", pipeline_response)
deserialized = self._deserialize("NotebookWorkspace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -229,7 +226,7 @@ class NotebookWorkspacesOperations:
notebook_workspace_name: Union[str, _models.NotebookWorkspaceName],
notebook_create_update_parameters: Union[_models.NotebookWorkspaceCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> _models.NotebookWorkspace:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -243,7 +240,7 @@ class NotebookWorkspacesOperations:
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.NotebookWorkspace] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -265,10 +262,10 @@ class NotebookWorkspacesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -276,11 +273,15 @@ class NotebookWorkspacesOperations:
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("NotebookWorkspace", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -405,10 +406,11 @@ class NotebookWorkspacesOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("NotebookWorkspace", pipeline_response)
deserialized = self._deserialize("NotebookWorkspace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -430,13 +432,13 @@ class NotebookWorkspacesOperations:
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,
notebook_workspace_name: Union[str, _models.NotebookWorkspaceName],
**kwargs: Any
) -> None:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -449,7 +451,7 @@ class NotebookWorkspacesOperations:
_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,
@ -460,10 +462,10 @@ class NotebookWorkspacesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -471,12 +473,20 @@ class NotebookWorkspacesOperations:
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(
@ -509,7 +519,7 @@ class NotebookWorkspacesOperations:
lro_delay = kwargs.pop("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,
notebook_workspace_name=notebook_workspace_name,
@ -519,6 +529,7 @@ class NotebookWorkspacesOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -585,7 +596,6 @@ class NotebookWorkspacesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -600,20 +610,20 @@ class NotebookWorkspacesOperations:
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("NotebookWorkspaceConnectionInfoResult", pipeline_response)
deserialized = self._deserialize("NotebookWorkspaceConnectionInfoResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
async def _regenerate_auth_token_initial( # pylint: disable=inconsistent-return-statements
async def _regenerate_auth_token_initial(
self,
resource_group_name: str,
account_name: str,
notebook_workspace_name: Union[str, _models.NotebookWorkspaceName],
**kwargs: Any
) -> None:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -626,7 +636,7 @@ class NotebookWorkspacesOperations:
_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_regenerate_auth_token_request(
resource_group_name=resource_group_name,
@ -637,10 +647,10 @@ class NotebookWorkspacesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = 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,12 +658,20 @@ class NotebookWorkspacesOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the 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_regenerate_auth_token(
@ -686,7 +704,7 @@ class NotebookWorkspacesOperations:
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._regenerate_auth_token_initial( # type: ignore
raw_result = await self._regenerate_auth_token_initial(
resource_group_name=resource_group_name,
account_name=account_name,
notebook_workspace_name=notebook_workspace_name,
@ -696,6 +714,7 @@ class NotebookWorkspacesOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -717,13 +736,13 @@ class NotebookWorkspacesOperations:
)
return AsyncLROPoller[None](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,
account_name: str,
notebook_workspace_name: Union[str, _models.NotebookWorkspaceName],
**kwargs: Any
) -> None:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -736,7 +755,7 @@ class NotebookWorkspacesOperations:
_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,
@ -747,10 +766,10 @@ class NotebookWorkspacesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -758,12 +777,20 @@ class NotebookWorkspacesOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the 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_start(
@ -796,7 +823,7 @@ class NotebookWorkspacesOperations:
lro_delay = kwargs.pop("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,
account_name=account_name,
notebook_workspace_name=notebook_workspace_name,
@ -806,6 +833,7 @@ class NotebookWorkspacesOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements

Просмотреть файл

@ -20,14 +20,12 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from 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 @@ class Operations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -103,7 +100,6 @@ class Operations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,14 +20,12 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from 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._partition_key_range_id_operations import build_list_metrics_request
if sys.version_info >= (3, 9):
@ -118,7 +116,6 @@ class PartitionKeyRangeIdOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -134,7 +131,6 @@ class PartitionKeyRangeIdOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,14 +20,12 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from 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._partition_key_range_id_region_operations import build_list_metrics_request
if sys.version_info >= (3, 9):
@ -123,7 +121,6 @@ class PartitionKeyRangeIdRegionOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -139,7 +136,6 @@ class PartitionKeyRangeIdRegionOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,14 +20,12 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from 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._percentile_operations import build_list_metrics_request
if sys.version_info >= (3, 9):
@ -103,7 +101,6 @@ class PercentileOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -119,7 +116,6 @@ class PercentileOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,14 +20,12 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from 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._percentile_source_target_operations import build_list_metrics_request
if sys.version_info >= (3, 9):
@ -117,7 +115,6 @@ class PercentileSourceTargetOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -133,7 +130,6 @@ class PercentileSourceTargetOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,14 +20,12 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from 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._percentile_target_operations import build_list_metrics_request
if sys.version_info >= (3, 9):
@ -107,7 +105,6 @@ class PercentileTargetOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -123,7 +120,6 @@ class PercentileTargetOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -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 @@ from azure.core.exceptions import (
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.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_connections_operations import (
build_create_or_update_request,
build_delete_request,
@ -108,7 +108,6 @@ class PrivateEndpointConnectionsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -124,7 +123,6 @@ class PrivateEndpointConnectionsOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@ -193,7 +191,6 @@ class PrivateEndpointConnectionsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -207,7 +204,7 @@ class PrivateEndpointConnectionsOperations:
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
@ -221,7 +218,7 @@ class PrivateEndpointConnectionsOperations:
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,
@ -235,7 +232,7 @@ class PrivateEndpointConnectionsOperations:
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
@ -257,10 +254,10 @@ class PrivateEndpointConnectionsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = 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,13 +265,15 @@ class PrivateEndpointConnectionsOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the 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)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response)
raise HttpResponseError(response=response, model=error, 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
@ -393,10 +392,11 @@ class PrivateEndpointConnectionsOperations:
params=_params,
**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
@ -418,9 +418,9 @@ class PrivateEndpointConnectionsOperations:
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, private_endpoint_connection_name: str, **kwargs: Any
) -> None:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -433,7 +433,7 @@ class PrivateEndpointConnectionsOperations:
_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,
@ -444,10 +444,10 @@ class PrivateEndpointConnectionsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -455,12 +455,20 @@ class PrivateEndpointConnectionsOperations:
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)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = response.stream_download(self._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(
@ -488,7 +496,7 @@ class PrivateEndpointConnectionsOperations:
lro_delay = kwargs.pop("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,
private_endpoint_connection_name=private_endpoint_connection_name,
@ -498,6 +506,7 @@ class PrivateEndpointConnectionsOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements

Просмотреть файл

@ -20,15 +20,13 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from 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_database_account_request
if sys.version_info >= (3, 9):
@ -99,7 +97,6 @@ class PrivateLinkResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -115,7 +112,6 @@ class PrivateLinkResourcesOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_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 @@ class PrivateLinkResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -198,7 +193,7 @@ class PrivateLinkResourcesOperations:
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

Просмотреть файл

@ -20,15 +20,13 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from 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._restorable_database_accounts_operations import (
build_get_by_location_request,
build_list_by_location_request,
@ -103,7 +101,6 @@ class RestorableDatabaseAccountsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -119,7 +116,6 @@ class RestorableDatabaseAccountsOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_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 @@ class RestorableDatabaseAccountsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -198,7 +193,6 @@ class RestorableDatabaseAccountsOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_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 @@ class RestorableDatabaseAccountsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -279,7 +272,7 @@ class RestorableDatabaseAccountsOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("RestorableDatabaseAccountGetResult", pipeline_response)
deserialized = self._deserialize("RestorableDatabaseAccountGetResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore

Просмотреть файл

@ -20,14 +20,12 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from 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._restorable_gremlin_databases_operations import build_list_request
if sys.version_info >= (3, 9):
@ -102,7 +100,6 @@ class RestorableGremlinDatabasesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -118,7 +115,6 @@ class RestorableGremlinDatabasesOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,14 +20,12 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from 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._restorable_gremlin_graphs_operations import build_list_request
if sys.version_info >= (3, 9):
@ -117,7 +115,6 @@ class RestorableGremlinGraphsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -133,7 +130,6 @@ class RestorableGremlinGraphsOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,14 +20,12 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from 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._restorable_gremlin_resources_operations import build_list_request
if sys.version_info >= (3, 9):
@ -115,7 +113,6 @@ class RestorableGremlinResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -131,7 +128,6 @@ class RestorableGremlinResourcesOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,14 +20,12 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from 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._restorable_mongodb_collections_operations import build_list_request
if sys.version_info >= (3, 9):
@ -117,7 +115,6 @@ class RestorableMongodbCollectionsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -133,7 +130,6 @@ class RestorableMongodbCollectionsOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,14 +20,12 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from 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._restorable_mongodb_databases_operations import build_list_request
if sys.version_info >= (3, 9):
@ -102,7 +100,6 @@ class RestorableMongodbDatabasesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -118,7 +115,6 @@ class RestorableMongodbDatabasesOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,14 +20,12 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from 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._restorable_mongodb_resources_operations import build_list_request
if sys.version_info >= (3, 9):
@ -115,7 +113,6 @@ class RestorableMongodbResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -131,7 +128,6 @@ class RestorableMongodbResourcesOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,14 +20,12 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from 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._restorable_sql_containers_operations import build_list_request
if sys.version_info >= (3, 9):
@ -116,7 +114,6 @@ class RestorableSqlContainersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -132,7 +129,6 @@ class RestorableSqlContainersOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,14 +20,12 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from 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._restorable_sql_databases_operations import build_list_request
if sys.version_info >= (3, 9):
@ -102,7 +100,6 @@ class RestorableSqlDatabasesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -118,7 +115,6 @@ class RestorableSqlDatabasesOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,14 +20,12 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from 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._restorable_sql_resources_operations import build_list_request
if sys.version_info >= (3, 9):
@ -115,7 +113,6 @@ class RestorableSqlResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -131,7 +128,6 @@ class RestorableSqlResourcesOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,14 +20,12 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from 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._restorable_table_resources_operations import build_list_request
if sys.version_info >= (3, 9):
@ -114,7 +112,6 @@ class RestorableTableResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -130,7 +127,6 @@ class RestorableTableResourcesOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,14 +20,12 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from 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._restorable_tables_operations import build_list_request
if sys.version_info >= (3, 9):
@ -112,7 +110,6 @@ class RestorableTablesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -128,7 +125,6 @@ class RestorableTablesOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -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 @@ from azure.core.exceptions import (
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.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._service_operations import (
build_create_request,
build_delete_request,
@ -106,7 +106,6 @@ class ServiceOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -122,7 +121,6 @@ class ServiceOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_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 +156,7 @@ class ServiceOperations:
service_name: str,
create_update_parameters: Union[_models.ServiceResourceCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Optional[_models.ServiceResource]:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -172,7 +170,7 @@ class ServiceOperations:
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.ServiceResource]] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -194,10 +192,10 @@ class ServiceOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -205,20 +203,22 @@ class ServiceOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (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("ServiceResource", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -336,10 +336,11 @@ class ServiceOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ServiceResource", pipeline_response)
deserialized = self._deserialize("ServiceResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -401,7 +402,6 @@ class ServiceOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -415,16 +415,16 @@ class ServiceOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ServiceResource", pipeline_response)
deserialized = self._deserialize("ServiceResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
async def _delete_initial( # pylint: disable=inconsistent-return-statements
async def _delete_initial(
self, resource_group_name: str, account_name: str, service_name: str, **kwargs: Any
) -> None:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -437,7 +437,7 @@ class ServiceOperations:
_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,
@ -448,10 +448,10 @@ class ServiceOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -459,6 +459,10 @@ class ServiceOperations:
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)
@ -469,8 +473,12 @@ class ServiceOperations:
)
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(
@ -498,7 +506,7 @@ class ServiceOperations:
lro_delay = kwargs.pop("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,
service_name=service_name,
@ -508,6 +516,7 @@ class ServiceOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -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 @@ from azure.core.exceptions import (
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.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._table_resources_operations import (
build_create_update_table_request,
build_delete_table_request,
@ -111,7 +111,6 @@ class TableResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -127,7 +126,6 @@ class TableResourcesOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_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 @@ class TableResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -210,7 +207,7 @@ class TableResourcesOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("TableGetResults", pipeline_response)
deserialized = self._deserialize("TableGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -224,7 +221,7 @@ class TableResourcesOperations:
table_name: str,
create_update_table_parameters: Union[_models.TableCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Optional[_models.TableGetResults]:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -238,7 +235,7 @@ class TableResourcesOperations:
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.TableGetResults]] = 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 @@ class TableResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = 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,20 +268,22 @@ class TableResourcesOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (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("TableGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -403,10 +402,11 @@ class TableResourcesOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("TableGetResults", pipeline_response)
deserialized = self._deserialize("TableGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -428,9 +428,9 @@ class TableResourcesOperations:
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
async def _delete_table_initial( # pylint: disable=inconsistent-return-statements
async def _delete_table_initial(
self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any
) -> None:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -443,7 +443,7 @@ class TableResourcesOperations:
_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_table_request(
resource_group_name=resource_group_name,
@ -454,10 +454,10 @@ class TableResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = 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,6 +465,10 @@ class TableResourcesOperations:
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)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@ -475,8 +479,12 @@ class TableResourcesOperations:
)
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_table(
@ -504,7 +512,7 @@ class TableResourcesOperations:
lro_delay = kwargs.pop("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_table_initial( # type: ignore
raw_result = await self._delete_table_initial(
resource_group_name=resource_group_name,
account_name=account_name,
table_name=table_name,
@ -514,6 +522,7 @@ class TableResourcesOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -576,7 +585,6 @@ class TableResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -590,7 +598,7 @@ class TableResourcesOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -604,7 +612,7 @@ class TableResourcesOperations:
table_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Optional[_models.ThroughputSettingsGetResults]:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -618,7 +626,7 @@ class TableResourcesOperations:
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.ThroughputSettingsGetResults]] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -640,10 +648,10 @@ class TableResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -651,20 +659,22 @@ class TableResourcesOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (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("ThroughputSettingsGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -788,10 +798,11 @@ class TableResourcesOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -815,7 +826,7 @@ class TableResourcesOperations:
async def _migrate_table_to_autoscale_initial(
self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any
) -> Optional[_models.ThroughputSettingsGetResults]:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -828,7 +839,7 @@ class TableResourcesOperations:
_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.ThroughputSettingsGetResults]] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_table_to_autoscale_request(
resource_group_name=resource_group_name,
@ -839,10 +850,10 @@ class TableResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -850,20 +861,22 @@ class TableResourcesOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (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("ThroughputSettingsGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -907,10 +920,11 @@ class TableResourcesOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -934,7 +948,7 @@ class TableResourcesOperations:
async def _migrate_table_to_manual_throughput_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any
) -> Optional[_models.ThroughputSettingsGetResults]:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -947,7 +961,7 @@ class TableResourcesOperations:
_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.ThroughputSettingsGetResults]] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_table_to_manual_throughput_request(
resource_group_name=resource_group_name,
@ -958,10 +972,10 @@ class TableResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -969,20 +983,22 @@ class TableResourcesOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (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("ThroughputSettingsGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -1026,10 +1042,11 @@ class TableResourcesOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -1058,7 +1075,7 @@ class TableResourcesOperations:
table_name: str,
location: Union[_models.ContinuousBackupRestoreLocation, IO[bytes]],
**kwargs: Any
) -> Optional[_models.BackupInformation]:
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1072,7 +1089,7 @@ class TableResourcesOperations:
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.BackupInformation]] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -1094,10 +1111,10 @@ class TableResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1105,12 +1122,14 @@ class TableResourcesOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (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("BackupInformation", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -1227,10 +1246,11 @@ class TableResourcesOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("BackupInformation", pipeline_response)
deserialized = self._deserialize("BackupInformation", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized

Просмотреть файл

@ -81,7 +81,10 @@ from ._models_py3 import DatabaseAccountRegenerateKeyParameters
from ._models_py3 import DatabaseAccountUpdateParameters
from ._models_py3 import DatabaseAccountsListResult
from ._models_py3 import DatabaseRestoreResource
from ._models_py3 import ErrorAdditionalInfo
from ._models_py3 import ErrorDetail
from ._models_py3 import ErrorResponse
from ._models_py3 import ErrorResponseAutoGenerated
from ._models_py3 import ExcludedPath
from ._models_py3 import ExtendedResourceProperties
from ._models_py3 import FailoverPolicies
@ -408,7 +411,10 @@ __all__ = [
"DatabaseAccountUpdateParameters",
"DatabaseAccountsListResult",
"DatabaseRestoreResource",
"ErrorAdditionalInfo",
"ErrorDetail",
"ErrorResponse",
"ErrorResponseAutoGenerated",
"ExcludedPath",
"ExtendedResourceProperties",
"FailoverPolicies",

Просмотреть файл

@ -324,7 +324,7 @@ class RoleDefinitionType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
class ServerVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Describes the ServerVersion of an a MongoDB account."""
"""Describes the version of the MongoDB account."""
THREE2 = "3.2"
THREE6 = "3.6"
@ -332,6 +332,7 @@ class ServerVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta):
FOUR2 = "4.2"
FIVE0 = "5.0"
SIX0 = "6.0"
SEVEN0 = "7.0"
class ServiceSize(str, Enum, metaclass=CaseInsensitiveEnumMeta):

Просмотреть файл

@ -69,8 +69,8 @@ class AnalyticalStorageConfiguration(_serialization.Model):
class ApiProperties(_serialization.Model):
"""ApiProperties.
:ivar server_version: Describes the ServerVersion of an a MongoDB account. Known values are:
"3.2", "3.6", "4.0", "4.2", "5.0", and "6.0".
:ivar server_version: Describes the version of the MongoDB account. Known values are: "3.2",
"3.6", "4.0", "4.2", "5.0", "6.0", and "7.0".
:vartype server_version: str or ~azure.mgmt.cosmosdb.models.ServerVersion
"""
@ -80,8 +80,8 @@ class ApiProperties(_serialization.Model):
def __init__(self, *, server_version: Optional[Union[str, "_models.ServerVersion"]] = None, **kwargs: Any) -> None:
"""
:keyword server_version: Describes the ServerVersion of an a MongoDB account. Known values are:
"3.2", "3.6", "4.0", "4.2", "5.0", and "6.0".
:keyword server_version: Describes the version of the MongoDB account. Known values are: "3.2",
"3.6", "4.0", "4.2", "5.0", "6.0", and "7.0".
:paramtype server_version: str or ~azure.mgmt.cosmosdb.models.ServerVersion
"""
super().__init__(**kwargs)
@ -2955,8 +2955,8 @@ class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): # pylint: d
1.2. Cassandra and Mongo APIs only work with Tls 1.2. Known values are: "Tls", "Tls11", and
"Tls12".
:vartype minimal_tls_version: str or ~azure.mgmt.cosmosdb.models.MinimalTlsVersion
:ivar enable_burst_capacity: Flag to indicate enabling/disabling of Burst Capacity Preview
feature on the account.
:ivar enable_burst_capacity: Flag to indicate enabling/disabling of Burst Capacity feature on
the account.
:vartype enable_burst_capacity: bool
:ivar customer_managed_key_status: Indicates the status of the Customer Managed Key feature on
the account. In case there are errors, the property provides troubleshooting guidance.
@ -3153,8 +3153,8 @@ class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): # pylint: d
Tls 1.2. Cassandra and Mongo APIs only work with Tls 1.2. Known values are: "Tls", "Tls11", and
"Tls12".
:paramtype minimal_tls_version: str or ~azure.mgmt.cosmosdb.models.MinimalTlsVersion
:keyword enable_burst_capacity: Flag to indicate enabling/disabling of Burst Capacity Preview
feature on the account.
:keyword enable_burst_capacity: Flag to indicate enabling/disabling of Burst Capacity feature
on the account.
:paramtype enable_burst_capacity: bool
:keyword customer_managed_key_status: Indicates the status of the Customer Managed Key feature
on the account. In case there are errors, the property provides troubleshooting guidance.
@ -3328,8 +3328,8 @@ class DatabaseAccountGetResults(ARMResourceProperties): # pylint: disable=too-m
1.2. Cassandra and Mongo APIs only work with Tls 1.2. Known values are: "Tls", "Tls11", and
"Tls12".
:vartype minimal_tls_version: str or ~azure.mgmt.cosmosdb.models.MinimalTlsVersion
:ivar enable_burst_capacity: Flag to indicate enabling/disabling of Burst Capacity Preview
feature on the account.
:ivar enable_burst_capacity: Flag to indicate enabling/disabling of Burst Capacity feature on
the account.
:vartype enable_burst_capacity: bool
:ivar customer_managed_key_status: Indicates the status of the Customer Managed Key feature on
the account. In case there are errors, the property provides troubleshooting guidance.
@ -3539,8 +3539,8 @@ class DatabaseAccountGetResults(ARMResourceProperties): # pylint: disable=too-m
Tls 1.2. Cassandra and Mongo APIs only work with Tls 1.2. Known values are: "Tls", "Tls11", and
"Tls12".
:paramtype minimal_tls_version: str or ~azure.mgmt.cosmosdb.models.MinimalTlsVersion
:keyword enable_burst_capacity: Flag to indicate enabling/disabling of Burst Capacity Preview
feature on the account.
:keyword enable_burst_capacity: Flag to indicate enabling/disabling of Burst Capacity feature
on the account.
:paramtype enable_burst_capacity: bool
:keyword customer_managed_key_status: Indicates the status of the Customer Managed Key feature
on the account. In case there are errors, the property provides troubleshooting guidance.
@ -3863,8 +3863,8 @@ class DatabaseAccountUpdateParameters(_serialization.Model): # pylint: disable=
1.2. Cassandra and Mongo APIs only work with Tls 1.2. Known values are: "Tls", "Tls11", and
"Tls12".
:vartype minimal_tls_version: str or ~azure.mgmt.cosmosdb.models.MinimalTlsVersion
:ivar enable_burst_capacity: Flag to indicate enabling/disabling of Burst Capacity Preview
feature on the account.
:ivar enable_burst_capacity: Flag to indicate enabling/disabling of Burst Capacity feature on
the account.
:vartype enable_burst_capacity: bool
:ivar customer_managed_key_status: Indicates the status of the Customer Managed Key feature on
the account. In case there are errors, the property provides troubleshooting guidance.
@ -4036,8 +4036,8 @@ class DatabaseAccountUpdateParameters(_serialization.Model): # pylint: disable=
Tls 1.2. Cassandra and Mongo APIs only work with Tls 1.2. Known values are: "Tls", "Tls11", and
"Tls12".
:paramtype minimal_tls_version: str or ~azure.mgmt.cosmosdb.models.MinimalTlsVersion
:keyword enable_burst_capacity: Flag to indicate enabling/disabling of Burst Capacity Preview
feature on the account.
:keyword enable_burst_capacity: Flag to indicate enabling/disabling of Burst Capacity feature
on the account.
:paramtype enable_burst_capacity: bool
:keyword customer_managed_key_status: Indicates the status of the Customer Managed Key feature
on the account. In case there are errors, the property provides troubleshooting guidance.
@ -4649,6 +4649,77 @@ class DataTransferServiceResourceProperties(ServiceResourceProperties):
self.locations = None
class ErrorAdditionalInfo(_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: JSON
"""
_validation = {
"type": {"readonly": True},
"info": {"readonly": True},
}
_attribute_map = {
"type": {"key": "type", "type": "str"},
"info": {"key": "info", "type": "object"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.type = None
self.info = None
class ErrorDetail(_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.mgmt.cosmosdb.models.ErrorDetail]
:ivar additional_info: The error additional info.
:vartype additional_info: list[~azure.mgmt.cosmosdb.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: Any) -> None:
""" """
super().__init__(**kwargs)
self.code = None
self.message = None
self.target = None
self.details = None
self.additional_info = None
class ErrorResponse(_serialization.Model):
"""Error Response.
@ -4675,6 +4746,27 @@ class ErrorResponse(_serialization.Model):
self.message = message
class ErrorResponseAutoGenerated(_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 error: The error object.
:vartype error: ~azure.mgmt.cosmosdb.models.ErrorDetail
"""
_attribute_map = {
"error": {"key": "error", "type": "ErrorDetail"},
}
def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None:
"""
:keyword error: The error object.
:paramtype error: ~azure.mgmt.cosmosdb.models.ErrorDetail
"""
super().__init__(**kwargs)
self.error = error
class ExcludedPath(_serialization.Model):
"""ExcludedPath.
@ -8775,11 +8867,15 @@ class RestoreParametersBase(_serialization.Model):
:vartype restore_source: str
:ivar restore_timestamp_in_utc: Time to which the account has to be restored (ISO-8601 format).
:vartype restore_timestamp_in_utc: ~datetime.datetime
:ivar restore_with_ttl_disabled: Specifies whether the restored account will have Time-To-Live
disabled upon the successful restore.
:vartype restore_with_ttl_disabled: bool
"""
_attribute_map = {
"restore_source": {"key": "restoreSource", "type": "str"},
"restore_timestamp_in_utc": {"key": "restoreTimestampInUtc", "type": "iso-8601"},
"restore_with_ttl_disabled": {"key": "restoreWithTtlDisabled", "type": "bool"},
}
def __init__(
@ -8787,6 +8883,7 @@ class RestoreParametersBase(_serialization.Model):
*,
restore_source: Optional[str] = None,
restore_timestamp_in_utc: Optional[datetime.datetime] = None,
restore_with_ttl_disabled: Optional[bool] = None,
**kwargs: Any
) -> None:
"""
@ -8797,10 +8894,14 @@ class RestoreParametersBase(_serialization.Model):
:keyword restore_timestamp_in_utc: Time to which the account has to be restored (ISO-8601
format).
:paramtype restore_timestamp_in_utc: ~datetime.datetime
:keyword restore_with_ttl_disabled: Specifies whether the restored account will have
Time-To-Live disabled upon the successful restore.
:paramtype restore_with_ttl_disabled: bool
"""
super().__init__(**kwargs)
self.restore_source = restore_source
self.restore_timestamp_in_utc = restore_timestamp_in_utc
self.restore_with_ttl_disabled = restore_with_ttl_disabled
class ResourceRestoreParameters(RestoreParametersBase):
@ -8812,6 +8913,9 @@ class ResourceRestoreParameters(RestoreParametersBase):
:vartype restore_source: str
:ivar restore_timestamp_in_utc: Time to which the account has to be restored (ISO-8601 format).
:vartype restore_timestamp_in_utc: ~datetime.datetime
:ivar restore_with_ttl_disabled: Specifies whether the restored account will have Time-To-Live
disabled upon the successful restore.
:vartype restore_with_ttl_disabled: bool
"""
@ -10498,6 +10602,9 @@ class RestoreParameters(RestoreParametersBase):
:vartype restore_source: str
:ivar restore_timestamp_in_utc: Time to which the account has to be restored (ISO-8601 format).
:vartype restore_timestamp_in_utc: ~datetime.datetime
:ivar restore_with_ttl_disabled: Specifies whether the restored account will have Time-To-Live
disabled upon the successful restore.
:vartype restore_with_ttl_disabled: bool
:ivar restore_mode: Describes the mode of the restore. "PointInTime"
:vartype restore_mode: str or ~azure.mgmt.cosmosdb.models.RestoreMode
:ivar databases_to_restore: List of specific databases available for restore.
@ -10512,6 +10619,7 @@ class RestoreParameters(RestoreParametersBase):
_attribute_map = {
"restore_source": {"key": "restoreSource", "type": "str"},
"restore_timestamp_in_utc": {"key": "restoreTimestampInUtc", "type": "iso-8601"},
"restore_with_ttl_disabled": {"key": "restoreWithTtlDisabled", "type": "bool"},
"restore_mode": {"key": "restoreMode", "type": "str"},
"databases_to_restore": {"key": "databasesToRestore", "type": "[DatabaseRestoreResource]"},
"gremlin_databases_to_restore": {
@ -10526,6 +10634,7 @@ class RestoreParameters(RestoreParametersBase):
*,
restore_source: Optional[str] = None,
restore_timestamp_in_utc: Optional[datetime.datetime] = None,
restore_with_ttl_disabled: Optional[bool] = None,
restore_mode: Optional[Union[str, "_models.RestoreMode"]] = None,
databases_to_restore: Optional[List["_models.DatabaseRestoreResource"]] = None,
gremlin_databases_to_restore: Optional[List["_models.GremlinDatabaseRestoreResource"]] = None,
@ -10540,6 +10649,9 @@ class RestoreParameters(RestoreParametersBase):
:keyword restore_timestamp_in_utc: Time to which the account has to be restored (ISO-8601
format).
:paramtype restore_timestamp_in_utc: ~datetime.datetime
:keyword restore_with_ttl_disabled: Specifies whether the restored account will have
Time-To-Live disabled upon the successful restore.
:paramtype restore_with_ttl_disabled: bool
:keyword restore_mode: Describes the mode of the restore. "PointInTime"
:paramtype restore_mode: str or ~azure.mgmt.cosmosdb.models.RestoreMode
:keyword databases_to_restore: List of specific databases available for restore.
@ -10551,7 +10663,12 @@ class RestoreParameters(RestoreParametersBase):
:keyword tables_to_restore: List of specific tables available for restore.
:paramtype tables_to_restore: list[str]
"""
super().__init__(restore_source=restore_source, restore_timestamp_in_utc=restore_timestamp_in_utc, **kwargs)
super().__init__(
restore_source=restore_source,
restore_timestamp_in_utc=restore_timestamp_in_utc,
restore_with_ttl_disabled=restore_with_ttl_disabled,
**kwargs
)
self.restore_mode = restore_mode
self.databases_to_restore = databases_to_restore
self.gremlin_databases_to_restore = gremlin_databases_to_restore

Просмотреть файл

@ -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 @@ from azure.core.exceptions import (
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 azure.mgmt.core.polling.arm_polling import ARMPolling
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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -74,7 +74,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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -104,7 +104,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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -139,7 +139,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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -174,7 +174,7 @@ def build_create_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -212,7 +212,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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
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_invoke_command_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -288,7 +288,7 @@ def build_deallocate_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -323,7 +323,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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -358,7 +358,7 @@ def build_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -437,7 +437,6 @@ class CassandraClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -453,7 +452,6 @@ class CassandraClustersOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@ -517,7 +515,6 @@ class CassandraClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -533,7 +530,6 @@ class CassandraClustersOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@ -597,7 +593,6 @@ class CassandraClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -611,16 +606,14 @@ class CassandraClustersOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ClusterResource", pipeline_response)
deserialized = self._deserialize("ClusterResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, cluster_name: str, **kwargs: Any
) -> None:
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,
@ -633,7 +626,7 @@ class CassandraClustersOperations:
_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,
@ -643,10 +636,10 @@ class CassandraClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -654,11 +647,19 @@ class CassandraClustersOperations:
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)
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, cluster_name: str, **kwargs: Any) -> LROPoller[None]:
@ -682,7 +683,7 @@ class CassandraClustersOperations:
lro_delay = kwargs.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,
@ -691,6 +692,7 @@ class CassandraClustersOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -718,7 +720,7 @@ class CassandraClustersOperations:
cluster_name: str,
body: Union[_models.ClusterResource, IO[bytes]],
**kwargs: Any
) -> _models.ClusterResource:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -732,7 +734,7 @@ class CassandraClustersOperations:
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.ClusterResource] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -753,10 +755,10 @@ class CassandraClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -764,14 +766,14 @@ class CassandraClustersOperations:
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("ClusterResource", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("ClusterResource", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -883,10 +885,11 @@ class CassandraClustersOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ClusterResource", pipeline_response)
deserialized = self._deserialize("ClusterResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -914,7 +917,7 @@ class CassandraClustersOperations:
cluster_name: str,
body: Union[_models.ClusterResource, IO[bytes]],
**kwargs: Any
) -> _models.ClusterResource:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -928,7 +931,7 @@ class CassandraClustersOperations:
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.ClusterResource] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -949,10 +952,10 @@ class CassandraClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -960,14 +963,14 @@ class CassandraClustersOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
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("ClusterResource", pipeline_response)
if response.status_code == 202:
deserialized = self._deserialize("ClusterResource", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -1074,10 +1077,11 @@ class CassandraClustersOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ClusterResource", pipeline_response)
deserialized = self._deserialize("ClusterResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -1105,7 +1109,7 @@ class CassandraClustersOperations:
cluster_name: str,
body: Union[_models.CommandPostBody, IO[bytes]],
**kwargs: Any
) -> _models.CommandOutput:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1119,7 +1123,7 @@ class CassandraClustersOperations:
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.CommandOutput] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -1140,10 +1144,10 @@ class CassandraClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1151,10 +1155,14 @@ class CassandraClustersOperations:
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)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("CommandOutput", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -1261,10 +1269,11 @@ class CassandraClustersOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("CommandOutput", pipeline_response)
deserialized = self._deserialize("CommandOutput", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -1286,9 +1295,7 @@ class CassandraClustersOperations:
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _deallocate_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, cluster_name: str, **kwargs: Any
) -> None:
def _deallocate_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1301,7 +1308,7 @@ class CassandraClustersOperations:
_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_deallocate_request(
resource_group_name=resource_group_name,
@ -1311,10 +1318,10 @@ class CassandraClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1322,11 +1329,19 @@ class CassandraClustersOperations:
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)
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_deallocate(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> LROPoller[None]:
@ -1352,7 +1367,7 @@ class CassandraClustersOperations:
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._deallocate_initial( # type: ignore
raw_result = self._deallocate_initial(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
api_version=api_version,
@ -1361,6 +1376,7 @@ class CassandraClustersOperations:
params=_params,
**kwargs
)
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,9 +1398,7 @@ class CassandraClustersOperations:
)
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, cluster_name: str, **kwargs: Any
) -> None:
def _start_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1397,7 +1411,7 @@ class CassandraClustersOperations:
_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,
@ -1407,10 +1421,10 @@ class CassandraClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1418,11 +1432,19 @@ class CassandraClustersOperations:
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)
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(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> LROPoller[None]:
@ -1448,7 +1470,7 @@ class CassandraClustersOperations:
lro_delay = kwargs.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,
cluster_name=cluster_name,
api_version=api_version,
@ -1457,6 +1479,7 @@ class CassandraClustersOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -1515,7 +1538,6 @@ class CassandraClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -1529,7 +1551,7 @@ class CassandraClustersOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("CassandraClusterPublicStatus", pipeline_response)
deserialized = self._deserialize("CassandraClusterPublicStatus", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore

Просмотреть файл

@ -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 @@ from azure.core.exceptions import (
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 azure.mgmt.core.polling.arm_polling import ARMPolling
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, 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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -126,7 +126,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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -169,7 +169,7 @@ def build_create_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -215,7 +215,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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -314,7 +314,6 @@ class CassandraDataCentersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -330,7 +329,6 @@ class CassandraDataCentersOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@ -399,7 +397,6 @@ class CassandraDataCentersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -413,16 +410,16 @@ class CassandraDataCentersOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("DataCenterResource", pipeline_response)
deserialized = self._deserialize("DataCenterResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _delete_initial( # pylint: disable=inconsistent-return-statements
def _delete_initial(
self, resource_group_name: str, cluster_name: str, data_center_name: str, **kwargs: Any
) -> None:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -435,7 +432,7 @@ class CassandraDataCentersOperations:
_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,
@ -446,10 +443,10 @@ class CassandraDataCentersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -457,11 +454,19 @@ class CassandraDataCentersOperations:
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)
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(
@ -489,7 +494,7 @@ class CassandraDataCentersOperations:
lro_delay = kwargs.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,
data_center_name=data_center_name,
@ -499,6 +504,7 @@ class CassandraDataCentersOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -527,7 +533,7 @@ class CassandraDataCentersOperations:
data_center_name: str,
body: Union[_models.DataCenterResource, IO[bytes]],
**kwargs: Any
) -> _models.DataCenterResource:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -541,7 +547,7 @@ class CassandraDataCentersOperations:
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.DataCenterResource] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -563,10 +569,10 @@ class CassandraDataCentersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -574,14 +580,14 @@ class CassandraDataCentersOperations:
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("DataCenterResource", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("DataCenterResource", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -701,10 +707,11 @@ class CassandraDataCentersOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("DataCenterResource", pipeline_response)
deserialized = self._deserialize("DataCenterResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -733,7 +740,7 @@ class CassandraDataCentersOperations:
data_center_name: str,
body: Union[_models.DataCenterResource, IO[bytes]],
**kwargs: Any
) -> _models.DataCenterResource:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -747,7 +754,7 @@ class CassandraDataCentersOperations:
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.DataCenterResource] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -769,10 +776,10 @@ class CassandraDataCentersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -780,14 +787,14 @@ class CassandraDataCentersOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
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("DataCenterResource", pipeline_response)
if response.status_code == 202:
deserialized = self._deserialize("DataCenterResource", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -904,10 +911,11 @@ class CassandraDataCentersOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("DataCenterResource", pipeline_response)
deserialized = self._deserialize("DataCenterResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized

Просмотреть файл

@ -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 @@ from azure.core.exceptions import (
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 azure.mgmt.core.polling.arm_polling import ARMPolling
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_cassandra_keyspaces_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -85,7 +85,7 @@ def build_get_cassandra_keyspace_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -121,7 +121,7 @@ def build_create_update_cassandra_keyspace_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -159,7 +159,7 @@ def build_delete_cassandra_keyspace_request(
) -> HttpRequest:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
# Construct URL
_url = kwargs.pop(
"template_url",
@ -190,7 +190,7 @@ def build_get_cassandra_keyspace_throughput_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -226,7 +226,7 @@ def build_update_cassandra_keyspace_throughput_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -265,7 +265,7 @@ def build_migrate_cassandra_keyspace_to_autoscale_request( # pylint: disable=na
_headers = case_insensitive_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-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -301,7 +301,7 @@ def build_migrate_cassandra_keyspace_to_manual_throughput_request( # pylint: di
_headers = case_insensitive_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-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -337,7 +337,7 @@ def build_list_cassandra_tables_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -378,7 +378,7 @@ def build_get_cassandra_table_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -420,7 +420,7 @@ def build_create_update_cassandra_table_request( # pylint: disable=name-too-lon
_headers = case_insensitive_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-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -464,7 +464,7 @@ def build_delete_cassandra_table_request(
) -> HttpRequest:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
# Construct URL
_url = kwargs.pop(
"template_url",
@ -501,7 +501,7 @@ def build_get_cassandra_table_throughput_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -543,7 +543,7 @@ def build_update_cassandra_table_throughput_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -588,7 +588,7 @@ def build_migrate_cassandra_table_to_autoscale_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -630,7 +630,7 @@ def build_migrate_cassandra_table_to_manual_throughput_request( # pylint: disab
_headers = case_insensitive_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-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -721,7 +721,6 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -737,7 +736,6 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_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 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -821,7 +818,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("CassandraKeyspaceGetResults", pipeline_response)
deserialized = self._deserialize("CassandraKeyspaceGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -835,7 +832,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
keyspace_name: str,
create_update_cassandra_keyspace_parameters: Union[_models.CassandraKeyspaceCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Optional[_models.CassandraKeyspaceGetResults]:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -849,7 +846,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
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.CassandraKeyspaceGetResults]] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -873,10 +870,10 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_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,20 +881,22 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (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("CassandraKeyspaceGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -1018,10 +1017,11 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("CassandraKeyspaceGetResults", pipeline_response)
deserialized = self._deserialize("CassandraKeyspaceGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -1043,9 +1043,9 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _delete_cassandra_keyspace_initial( # pylint: disable=inconsistent-return-statements
def _delete_cassandra_keyspace_initial(
self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any
) -> None:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1058,7 +1058,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
_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_cassandra_keyspace_request(
resource_group_name=resource_group_name,
@ -1069,10 +1069,10 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1080,6 +1080,10 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
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)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@ -1090,8 +1094,12 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
)
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_cassandra_keyspace(
@ -1119,7 +1127,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
lro_delay = kwargs.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_cassandra_keyspace_initial( # type: ignore
raw_result = self._delete_cassandra_keyspace_initial(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
@ -1129,6 +1137,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -1191,7 +1200,6 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -1205,7 +1213,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -1219,7 +1227,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
keyspace_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Optional[_models.ThroughputSettingsGetResults]:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1233,7 +1241,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
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.ThroughputSettingsGetResults]] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -1255,10 +1263,10 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1266,20 +1274,22 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (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("ThroughputSettingsGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -1400,10 +1410,11 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -1427,7 +1438,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
def _migrate_cassandra_keyspace_to_autoscale_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any
) -> Optional[_models.ThroughputSettingsGetResults]:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1440,7 +1451,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
_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.ThroughputSettingsGetResults]] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_cassandra_keyspace_to_autoscale_request(
resource_group_name=resource_group_name,
@ -1451,10 +1462,10 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1462,20 +1473,22 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (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("ThroughputSettingsGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -1518,10 +1531,11 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -1545,7 +1559,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
def _migrate_cassandra_keyspace_to_manual_throughput_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any
) -> Optional[_models.ThroughputSettingsGetResults]:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1558,7 +1572,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
_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.ThroughputSettingsGetResults]] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_cassandra_keyspace_to_manual_throughput_request(
resource_group_name=resource_group_name,
@ -1569,10 +1583,10 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1580,20 +1594,22 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (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("ThroughputSettingsGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -1636,10 +1652,11 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -1705,7 +1722,6 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -1721,7 +1737,6 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@ -1793,7 +1808,6 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -1807,7 +1821,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("CassandraTableGetResults", pipeline_response)
deserialized = self._deserialize("CassandraTableGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -1822,7 +1836,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
table_name: str,
create_update_cassandra_table_parameters: Union[_models.CassandraTableCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Optional[_models.CassandraTableGetResults]:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1836,7 +1850,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
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.CassandraTableGetResults]] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -1861,10 +1875,10 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1872,20 +1886,22 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (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("CassandraTableGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -2016,10 +2032,11 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("CassandraTableGetResults", pipeline_response)
deserialized = self._deserialize("CassandraTableGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -2041,9 +2058,9 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _delete_cassandra_table_initial( # pylint: disable=inconsistent-return-statements
def _delete_cassandra_table_initial(
self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any
) -> None:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -2056,7 +2073,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
_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_cassandra_table_request(
resource_group_name=resource_group_name,
@ -2068,10 +2085,10 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -2079,6 +2096,10 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
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)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@ -2089,8 +2110,12 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
)
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_cassandra_table(
@ -2120,7 +2145,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
lro_delay = kwargs.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_cassandra_table_initial( # type: ignore
raw_result = self._delete_cassandra_table_initial(
resource_group_name=resource_group_name,
account_name=account_name,
keyspace_name=keyspace_name,
@ -2131,6 +2156,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -2196,7 +2222,6 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -2210,7 +2235,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -2225,7 +2250,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
table_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Optional[_models.ThroughputSettingsGetResults]:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -2239,7 +2264,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
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.ThroughputSettingsGetResults]] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -2262,10 +2287,10 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -2273,20 +2298,22 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (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("ThroughputSettingsGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -2417,10 +2444,11 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -2444,7 +2472,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
def _migrate_cassandra_table_to_autoscale_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any
) -> Optional[_models.ThroughputSettingsGetResults]:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -2457,7 +2485,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
_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.ThroughputSettingsGetResults]] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_cassandra_table_to_autoscale_request(
resource_group_name=resource_group_name,
@ -2469,10 +2497,10 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -2480,20 +2508,22 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (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("ThroughputSettingsGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -2539,10 +2569,11 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -2566,7 +2597,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
def _migrate_cassandra_table_to_manual_throughput_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any
) -> Optional[_models.ThroughputSettingsGetResults]:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -2579,7 +2610,7 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
_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.ThroughputSettingsGetResults]] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_cassandra_table_to_manual_throughput_request(
resource_group_name=resource_group_name,
@ -2591,10 +2622,10 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -2602,20 +2633,22 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (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("ThroughputSettingsGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -2661,10 +2694,11 @@ class CassandraResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized

Просмотреть файл

@ -20,15 +20,13 @@ from azure.core.exceptions import (
)
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
@ -54,7 +52,7 @@ def build_list_metrics_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -99,7 +97,7 @@ def build_list_usages_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -143,7 +141,7 @@ def build_list_metric_definitions_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -251,7 +249,6 @@ class CollectionOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -267,7 +264,6 @@ class CollectionOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@ -353,7 +349,6 @@ class CollectionOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -369,7 +364,6 @@ class CollectionOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_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 +438,6 @@ class CollectionOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -460,7 +453,6 @@ class CollectionOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,15 +20,13 @@ from azure.core.exceptions import (
)
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
@ -54,7 +52,7 @@ def build_list_metrics_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -99,7 +97,7 @@ def build_list_usages_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -209,7 +207,6 @@ class CollectionPartitionOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -225,7 +222,6 @@ class CollectionPartitionOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_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 +307,6 @@ class CollectionPartitionOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -327,7 +322,6 @@ class CollectionPartitionOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,15 +20,13 @@ from azure.core.exceptions import (
)
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
@ -55,7 +53,7 @@ def build_list_metrics_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -169,7 +167,6 @@ class CollectionPartitionRegionOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -185,7 +182,6 @@ class CollectionPartitionRegionOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,15 +20,13 @@ from azure.core.exceptions import (
)
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
@ -55,7 +53,7 @@ def build_list_metrics_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -169,7 +167,6 @@ class CollectionRegionOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -185,7 +182,6 @@ class CollectionRegionOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,15 +20,13 @@ from azure.core.exceptions import (
)
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
@ -47,7 +45,7 @@ def build_list_metrics_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -145,7 +143,6 @@ class DatabaseAccountRegionOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -161,7 +158,6 @@ class DatabaseAccountRegionOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -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 @@ from azure.core.exceptions import (
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 azure.mgmt.core.polling.arm_polling import ARMPolling
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_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
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_delete_request(
) -> HttpRequest:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
# Construct URL
_url = kwargs.pop(
"template_url",
@ -188,7 +188,7 @@ def build_failover_priority_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
# Construct URL
_url = kwargs.pop(
@ -221,7 +221,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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -245,7 +245,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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -277,7 +277,7 @@ def build_list_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -312,7 +312,7 @@ def build_list_connection_strings_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -347,7 +347,7 @@ def build_offline_region_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -385,7 +385,7 @@ def build_online_region_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -423,7 +423,7 @@ def build_get_read_only_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -458,7 +458,7 @@ def build_list_read_only_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -493,7 +493,7 @@ def build_regenerate_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
# Construct URL
_url = kwargs.pop(
@ -525,7 +525,7 @@ def build_regenerate_key_request(
def build_check_name_exists_request(account_name: str, **kwargs: Any) -> HttpRequest:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
# Construct URL
_url = kwargs.pop("template_url", "/providers/Microsoft.DocumentDB/databaseAccountNames/{accountName}")
path_format_arguments = {
@ -548,7 +548,7 @@ def build_list_metrics_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -584,7 +584,7 @@ def build_list_usages_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -621,7 +621,7 @@ def build_list_metric_definitions_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -704,7 +704,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -718,7 +717,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("DatabaseAccountGetResults", pipeline_response)
deserialized = self._deserialize("DatabaseAccountGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -731,7 +730,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
account_name: str,
update_parameters: Union[_models.DatabaseAccountUpdateParameters, IO[bytes]],
**kwargs: Any
) -> _models.DatabaseAccountGetResults:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -745,7 +744,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
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.DatabaseAccountGetResults] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -766,10 +765,10 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -777,10 +776,14 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
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("DatabaseAccountGetResults", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -888,10 +891,11 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("DatabaseAccountGetResults", pipeline_response)
deserialized = self._deserialize("DatabaseAccountGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -919,7 +923,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
account_name: str,
create_update_parameters: Union[_models.DatabaseAccountCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> _models.DatabaseAccountGetResults:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -933,7 +937,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
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.DatabaseAccountGetResults] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -954,10 +958,10 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -965,10 +969,14 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
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("DatabaseAccountGetResults", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -1082,10 +1090,11 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("DatabaseAccountGetResults", pipeline_response)
deserialized = self._deserialize("DatabaseAccountGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -1107,9 +1116,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
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,
@ -1122,7 +1129,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
_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,
@ -1132,10 +1139,10 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1143,6 +1150,10 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
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)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@ -1153,8 +1164,12 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
)
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, account_name: str, **kwargs: Any) -> LROPoller[None]:
@ -1178,7 +1193,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
lro_delay = kwargs.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,
@ -1187,6 +1202,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -1208,13 +1224,13 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
)
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
def _failover_priority_change_initial( # pylint: disable=inconsistent-return-statements
def _failover_priority_change_initial(
self,
resource_group_name: str,
account_name: str,
failover_parameters: Union[_models.FailoverPolicies, IO[bytes]],
**kwargs: Any
) -> None:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1228,7 +1244,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
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
@ -1249,10 +1265,10 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1260,6 +1276,10 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
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)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@ -1270,8 +1290,12 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
)
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_failover_priority_change(
@ -1368,7 +1392,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
lro_delay = kwargs.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_priority_change_initial( # type: ignore
raw_result = self._failover_priority_change_initial(
resource_group_name=resource_group_name,
account_name=account_name,
failover_parameters=failover_parameters,
@ -1379,6 +1403,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -1432,7 +1457,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -1448,7 +1472,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_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 +1538,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -1531,7 +1553,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@ -1597,7 +1618,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -1611,7 +1631,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("DatabaseAccountListKeysResult", pipeline_response)
deserialized = self._deserialize("DatabaseAccountListKeysResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -1655,7 +1675,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -1669,20 +1688,20 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("DatabaseAccountListConnectionStringsResult", pipeline_response)
deserialized = self._deserialize("DatabaseAccountListConnectionStringsResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _offline_region_initial( # pylint: disable=inconsistent-return-statements
def _offline_region_initial(
self,
resource_group_name: str,
account_name: str,
region_parameter_for_offline: Union[_models.RegionForOnlineOffline, IO[bytes]],
**kwargs: Any
) -> None:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1696,7 +1715,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
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
@ -1717,10 +1736,10 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1728,6 +1747,10 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the 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)
@ -1739,8 +1762,12 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
)
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_offline_region(
@ -1831,7 +1858,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._offline_region_initial( # type: ignore
raw_result = self._offline_region_initial(
resource_group_name=resource_group_name,
account_name=account_name,
region_parameter_for_offline=region_parameter_for_offline,
@ -1842,6 +1869,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -1863,13 +1891,13 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
)
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
def _online_region_initial( # pylint: disable=inconsistent-return-statements
def _online_region_initial(
self,
resource_group_name: str,
account_name: str,
region_parameter_for_online: Union[_models.RegionForOnlineOffline, IO[bytes]],
**kwargs: Any
) -> None:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1883,7 +1911,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
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
@ -1904,10 +1932,10 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1915,6 +1943,10 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the 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)
@ -1926,8 +1958,12 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
)
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_online_region(
@ -2018,7 +2054,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._online_region_initial( # type: ignore
raw_result = self._online_region_initial(
resource_group_name=resource_group_name,
account_name=account_name,
region_parameter_for_online=region_parameter_for_online,
@ -2029,6 +2065,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -2087,7 +2124,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -2101,7 +2137,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("DatabaseAccountListReadOnlyKeysResult", pipeline_response)
deserialized = self._deserialize("DatabaseAccountListReadOnlyKeysResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -2145,7 +2181,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -2159,20 +2194,20 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("DatabaseAccountListReadOnlyKeysResult", pipeline_response)
deserialized = self._deserialize("DatabaseAccountListReadOnlyKeysResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _regenerate_key_initial( # pylint: disable=inconsistent-return-statements
def _regenerate_key_initial(
self,
resource_group_name: str,
account_name: str,
key_to_regenerate: Union[_models.DatabaseAccountRegenerateKeyParameters, IO[bytes]],
**kwargs: Any
) -> None:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -2186,7 +2221,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
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
@ -2207,10 +2242,10 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -2218,6 +2253,10 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@ -2228,8 +2267,12 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
)
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_regenerate_key(
@ -2318,7 +2361,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._regenerate_key_initial( # type: ignore
raw_result = self._regenerate_key_initial(
resource_group_name=resource_group_name,
account_name=account_name,
key_to_regenerate=key_to_regenerate,
@ -2329,6 +2372,7 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -2382,7 +2426,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -2445,7 +2488,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -2461,7 +2503,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@ -2535,7 +2576,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -2551,7 +2591,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@ -2620,7 +2659,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -2636,7 +2674,6 @@ class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,15 +20,13 @@ from azure.core.exceptions import (
)
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
@ -47,7 +45,7 @@ def build_list_metrics_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -90,7 +88,7 @@ def build_list_usages_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -128,7 +126,7 @@ def build_list_metric_definitions_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -226,7 +224,6 @@ class DatabaseOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -242,7 +239,6 @@ class DatabaseOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_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 +320,6 @@ class DatabaseOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -340,7 +335,6 @@ class DatabaseOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_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 +406,6 @@ class DatabaseOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -428,7 +421,6 @@ class DatabaseOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -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 @@ from azure.core.exceptions import (
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 azure.mgmt.core.polling.arm_polling import ARMPolling
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_gremlin_databases_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -85,7 +85,7 @@ def build_get_gremlin_database_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -121,7 +121,7 @@ def build_create_update_gremlin_database_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -159,7 +159,7 @@ def build_delete_gremlin_database_request(
) -> HttpRequest:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
# Construct URL
_url = kwargs.pop(
"template_url",
@ -190,7 +190,7 @@ def build_get_gremlin_database_throughput_request( # pylint: disable=name-too-l
_headers = case_insensitive_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-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -226,7 +226,7 @@ def build_update_gremlin_database_throughput_request( # pylint: disable=name-to
_headers = case_insensitive_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-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -265,7 +265,7 @@ def build_migrate_gremlin_database_to_autoscale_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -301,7 +301,7 @@ def build_migrate_gremlin_database_to_manual_throughput_request( # pylint: disa
_headers = case_insensitive_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-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -337,7 +337,7 @@ def build_list_gremlin_graphs_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -378,7 +378,7 @@ def build_get_gremlin_graph_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -420,7 +420,7 @@ def build_create_update_gremlin_graph_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -464,7 +464,7 @@ def build_delete_gremlin_graph_request(
) -> HttpRequest:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
# Construct URL
_url = kwargs.pop(
"template_url",
@ -501,7 +501,7 @@ def build_get_gremlin_graph_throughput_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -543,7 +543,7 @@ def build_update_gremlin_graph_throughput_request( # pylint: disable=name-too-l
_headers = case_insensitive_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-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -588,7 +588,7 @@ def build_migrate_gremlin_graph_to_autoscale_request( # pylint: disable=name-to
_headers = case_insensitive_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-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -630,7 +630,7 @@ def build_migrate_gremlin_graph_to_manual_throughput_request( # pylint: disable
_headers = case_insensitive_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-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -672,7 +672,7 @@ def build_retrieve_continuous_backup_information_request( # pylint: disable=nam
_headers = case_insensitive_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-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -766,7 +766,6 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -782,7 +781,6 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@ -852,7 +850,6 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -866,7 +863,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("GremlinDatabaseGetResults", pipeline_response)
deserialized = self._deserialize("GremlinDatabaseGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -880,7 +877,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
database_name: str,
create_update_gremlin_database_parameters: Union[_models.GremlinDatabaseCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Optional[_models.GremlinDatabaseGetResults]:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -894,7 +891,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
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.GremlinDatabaseGetResults]] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -918,10 +915,10 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -929,20 +926,22 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (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("GremlinDatabaseGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -1063,10 +1062,11 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("GremlinDatabaseGetResults", pipeline_response)
deserialized = self._deserialize("GremlinDatabaseGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -1088,9 +1088,9 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _delete_gremlin_database_initial( # pylint: disable=inconsistent-return-statements
def _delete_gremlin_database_initial(
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> None:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1103,7 +1103,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
_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_gremlin_database_request(
resource_group_name=resource_group_name,
@ -1114,10 +1114,10 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1125,6 +1125,10 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
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)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@ -1135,8 +1139,12 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
)
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_gremlin_database(
@ -1164,7 +1172,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
lro_delay = kwargs.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_gremlin_database_initial( # type: ignore
raw_result = self._delete_gremlin_database_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
@ -1174,6 +1182,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -1236,7 +1245,6 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -1250,7 +1258,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -1264,7 +1272,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
database_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Optional[_models.ThroughputSettingsGetResults]:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1278,7 +1286,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
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.ThroughputSettingsGetResults]] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -1300,10 +1308,10 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1311,20 +1319,22 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (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("ThroughputSettingsGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -1445,10 +1455,11 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -1472,7 +1483,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
def _migrate_gremlin_database_to_autoscale_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> Optional[_models.ThroughputSettingsGetResults]:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1485,7 +1496,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
_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.ThroughputSettingsGetResults]] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_gremlin_database_to_autoscale_request(
resource_group_name=resource_group_name,
@ -1496,10 +1507,10 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1507,20 +1518,22 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (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("ThroughputSettingsGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -1563,10 +1576,11 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -1590,7 +1604,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
def _migrate_gremlin_database_to_manual_throughput_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any
) -> Optional[_models.ThroughputSettingsGetResults]:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1603,7 +1617,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
_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.ThroughputSettingsGetResults]] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_gremlin_database_to_manual_throughput_request(
resource_group_name=resource_group_name,
@ -1614,10 +1628,10 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1625,20 +1639,22 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (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("ThroughputSettingsGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -1681,10 +1697,11 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -1750,7 +1767,6 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -1766,7 +1782,6 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@ -1838,7 +1853,6 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -1852,7 +1866,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("GremlinGraphGetResults", pipeline_response)
deserialized = self._deserialize("GremlinGraphGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -1867,7 +1881,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
graph_name: str,
create_update_gremlin_graph_parameters: Union[_models.GremlinGraphCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Optional[_models.GremlinGraphGetResults]:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1881,7 +1895,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
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.GremlinGraphGetResults]] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -1904,10 +1918,10 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1915,20 +1929,22 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (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("GremlinGraphGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -2059,10 +2075,11 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("GremlinGraphGetResults", pipeline_response)
deserialized = self._deserialize("GremlinGraphGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -2084,9 +2101,9 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _delete_gremlin_graph_initial( # pylint: disable=inconsistent-return-statements
def _delete_gremlin_graph_initial(
self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any
) -> None:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -2099,7 +2116,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
_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_gremlin_graph_request(
resource_group_name=resource_group_name,
@ -2111,10 +2128,10 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -2122,6 +2139,10 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
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)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@ -2132,8 +2153,12 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
)
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_gremlin_graph(
@ -2163,7 +2188,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
lro_delay = kwargs.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_gremlin_graph_initial( # type: ignore
raw_result = self._delete_gremlin_graph_initial(
resource_group_name=resource_group_name,
account_name=account_name,
database_name=database_name,
@ -2174,6 +2199,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -2239,7 +2265,6 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -2253,7 +2278,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -2268,7 +2293,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
graph_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Optional[_models.ThroughputSettingsGetResults]:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -2282,7 +2307,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
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.ThroughputSettingsGetResults]] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -2305,10 +2330,10 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -2316,20 +2341,22 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (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("ThroughputSettingsGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -2460,10 +2487,11 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -2487,7 +2515,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
def _migrate_gremlin_graph_to_autoscale_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any
) -> Optional[_models.ThroughputSettingsGetResults]:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -2500,7 +2528,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
_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.ThroughputSettingsGetResults]] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_gremlin_graph_to_autoscale_request(
resource_group_name=resource_group_name,
@ -2512,10 +2540,10 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -2523,20 +2551,22 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (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("ThroughputSettingsGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -2582,10 +2612,11 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -2609,7 +2640,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
def _migrate_gremlin_graph_to_manual_throughput_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any
) -> Optional[_models.ThroughputSettingsGetResults]:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -2622,7 +2653,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
_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.ThroughputSettingsGetResults]] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_gremlin_graph_to_manual_throughput_request(
resource_group_name=resource_group_name,
@ -2634,10 +2665,10 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -2645,20 +2676,22 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (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("ThroughputSettingsGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -2704,10 +2737,11 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -2737,7 +2771,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
graph_name: str,
location: Union[_models.ContinuousBackupRestoreLocation, IO[bytes]],
**kwargs: Any
) -> Optional[_models.BackupInformation]:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -2751,7 +2785,7 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
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.BackupInformation]] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -2774,10 +2808,10 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -2785,12 +2819,14 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (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("BackupInformation", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -2917,10 +2953,11 @@ class GremlinResourcesOperations: # pylint: disable=too-many-public-methods
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("BackupInformation", pipeline_response)
deserialized = self._deserialize("BackupInformation", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized

Просмотреть файл

@ -20,15 +20,13 @@ from azure.core.exceptions import (
)
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(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-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -69,7 +67,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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -142,7 +140,6 @@ class LocationsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -158,7 +155,6 @@ class LocationsOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@ -219,7 +215,6 @@ class LocationsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -233,7 +228,7 @@ class LocationsOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("LocationGetResult", pipeline_response)
deserialized = self._deserialize("LocationGetResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -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 @@ from azure.core.exceptions import (
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 azure.mgmt.core.polling.arm_polling import ARMPolling
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_database_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -89,7 +89,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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -172,7 +172,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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -212,7 +212,7 @@ def build_list_connection_info_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -252,7 +252,7 @@ def build_regenerate_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -292,7 +292,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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -381,7 +381,6 @@ class NotebookWorkspacesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -397,7 +396,6 @@ class NotebookWorkspacesOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_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 +470,6 @@ class NotebookWorkspacesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -487,7 +484,7 @@ class NotebookWorkspacesOperations:
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("NotebookWorkspace", pipeline_response)
deserialized = self._deserialize("NotebookWorkspace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -501,7 +498,7 @@ class NotebookWorkspacesOperations:
notebook_workspace_name: Union[str, _models.NotebookWorkspaceName],
notebook_create_update_parameters: Union[_models.NotebookWorkspaceCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> _models.NotebookWorkspace:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -515,7 +512,7 @@ class NotebookWorkspacesOperations:
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.NotebookWorkspace] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -537,10 +534,10 @@ class NotebookWorkspacesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -548,11 +545,15 @@ class NotebookWorkspacesOperations:
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("NotebookWorkspace", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -677,10 +678,11 @@ class NotebookWorkspacesOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("NotebookWorkspace", pipeline_response)
deserialized = self._deserialize("NotebookWorkspace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -702,13 +704,13 @@ class NotebookWorkspacesOperations:
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,
notebook_workspace_name: Union[str, _models.NotebookWorkspaceName],
**kwargs: Any
) -> None:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -721,7 +723,7 @@ class NotebookWorkspacesOperations:
_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,
@ -732,10 +734,10 @@ class NotebookWorkspacesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -743,12 +745,20 @@ class NotebookWorkspacesOperations:
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(
@ -781,7 +791,7 @@ class NotebookWorkspacesOperations:
lro_delay = kwargs.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,
notebook_workspace_name=notebook_workspace_name,
@ -791,6 +801,7 @@ class NotebookWorkspacesOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -857,7 +868,6 @@ class NotebookWorkspacesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -872,20 +882,20 @@ class NotebookWorkspacesOperations:
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("NotebookWorkspaceConnectionInfoResult", pipeline_response)
deserialized = self._deserialize("NotebookWorkspaceConnectionInfoResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _regenerate_auth_token_initial( # pylint: disable=inconsistent-return-statements
def _regenerate_auth_token_initial(
self,
resource_group_name: str,
account_name: str,
notebook_workspace_name: Union[str, _models.NotebookWorkspaceName],
**kwargs: Any
) -> None:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -898,7 +908,7 @@ class NotebookWorkspacesOperations:
_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_regenerate_auth_token_request(
resource_group_name=resource_group_name,
@ -909,10 +919,10 @@ class NotebookWorkspacesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -920,12 +930,20 @@ class NotebookWorkspacesOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the 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_regenerate_auth_token(
@ -958,7 +976,7 @@ class NotebookWorkspacesOperations:
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._regenerate_auth_token_initial( # type: ignore
raw_result = self._regenerate_auth_token_initial(
resource_group_name=resource_group_name,
account_name=account_name,
notebook_workspace_name=notebook_workspace_name,
@ -968,6 +986,7 @@ class NotebookWorkspacesOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -989,13 +1008,13 @@ class NotebookWorkspacesOperations:
)
return LROPoller[None](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,
account_name: str,
notebook_workspace_name: Union[str, _models.NotebookWorkspaceName],
**kwargs: Any
) -> None:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1008,7 +1027,7 @@ class NotebookWorkspacesOperations:
_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,
@ -1019,10 +1038,10 @@ class NotebookWorkspacesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1030,12 +1049,20 @@ class NotebookWorkspacesOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the 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_start(
@ -1068,7 +1095,7 @@ class NotebookWorkspacesOperations:
lro_delay = kwargs.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,
account_name=account_name,
notebook_workspace_name=notebook_workspace_name,
@ -1078,6 +1105,7 @@ class NotebookWorkspacesOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements

Просмотреть файл

@ -20,15 +20,13 @@ from azure.core.exceptions import (
)
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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -109,7 +107,6 @@ class Operations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -125,7 +122,6 @@ class Operations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,15 +20,13 @@ from azure.core.exceptions import (
)
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
@ -55,7 +53,7 @@ def build_list_metrics_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -168,7 +166,6 @@ class PartitionKeyRangeIdOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -184,7 +181,6 @@ class PartitionKeyRangeIdOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,15 +20,13 @@ from azure.core.exceptions import (
)
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
@ -56,7 +54,7 @@ def build_list_metrics_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -175,7 +173,6 @@ class PartitionKeyRangeIdRegionOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -191,7 +188,6 @@ class PartitionKeyRangeIdRegionOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,15 +20,13 @@ from azure.core.exceptions import (
)
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
@ -47,7 +45,7 @@ def build_list_metrics_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -142,7 +140,6 @@ class PercentileOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -158,7 +155,6 @@ class PercentileOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,15 +20,13 @@ from azure.core.exceptions import (
)
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
@ -54,7 +52,7 @@ def build_list_metrics_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -165,7 +163,6 @@ class PercentileSourceTargetOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -181,7 +178,6 @@ class PercentileSourceTargetOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,15 +20,13 @@ from azure.core.exceptions import (
)
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
@ -47,7 +45,7 @@ def build_list_metrics_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -147,7 +145,6 @@ class PercentileTargetOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -163,7 +160,6 @@ class PercentileTargetOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -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 @@ from azure.core.exceptions import (
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 azure.mgmt.core.polling.arm_polling import ARMPolling
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_database_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -89,7 +89,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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -131,7 +131,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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -176,7 +176,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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -268,7 +268,6 @@ class PrivateEndpointConnectionsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -284,7 +283,6 @@ class PrivateEndpointConnectionsOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@ -353,7 +351,6 @@ class PrivateEndpointConnectionsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -367,7 +364,7 @@ class PrivateEndpointConnectionsOperations:
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
@ -381,7 +378,7 @@ class PrivateEndpointConnectionsOperations:
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,
@ -395,7 +392,7 @@ class PrivateEndpointConnectionsOperations:
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
@ -417,10 +414,10 @@ class PrivateEndpointConnectionsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -428,13 +425,15 @@ class PrivateEndpointConnectionsOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the 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)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response)
raise HttpResponseError(response=response, model=error, 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
@ -550,10 +549,11 @@ class PrivateEndpointConnectionsOperations:
params=_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
@ -575,9 +575,9 @@ class PrivateEndpointConnectionsOperations:
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, private_endpoint_connection_name: str, **kwargs: Any
) -> None:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -590,7 +590,7 @@ class PrivateEndpointConnectionsOperations:
_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,
@ -601,10 +601,10 @@ class PrivateEndpointConnectionsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -612,12 +612,20 @@ class PrivateEndpointConnectionsOperations:
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)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = response.stream_download(self._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(
@ -645,7 +653,7 @@ class PrivateEndpointConnectionsOperations:
lro_delay = kwargs.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,
private_endpoint_connection_name=private_endpoint_connection_name,
@ -655,6 +663,7 @@ class PrivateEndpointConnectionsOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements

Просмотреть файл

@ -20,15 +20,13 @@ from azure.core.exceptions import (
)
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
@ -47,7 +45,7 @@ def build_list_by_database_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -82,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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -171,7 +169,6 @@ class PrivateLinkResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -187,7 +184,6 @@ class PrivateLinkResourcesOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@ -256,7 +252,6 @@ class PrivateLinkResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -270,7 +265,7 @@ class PrivateLinkResourcesOperations:
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

Просмотреть файл

@ -20,15 +20,13 @@ from azure.core.exceptions import (
)
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_by_location_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -73,7 +71,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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -99,7 +97,7 @@ def build_get_by_location_request(location: str, instance_id: 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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -182,7 +180,6 @@ class RestorableDatabaseAccountsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -198,7 +195,6 @@ class RestorableDatabaseAccountsOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@ -261,7 +257,6 @@ class RestorableDatabaseAccountsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -277,7 +272,6 @@ class RestorableDatabaseAccountsOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@ -344,7 +338,6 @@ class RestorableDatabaseAccountsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -358,7 +351,7 @@ class RestorableDatabaseAccountsOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("RestorableDatabaseAccountGetResult", pipeline_response)
deserialized = self._deserialize("RestorableDatabaseAccountGetResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore

Просмотреть файл

@ -20,15 +20,13 @@ from azure.core.exceptions import (
)
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, instance_id: 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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -134,7 +132,6 @@ class RestorableGremlinDatabasesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -150,7 +147,6 @@ class RestorableGremlinDatabasesOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,15 +20,13 @@ from azure.core.exceptions import (
)
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
@ -54,7 +52,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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -166,7 +164,6 @@ class RestorableGremlinGraphsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -182,7 +179,6 @@ class RestorableGremlinGraphsOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,15 +20,13 @@ from azure.core.exceptions import (
)
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
@ -53,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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -161,7 +159,6 @@ class RestorableGremlinResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -177,7 +174,6 @@ class RestorableGremlinResourcesOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,15 +20,13 @@ from azure.core.exceptions import (
)
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
@ -54,7 +52,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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -166,7 +164,6 @@ class RestorableMongodbCollectionsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -182,7 +179,6 @@ class RestorableMongodbCollectionsOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,15 +20,13 @@ from azure.core.exceptions import (
)
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, instance_id: 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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -134,7 +132,6 @@ class RestorableMongodbDatabasesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -150,7 +147,6 @@ class RestorableMongodbDatabasesOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,15 +20,13 @@ from azure.core.exceptions import (
)
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
@ -53,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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -161,7 +159,6 @@ class RestorableMongodbResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -177,7 +174,6 @@ class RestorableMongodbResourcesOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,15 +20,13 @@ from azure.core.exceptions import (
)
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
@ -54,7 +52,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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -165,7 +163,6 @@ class RestorableSqlContainersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -181,7 +178,6 @@ class RestorableSqlContainersOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,15 +20,13 @@ from azure.core.exceptions import (
)
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, instance_id: 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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -134,7 +132,6 @@ class RestorableSqlDatabasesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -150,7 +147,6 @@ class RestorableSqlDatabasesOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,15 +20,13 @@ from azure.core.exceptions import (
)
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
@ -53,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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -161,7 +159,6 @@ class RestorableSqlResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -177,7 +174,6 @@ class RestorableSqlResourcesOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,15 +20,13 @@ from azure.core.exceptions import (
)
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
@ -53,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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -160,7 +158,6 @@ class RestorableTableResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -176,7 +173,6 @@ class RestorableTableResourcesOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -20,15 +20,13 @@ from azure.core.exceptions import (
)
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
@ -53,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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -155,7 +153,6 @@ class RestorableTablesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -171,7 +168,6 @@ class RestorableTablesOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

Просмотреть файл

@ -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 @@ from azure.core.exceptions import (
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 azure.mgmt.core.polling.arm_polling import ARMPolling
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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -83,7 +83,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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -122,7 +122,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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -158,7 +158,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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -245,7 +245,6 @@ class ServiceOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -261,7 +260,6 @@ class ServiceOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_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 +295,7 @@ class ServiceOperations:
service_name: str,
create_update_parameters: Union[_models.ServiceResourceCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Optional[_models.ServiceResource]:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -311,7 +309,7 @@ class ServiceOperations:
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.ServiceResource]] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -333,10 +331,10 @@ class ServiceOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -344,20 +342,22 @@ class ServiceOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (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("ServiceResource", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -475,10 +475,11 @@ class ServiceOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ServiceResource", pipeline_response)
deserialized = self._deserialize("ServiceResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -540,7 +541,6 @@ class ServiceOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -554,16 +554,16 @@ class ServiceOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ServiceResource", pipeline_response)
deserialized = self._deserialize("ServiceResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _delete_initial( # pylint: disable=inconsistent-return-statements
def _delete_initial(
self, resource_group_name: str, account_name: str, service_name: str, **kwargs: Any
) -> None:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -576,7 +576,7 @@ class ServiceOperations:
_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,
@ -587,10 +587,10 @@ class ServiceOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -598,6 +598,10 @@ class ServiceOperations:
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)
@ -608,8 +612,12 @@ class ServiceOperations:
)
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(
@ -637,7 +645,7 @@ class ServiceOperations:
lro_delay = kwargs.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,
service_name=service_name,
@ -647,6 +655,7 @@ class ServiceOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -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 @@ from azure.core.exceptions import (
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 azure.mgmt.core.polling.arm_polling import ARMPolling
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_tables_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -85,7 +85,7 @@ def build_get_table_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -121,7 +121,7 @@ def build_create_update_table_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -159,7 +159,7 @@ def build_delete_table_request(
) -> HttpRequest:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
# Construct URL
_url = kwargs.pop(
"template_url",
@ -190,7 +190,7 @@ def build_get_table_throughput_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -226,7 +226,7 @@ def build_update_table_throughput_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -265,7 +265,7 @@ def build_migrate_table_to_autoscale_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", "2024-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -301,7 +301,7 @@ def build_migrate_table_to_manual_throughput_request( # pylint: disable=name-to
_headers = case_insensitive_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-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -337,7 +337,7 @@ def build_retrieve_continuous_backup_information_request( # pylint: disable=nam
_headers = case_insensitive_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-05-15"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-15"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -429,7 +429,6 @@ class TableResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -445,7 +444,6 @@ class TableResourcesOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@ -514,7 +512,6 @@ class TableResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -528,7 +525,7 @@ class TableResourcesOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("TableGetResults", pipeline_response)
deserialized = self._deserialize("TableGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -542,7 +539,7 @@ class TableResourcesOperations:
table_name: str,
create_update_table_parameters: Union[_models.TableCreateUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Optional[_models.TableGetResults]:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -556,7 +553,7 @@ class TableResourcesOperations:
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.TableGetResults]] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -578,10 +575,10 @@ class TableResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_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,20 +586,22 @@ class TableResourcesOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (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("TableGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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 +720,11 @@ class TableResourcesOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("TableGetResults", pipeline_response)
deserialized = self._deserialize("TableGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -746,9 +746,9 @@ class TableResourcesOperations:
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _delete_table_initial( # pylint: disable=inconsistent-return-statements
def _delete_table_initial(
self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any
) -> None:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -761,7 +761,7 @@ class TableResourcesOperations:
_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_table_request(
resource_group_name=resource_group_name,
@ -772,10 +772,10 @@ class TableResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_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,6 +783,10 @@ class TableResourcesOperations:
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)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@ -793,8 +797,12 @@ class TableResourcesOperations:
)
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_table(
@ -822,7 +830,7 @@ class TableResourcesOperations:
lro_delay = kwargs.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_table_initial( # type: ignore
raw_result = self._delete_table_initial(
resource_group_name=resource_group_name,
account_name=account_name,
table_name=table_name,
@ -832,6 +840,7 @@ class TableResourcesOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -894,7 +903,6 @@ class TableResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -908,7 +916,7 @@ class TableResourcesOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -922,7 +930,7 @@ class TableResourcesOperations:
table_name: str,
update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Optional[_models.ThroughputSettingsGetResults]:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -936,7 +944,7 @@ class TableResourcesOperations:
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.ThroughputSettingsGetResults]] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -958,10 +966,10 @@ class TableResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -969,20 +977,22 @@ class TableResourcesOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (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("ThroughputSettingsGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -1103,10 +1113,11 @@ class TableResourcesOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -1130,7 +1141,7 @@ class TableResourcesOperations:
def _migrate_table_to_autoscale_initial(
self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any
) -> Optional[_models.ThroughputSettingsGetResults]:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1143,7 +1154,7 @@ class TableResourcesOperations:
_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.ThroughputSettingsGetResults]] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_table_to_autoscale_request(
resource_group_name=resource_group_name,
@ -1154,10 +1165,10 @@ class TableResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1165,20 +1176,22 @@ class TableResourcesOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (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("ThroughputSettingsGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -1221,10 +1234,11 @@ class TableResourcesOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -1248,7 +1262,7 @@ class TableResourcesOperations:
def _migrate_table_to_manual_throughput_initial( # pylint: disable=name-too-long
self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any
) -> Optional[_models.ThroughputSettingsGetResults]:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1261,7 +1275,7 @@ class TableResourcesOperations:
_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.ThroughputSettingsGetResults]] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_migrate_table_to_manual_throughput_request(
resource_group_name=resource_group_name,
@ -1272,10 +1286,10 @@ class TableResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1283,20 +1297,22 @@ class TableResourcesOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (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("ThroughputSettingsGetResults", pipeline_response)
if response.status_code == 202:
response_headers["azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("azure-AsyncOperation")
)
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
@ -1339,10 +1355,11 @@ class TableResourcesOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response)
deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -1371,7 +1388,7 @@ class TableResourcesOperations:
table_name: str,
location: Union[_models.ContinuousBackupRestoreLocation, IO[bytes]],
**kwargs: Any
) -> Optional[_models.BackupInformation]:
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@ -1385,7 +1402,7 @@ class TableResourcesOperations:
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.BackupInformation]] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -1407,10 +1424,10 @@ class TableResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1418,12 +1435,14 @@ class TableResourcesOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (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("BackupInformation", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -1540,10 +1559,11 @@ class TableResourcesOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("BackupInformation", pipeline_response)
deserialized = self._deserialize("BackupInformation", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized

Просмотреть файл

@ -1 +1,2 @@
-e ../../../tools/azure-sdk-tools
-e ../../../tools/azure-sdk-tools
aiohttp

Просмотреть файл

@ -6,8 +6,6 @@
# 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.cosmosdb import CosmosDBManagementClient
@ -45,6 +43,6 @@ def main():
print(response)
# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBCassandraKeyspaceCreateUpdate.json
# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-08-15/examples/CosmosDBCassandraKeyspaceCreateUpdate.json
if __name__ == "__main__":
main()

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше