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

[AutoRelease] t2-redisenterprise-2024-09-14-05961(can only be merged by SDK owner) (#37401)

* code and test

* update-testcase

* update-testcase

* Update CHANGELOG.md

---------

Co-authored-by: azure-sdk <PythonSdkPipelines>
Co-authored-by: ChenxiJiang333 <v-chenjiang@microsoft.com>
Co-authored-by: ChenxiJiang333 <119990644+ChenxiJiang333@users.noreply.github.com>
This commit is contained in:
Azure SDK Bot 2024-10-16 01:28:35 -07:00 коммит произвёл GitHub
Родитель c470c13923
Коммит d4be06ef06
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
84 изменённых файлов: 4474 добавлений и 673 удалений

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

@ -1,5 +1,19 @@
# Release History
## 3.1.0b2 (2024-10-16)
### Features Added
- Added operation group AccessPolicyAssignmentOperations
- Model Cluster has a new parameter high_availability
- Model Cluster has a new parameter redundancy_mode
- Model ClusterUpdate has a new parameter high_availability
- Model ClusterUpdate has a new parameter redundancy_mode
- Model Database has a new parameter access_keys_authentication
- Model Database has a new parameter system_data
- Model DatabaseUpdate has a new parameter access_keys_authentication
- Model ProxyResource has a new parameter system_data
## 3.1.0b1 (2024-05-20)
### Features Added

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

@ -1,11 +1,11 @@
{
"commit": "3940cd77b8d74b58d4a8b3a80388ff890052be67",
"commit": "8a287afb3721dee0d88f11502ec123470bc52a28",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.7",
"autorest": "3.10.2",
"use": [
"@autorest/python@6.13.7",
"@autorest/python@6.19.0",
"@autorest/modelerfour@4.27.0"
],
"autorest_command": "autorest specification/redisenterprise/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.13.7 --use=@autorest/modelerfour@4.27.0 --version=3.9.7 --version-tolerant=False",
"autorest_command": "autorest specification/redisenterprise/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False",
"readme": "specification/redisenterprise/resource-manager/readme.md"
}

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

@ -1,6 +0,0 @@
{
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "python",
"TagPrefix": "python/redisenterprise/azure-mgmt-redisenterprise",
"Tag": "python/redisenterprise/azure-mgmt-redisenterprise_a8ec9aca50"
}

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

@ -28,13 +28,13 @@ class RedisEnterpriseManagementClientConfiguration: # pylint: disable=too-many-
: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-03-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2024-09-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
api_version: str = kwargs.pop("api_version", "2024-03-01-preview")
api_version: str = kwargs.pop("api_version", "2024-09-01-preview")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")

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

@ -25,6 +25,7 @@
#
# --------------------------------------------------------------------------
# This file is used for handwritten extensions to the generated code. Example:
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
def patch_sdk():

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

@ -8,6 +8,7 @@
from copy import deepcopy
from typing import Any, TYPE_CHECKING
from typing_extensions import Self
from azure.core.pipeline import policies
from azure.core.rest import HttpRequest, HttpResponse
@ -18,6 +19,7 @@ from . import models as _models
from ._configuration import RedisEnterpriseManagementClientConfiguration
from ._serialization import Deserializer, Serializer
from .operations import (
AccessPolicyAssignmentOperations,
DatabasesOperations,
Operations,
OperationsStatusOperations,
@ -31,7 +33,7 @@ if TYPE_CHECKING:
from azure.core.credentials import TokenCredential
class RedisEnterpriseManagementClient: # pylint: disable=client-accepts-api-version-keyword
class RedisEnterpriseManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
"""REST API for managing Redis Enterprise resources in Azure.
:ivar operations: Operations operations
@ -42,6 +44,9 @@ class RedisEnterpriseManagementClient: # pylint: disable=client-accepts-api-ver
:vartype redis_enterprise: azure.mgmt.redisenterprise.operations.RedisEnterpriseOperations
:ivar databases: DatabasesOperations operations
:vartype databases: azure.mgmt.redisenterprise.operations.DatabasesOperations
:ivar access_policy_assignment: AccessPolicyAssignmentOperations operations
:vartype access_policy_assignment:
azure.mgmt.redisenterprise.operations.AccessPolicyAssignmentOperations
:ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
:vartype private_endpoint_connections:
azure.mgmt.redisenterprise.operations.PrivateEndpointConnectionsOperations
@ -54,7 +59,7 @@ class RedisEnterpriseManagementClient: # pylint: disable=client-accepts-api-ver
: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-03-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2024-09-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
@ -103,6 +108,9 @@ class RedisEnterpriseManagementClient: # pylint: disable=client-accepts-api-ver
self._client, self._config, self._serialize, self._deserialize
)
self.databases = DatabasesOperations(self._client, self._config, self._serialize, self._deserialize)
self.access_policy_assignment = AccessPolicyAssignmentOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(
self._client, self._config, self._serialize, self._deserialize
)
@ -135,7 +143,7 @@ class RedisEnterpriseManagementClient: # pylint: disable=client-accepts-api-ver
def close(self) -> None:
self._client.close()
def __enter__(self) -> "RedisEnterpriseManagementClient":
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
@ -1441,7 +1443,7 @@ class Deserializer(object):
elif isinstance(response, type) and issubclass(response, Enum):
return self.deserialize_enum(data, response)
if data is None:
if data is None or data is CoreNull:
return data
try:
attributes = response._attribute_map # type: ignore

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

@ -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 = "3.1.0b1"
VERSION = "3.1.0b2"

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

@ -28,13 +28,13 @@ class RedisEnterpriseManagementClientConfiguration: # pylint: disable=too-many-
: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-03-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2024-09-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
api_version: str = kwargs.pop("api_version", "2024-03-01-preview")
api_version: str = kwargs.pop("api_version", "2024-09-01-preview")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")

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

@ -25,6 +25,7 @@
#
# --------------------------------------------------------------------------
# This file is used for handwritten extensions to the generated code. Example:
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
def patch_sdk():

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

@ -8,6 +8,7 @@
from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
from typing_extensions import Self
from azure.core.pipeline import policies
from azure.core.rest import AsyncHttpResponse, HttpRequest
@ -18,6 +19,7 @@ from .. import models as _models
from .._serialization import Deserializer, Serializer
from ._configuration import RedisEnterpriseManagementClientConfiguration
from .operations import (
AccessPolicyAssignmentOperations,
DatabasesOperations,
Operations,
OperationsStatusOperations,
@ -31,7 +33,7 @@ if TYPE_CHECKING:
from azure.core.credentials_async import AsyncTokenCredential
class RedisEnterpriseManagementClient: # pylint: disable=client-accepts-api-version-keyword
class RedisEnterpriseManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
"""REST API for managing Redis Enterprise resources in Azure.
:ivar operations: Operations operations
@ -43,6 +45,9 @@ class RedisEnterpriseManagementClient: # pylint: disable=client-accepts-api-ver
:vartype redis_enterprise: azure.mgmt.redisenterprise.aio.operations.RedisEnterpriseOperations
:ivar databases: DatabasesOperations operations
:vartype databases: azure.mgmt.redisenterprise.aio.operations.DatabasesOperations
:ivar access_policy_assignment: AccessPolicyAssignmentOperations operations
:vartype access_policy_assignment:
azure.mgmt.redisenterprise.aio.operations.AccessPolicyAssignmentOperations
:ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
:vartype private_endpoint_connections:
azure.mgmt.redisenterprise.aio.operations.PrivateEndpointConnectionsOperations
@ -55,7 +60,7 @@ class RedisEnterpriseManagementClient: # pylint: disable=client-accepts-api-ver
: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-03-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2024-09-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
@ -104,6 +109,9 @@ class RedisEnterpriseManagementClient: # pylint: disable=client-accepts-api-ver
self._client, self._config, self._serialize, self._deserialize
)
self.databases = DatabasesOperations(self._client, self._config, self._serialize, self._deserialize)
self.access_policy_assignment = AccessPolicyAssignmentOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(
self._client, self._config, self._serialize, self._deserialize
)
@ -138,7 +146,7 @@ class RedisEnterpriseManagementClient: # pylint: disable=client-accepts-api-ver
async def close(self) -> None:
await self._client.close()
async def __aenter__(self) -> "RedisEnterpriseManagementClient":
async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self

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

@ -10,6 +10,7 @@ from ._operations import Operations
from ._operations_status_operations import OperationsStatusOperations
from ._redis_enterprise_operations import RedisEnterpriseOperations
from ._databases_operations import DatabasesOperations
from ._access_policy_assignment_operations import AccessPolicyAssignmentOperations
from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations
from ._private_link_resources_operations import PrivateLinkResourcesOperations
@ -22,6 +23,7 @@ __all__ = [
"OperationsStatusOperations",
"RedisEnterpriseOperations",
"DatabasesOperations",
"AccessPolicyAssignmentOperations",
"PrivateEndpointConnectionsOperations",
"PrivateLinkResourcesOperations",
]

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

@ -0,0 +1,589 @@
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
import sys
from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
StreamClosedError,
StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ...operations._access_policy_assignment_operations import (
build_create_update_request,
build_delete_request,
build_get_request,
build_list_request,
)
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class AccessPolicyAssignmentOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.redisenterprise.aio.RedisEnterpriseManagementClient`'s
:attr:`access_policy_assignment` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
async def _create_update_initial(
self,
resource_group_name: str,
cluster_name: str,
database_name: str,
access_policy_assignment_name: str,
parameters: Union[_models.AccessPolicyAssignment, IO[bytes]],
**kwargs: Any
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "AccessPolicyAssignment")
_request = build_create_update_request(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
database_name=database_name,
access_policy_assignment_name=access_policy_assignment_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@overload
async def begin_create_update(
self,
resource_group_name: str,
cluster_name: str,
database_name: str,
access_policy_assignment_name: str,
parameters: _models.AccessPolicyAssignment,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.AccessPolicyAssignment]:
"""Creates/Updates a particular access policy assignment for a database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: The name of the Redis Enterprise cluster. Required.
:type cluster_name: str
:param database_name: The name of the Redis Enterprise database. Required.
:type database_name: str
:param access_policy_assignment_name: The name of the Redis Enterprise database access policy
assignment. Required.
:type access_policy_assignment_name: str
:param parameters: Parameters supplied to the create access policy assignment for database.
Required.
:type parameters: ~azure.mgmt.redisenterprise.models.AccessPolicyAssignment
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either AccessPolicyAssignment or the result
of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.redisenterprise.models.AccessPolicyAssignment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_update(
self,
resource_group_name: str,
cluster_name: str,
database_name: str,
access_policy_assignment_name: str,
parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.AccessPolicyAssignment]:
"""Creates/Updates a particular access policy assignment for a database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: The name of the Redis Enterprise cluster. Required.
:type cluster_name: str
:param database_name: The name of the Redis Enterprise database. Required.
:type database_name: str
:param access_policy_assignment_name: The name of the Redis Enterprise database access policy
assignment. Required.
:type access_policy_assignment_name: str
:param parameters: Parameters supplied to the create access policy assignment for database.
Required.
:type parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either AccessPolicyAssignment or the result
of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.redisenterprise.models.AccessPolicyAssignment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_update(
self,
resource_group_name: str,
cluster_name: str,
database_name: str,
access_policy_assignment_name: str,
parameters: Union[_models.AccessPolicyAssignment, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.AccessPolicyAssignment]:
"""Creates/Updates a particular access policy assignment for a database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: The name of the Redis Enterprise cluster. Required.
:type cluster_name: str
:param database_name: The name of the Redis Enterprise database. Required.
:type database_name: str
:param access_policy_assignment_name: The name of the Redis Enterprise database access policy
assignment. Required.
:type access_policy_assignment_name: str
:param parameters: Parameters supplied to the create access policy assignment for database. Is
either a AccessPolicyAssignment type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.redisenterprise.models.AccessPolicyAssignment or IO[bytes]
:return: An instance of AsyncLROPoller that returns either AccessPolicyAssignment or the result
of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.redisenterprise.models.AccessPolicyAssignment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.AccessPolicyAssignment] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_update_initial(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
database_name=database_name,
access_policy_assignment_name=access_policy_assignment_name,
parameters=parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("AccessPolicyAssignment", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(
AsyncPollingMethod,
AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs),
)
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[_models.AccessPolicyAssignment].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[_models.AccessPolicyAssignment](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
@distributed_trace_async
async def get(
self,
resource_group_name: str,
cluster_name: str,
database_name: str,
access_policy_assignment_name: str,
**kwargs: Any
) -> _models.AccessPolicyAssignment:
"""Gets information about access policy assignment for database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: The name of the Redis Enterprise cluster. Required.
:type cluster_name: str
:param database_name: The name of the Redis Enterprise database. Required.
:type database_name: str
:param access_policy_assignment_name: The name of the Redis Enterprise database access policy
assignment. Required.
:type access_policy_assignment_name: str
:return: AccessPolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.redisenterprise.models.AccessPolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.AccessPolicyAssignment] = kwargs.pop("cls", None)
_request = build_get_request(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
database_name=database_name,
access_policy_assignment_name=access_policy_assignment_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("AccessPolicyAssignment", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
async def _delete_initial(
self,
resource_group_name: str,
cluster_name: str,
database_name: str,
access_policy_assignment_name: str,
**kwargs: Any
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
database_name=database_name,
access_policy_assignment_name=access_policy_assignment_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [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)
response_headers = {}
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
response_headers["Azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("Azure-AsyncOperation")
)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
self,
resource_group_name: str,
cluster_name: str,
database_name: str,
access_policy_assignment_name: str,
**kwargs: Any
) -> AsyncLROPoller[None]:
"""Deletes a single access policy assignment.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: The name of the Redis Enterprise cluster. Required.
:type cluster_name: str
:param database_name: The name of the Redis Enterprise database. Required.
:type database_name: str
:param access_policy_assignment_name: The name of the Redis Enterprise database access policy
assignment. Required.
:type access_policy_assignment_name: str
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
database_name=database_name,
access_policy_assignment_name=access_policy_assignment_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(
AsyncPollingMethod,
AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs),
)
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
self, resource_group_name: str, cluster_name: str, database_name: str, **kwargs: Any
) -> AsyncIterable["_models.AccessPolicyAssignment"]:
"""Gets all access policy assignments..
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: The name of the Redis Enterprise cluster. Required.
:type cluster_name: str
:param database_name: The name of the Redis Enterprise database. Required.
:type database_name: str
:return: An iterator like instance of either AccessPolicyAssignment or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redisenterprise.models.AccessPolicyAssignment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.AccessPolicyAssignmentList] = kwargs.pop("cls", None)
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_request(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
database_name=database_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("AccessPolicyAssignmentList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)

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

@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import sys
from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@ -17,12 +18,13 @@ 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
@ -30,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._databases_operations import (
build_create_request,
build_delete_request,
@ -40,7 +41,6 @@ from ...operations._databases_operations import (
build_force_unlink_request,
build_get_request,
build_import_method_request,
build_import_request,
build_list_by_cluster_request,
build_list_keys_request,
build_regenerate_key_request,
@ -48,6 +48,10 @@ from ...operations._databases_operations import (
build_upgrade_db_redis_version_request,
)
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@ -75,7 +79,7 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
def list_by_cluster(
self, resource_group_name: str, cluster_name: str, **kwargs: Any
) -> AsyncIterable["_models.Database"]:
"""Gets all databases in the specified RedisEnterprise cluster.
"""Gets all databases in the specified Redis Enterprise cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
@ -92,7 +96,7 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DatabaseList] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -111,7 +115,6 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -127,7 +130,6 @@ class DatabasesOperations: # 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
@ -164,8 +166,8 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
database_name: str,
parameters: Union[_models.Database, IO[bytes]],
**kwargs: Any
) -> _models.Database:
error_map = {
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -178,7 +180,7 @@ class DatabasesOperations: # 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.Database] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -200,10 +202,10 @@ class DatabasesOperations: # 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
)
@ -211,15 +213,15 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("Database", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("Database", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -336,10 +338,11 @@ class DatabasesOperations: # 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("Database", pipeline_response)
deserialized = self._deserialize("Database", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -371,8 +374,8 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
database_name: str,
parameters: Union[_models.DatabaseUpdate, IO[bytes]],
**kwargs: Any
) -> Optional[_models.Database]:
error_map = {
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -385,7 +388,7 @@ class DatabasesOperations: # 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.Database]] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -407,10 +410,10 @@ class DatabasesOperations: # 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
)
@ -418,16 +421,25 @@ class DatabasesOperations: # 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)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("Database", pipeline_response)
response_headers = {}
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
response_headers["Azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("Azure-AsyncOperation")
)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@ -541,10 +553,11 @@ class DatabasesOperations: # 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("Database", pipeline_response)
deserialized = self._deserialize("Database", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -573,7 +586,7 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
async def get(
self, resource_group_name: str, cluster_name: str, database_name: str, **kwargs: Any
) -> _models.Database:
"""Gets information about a database in a RedisEnterprise cluster.
"""Gets information about a database in a Redis Enterprise cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
@ -586,7 +599,7 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
:rtype: ~azure.mgmt.redisenterprise.models.Database
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -609,7 +622,6 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -624,17 +636,17 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("Database", pipeline_response)
deserialized = self._deserialize("Database", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
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, database_name: str, **kwargs: Any
) -> None:
error_map = {
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -646,7 +658,7 @@ class DatabasesOperations: # 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,
@ -657,10 +669,10 @@ class DatabasesOperations: # 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,12 +680,27 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
response_headers["Azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("Azure-AsyncOperation")
)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, None, {}) # type: ignore
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@ -701,7 +728,7 @@ class DatabasesOperations: # 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,
cluster_name=cluster_name,
database_name=database_name,
@ -711,6 +738,7 @@ class DatabasesOperations: # 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
@ -739,7 +767,7 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
async def list_keys(
self, resource_group_name: str, cluster_name: str, database_name: str, **kwargs: Any
) -> _models.AccessKeys:
"""Retrieves the access keys for the RedisEnterprise database.
"""Retrieves the access keys for the Redis Enterprise database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
@ -752,7 +780,7 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
:rtype: ~azure.mgmt.redisenterprise.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -775,7 +803,6 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -790,7 +817,7 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("AccessKeys", pipeline_response)
deserialized = self._deserialize("AccessKeys", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -804,8 +831,8 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
database_name: str,
parameters: Union[_models.RegenerateKeyParameters, IO[bytes]],
**kwargs: Any
) -> Optional[_models.AccessKeys]:
error_map = {
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -818,7 +845,7 @@ class DatabasesOperations: # 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.AccessKeys]] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -840,10 +867,10 @@ class DatabasesOperations: # 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
)
@ -851,16 +878,25 @@ class DatabasesOperations: # 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)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("AccessKeys", pipeline_response)
response_headers = {}
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
response_headers["Azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("Azure-AsyncOperation")
)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@ -875,7 +911,7 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.AccessKeys]:
"""Regenerates the RedisEnterprise database's access keys.
"""Regenerates the Redis Enterprise database's access keys.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
@ -906,7 +942,7 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.AccessKeys]:
"""Regenerates the RedisEnterprise database's access keys.
"""Regenerates the Redis Enterprise database's access keys.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
@ -935,7 +971,7 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
parameters: Union[_models.RegenerateKeyParameters, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.AccessKeys]:
"""Regenerates the RedisEnterprise database's access keys.
"""Regenerates the Redis Enterprise database's access keys.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
@ -974,10 +1010,11 @@ class DatabasesOperations: # 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("AccessKeys", pipeline_response)
deserialized = self._deserialize("AccessKeys", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -1002,15 +1039,15 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
async def _import_initial( # pylint: disable=inconsistent-return-statements
async def _import_method_initial(
self,
resource_group_name: str,
cluster_name: str,
database_name: str,
parameters: Union[_models.ImportClusterParameters, IO[bytes]],
**kwargs: Any
) -> None:
error_map = {
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -1023,7 +1060,7 @@ class DatabasesOperations: # 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
@ -1033,7 +1070,7 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
else:
_json = self._serialize.body(parameters, "ImportClusterParameters")
_request = build_import_request(
_request = build_import_method_request(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
database_name=database_name,
@ -1045,10 +1082,10 @@ class DatabasesOperations: # 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
)
@ -1056,12 +1093,27 @@ class DatabasesOperations: # 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)
response_headers = {}
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
response_headers["Azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("Azure-AsyncOperation")
)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, None, {}) # type: ignore
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
async def begin_import_method(
@ -1158,7 +1210,7 @@ class DatabasesOperations: # 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._import_initial( # type: ignore
raw_result = await self._import_method_initial(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
database_name=database_name,
@ -1170,6 +1222,7 @@ class DatabasesOperations: # 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
@ -1194,15 +1247,15 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
)
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
async def _export_initial( # pylint: disable=inconsistent-return-statements
async def _export_initial(
self,
resource_group_name: str,
cluster_name: str,
database_name: str,
parameters: Union[_models.ExportClusterParameters, IO[bytes]],
**kwargs: Any
) -> None:
error_map = {
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -1215,7 +1268,7 @@ class DatabasesOperations: # 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
@ -1237,10 +1290,10 @@ class DatabasesOperations: # 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
)
@ -1248,12 +1301,27 @@ class DatabasesOperations: # 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)
response_headers = {}
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
response_headers["Azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("Azure-AsyncOperation")
)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, None, {}) # type: ignore
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
async def begin_export(
@ -1350,7 +1418,7 @@ class DatabasesOperations: # 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._export_initial( # type: ignore
raw_result = await self._export_initial(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
database_name=database_name,
@ -1362,6 +1430,7 @@ class DatabasesOperations: # 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
@ -1386,15 +1455,15 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
)
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
async def _force_unlink_initial( # pylint: disable=inconsistent-return-statements
async def _force_unlink_initial(
self,
resource_group_name: str,
cluster_name: str,
database_name: str,
parameters: Union[_models.ForceUnlinkParameters, IO[bytes]],
**kwargs: Any
) -> None:
error_map = {
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -1407,7 +1476,7 @@ class DatabasesOperations: # 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
@ -1429,10 +1498,10 @@ class DatabasesOperations: # 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
)
@ -1440,12 +1509,27 @@ class DatabasesOperations: # 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)
response_headers = {}
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
response_headers["Azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("Azure-AsyncOperation")
)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, None, {}) # type: ignore
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
async def begin_force_unlink(
@ -1542,7 +1626,7 @@ class DatabasesOperations: # 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._force_unlink_initial( # type: ignore
raw_result = await self._force_unlink_initial(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
database_name=database_name,
@ -1554,6 +1638,7 @@ class DatabasesOperations: # 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
@ -1578,15 +1663,15 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
)
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
async def _force_link_to_replication_group_initial( # pylint: disable=inconsistent-return-statements
async def _force_link_to_replication_group_initial(
self,
resource_group_name: str,
cluster_name: str,
database_name: str,
parameters: Union[_models.ForceLinkParameters, IO[bytes]],
**kwargs: Any
) -> None:
error_map = {
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -1599,7 +1684,7 @@ class DatabasesOperations: # 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
@ -1621,10 +1706,10 @@ class DatabasesOperations: # 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
)
@ -1632,6 +1717,10 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [202]:
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
@ -1642,8 +1731,12 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
"str", response.headers.get("Azure-AsyncOperation")
)
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_force_link_to_replication_group(
@ -1746,7 +1839,7 @@ class DatabasesOperations: # 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._force_link_to_replication_group_initial( # type: ignore
raw_result = await self._force_link_to_replication_group_initial(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
database_name=database_name,
@ -1758,6 +1851,7 @@ class DatabasesOperations: # 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
@ -1782,15 +1876,15 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
)
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
async def _flush_initial( # pylint: disable=inconsistent-return-statements
async def _flush_initial(
self,
resource_group_name: str,
cluster_name: str,
database_name: str,
parameters: Union[_models.FlushParameters, IO[bytes]],
**kwargs: Any
) -> None:
error_map = {
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -1803,7 +1897,7 @@ class DatabasesOperations: # 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
@ -1825,10 +1919,10 @@ class DatabasesOperations: # 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
)
@ -1836,6 +1930,10 @@ class DatabasesOperations: # 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)
@ -1847,8 +1945,12 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
"str", response.headers.get("Azure-AsyncOperation")
)
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_flush(
@ -1945,7 +2047,7 @@ class DatabasesOperations: # 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._flush_initial( # type: ignore
raw_result = await self._flush_initial(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
database_name=database_name,
@ -1957,6 +2059,7 @@ class DatabasesOperations: # 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
@ -1980,10 +2083,10 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
)
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
async def _upgrade_db_redis_version_initial( # pylint: disable=inconsistent-return-statements
async def _upgrade_db_redis_version_initial(
self, resource_group_name: str, cluster_name: str, database_name: str, **kwargs: Any
) -> None:
error_map = {
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -1995,7 +2098,7 @@ class DatabasesOperations: # 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_upgrade_db_redis_version_request(
resource_group_name=resource_group_name,
@ -2006,10 +2109,10 @@ class DatabasesOperations: # 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,6 +2120,10 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
response = pipeline_response.http_response
if response.status_code not in [202]:
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
@ -2027,8 +2134,12 @@ class DatabasesOperations: # pylint: disable=too-many-public-methods
"str", response.headers.get("Azure-AsyncOperation")
)
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_upgrade_db_redis_version(
@ -2056,7 +2167,7 @@ class DatabasesOperations: # 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._upgrade_db_redis_version_initial( # type: ignore
raw_result = await self._upgrade_db_redis_version_initial(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
database_name=database_name,
@ -2066,6 +2177,7 @@ class DatabasesOperations: # 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

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

@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@ -19,16 +20,18 @@ 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):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@ -66,7 +69,7 @@ class Operations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -82,7 +85,6 @@ class Operations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -98,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

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

@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, Callable, Dict, Optional, TypeVar
import sys
from typing import Any, Callable, Dict, Optional, Type, TypeVar
from azure.core.exceptions import (
ClientAuthenticationError,
@ -17,16 +18,18 @@ 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_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._operations_status_operations import build_get_request
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@ -62,7 +65,7 @@ class OperationsStatusOperations:
:rtype: ~azure.mgmt.redisenterprise.models.OperationStatus
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -84,7 +87,6 @@ class OperationsStatusOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -99,7 +101,7 @@ class OperationsStatusOperations:
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("OperationStatus", pipeline_response)
deserialized = self._deserialize("OperationStatus", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore

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

@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import sys
from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@ -17,12 +18,13 @@ 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
@ -30,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_delete_request,
build_get_request,
@ -38,6 +39,10 @@ from ...operations._private_endpoint_connections_operations import (
build_put_request,
)
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@ -65,7 +70,7 @@ class PrivateEndpointConnectionsOperations:
def list(
self, resource_group_name: str, cluster_name: str, **kwargs: Any
) -> AsyncIterable["_models.PrivateEndpointConnection"]:
"""Lists all the private endpoint connections associated with the RedisEnterprise cluster.
"""Lists all the private endpoint connections associated with the Redis Enterprise cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
@ -84,7 +89,7 @@ class PrivateEndpointConnectionsOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -103,7 +108,6 @@ class PrivateEndpointConnectionsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -119,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
@ -153,7 +156,7 @@ class PrivateEndpointConnectionsOperations:
async def get(
self, resource_group_name: str, cluster_name: str, private_endpoint_connection_name: str, **kwargs: Any
) -> _models.PrivateEndpointConnection:
"""Gets the specified private endpoint connection associated with the RedisEnterprise cluster.
"""Gets the specified private endpoint connection associated with the Redis Enterprise cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
@ -167,7 +170,7 @@ class PrivateEndpointConnectionsOperations:
:rtype: ~azure.mgmt.redisenterprise.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -190,7 +193,6 @@ class PrivateEndpointConnectionsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -205,7 +207,7 @@ class PrivateEndpointConnectionsOperations:
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -219,8 +221,8 @@ class PrivateEndpointConnectionsOperations:
private_endpoint_connection_name: str,
properties: Union[_models.PrivateEndpointConnection, IO[bytes]],
**kwargs: Any
) -> _models.PrivateEndpointConnection:
error_map = {
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -233,7 +235,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[_models.PrivateEndpointConnection] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -255,10 +257,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
)
@ -266,11 +268,15 @@ class PrivateEndpointConnectionsOperations:
response = pipeline_response.http_response
if response.status_code not in [201]:
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -288,8 +294,8 @@ class PrivateEndpointConnectionsOperations:
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.PrivateEndpointConnection]:
"""Updates the state of the specified private endpoint connection associated with the
RedisEnterprise cluster.
"""Updates the state of the specified private endpoint connection associated with the Redis
Enterprise cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
@ -322,8 +328,8 @@ class PrivateEndpointConnectionsOperations:
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.PrivateEndpointConnection]:
"""Updates the state of the specified private endpoint connection associated with the
RedisEnterprise cluster.
"""Updates the state of the specified private endpoint connection associated with the Redis
Enterprise cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
@ -354,8 +360,8 @@ class PrivateEndpointConnectionsOperations:
properties: Union[_models.PrivateEndpointConnection, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.PrivateEndpointConnection]:
"""Updates the state of the specified private endpoint connection associated with the
RedisEnterprise cluster.
"""Updates the state of the specified private endpoint connection associated with the Redis
Enterprise cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
@ -396,10 +402,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
@ -421,10 +428,10 @@ 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, cluster_name: str, private_endpoint_connection_name: str, **kwargs: Any
) -> None:
error_map = {
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -436,7 +443,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,
@ -447,10 +454,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
)
@ -458,6 +465,10 @@ class PrivateEndpointConnectionsOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
@ -469,14 +480,18 @@ class PrivateEndpointConnectionsOperations:
"str", response.headers.get("Azure-AsyncOperation")
)
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, cluster_name: str, private_endpoint_connection_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Deletes the specified private endpoint connection associated with the RedisEnterprise cluster.
"""Deletes the specified private endpoint connection associated with the Redis Enterprise cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
@ -499,7 +514,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,
cluster_name=cluster_name,
private_endpoint_connection_name=private_endpoint_connection_name,
@ -509,6 +524,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

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

@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@ -19,16 +20,18 @@ 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._private_link_resources_operations import build_list_by_cluster_request
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@ -56,7 +59,7 @@ class PrivateLinkResourcesOperations:
def list_by_cluster(
self, resource_group_name: str, cluster_name: str, **kwargs: Any
) -> AsyncIterable["_models.PrivateLinkResource"]:
"""Gets the private link resources that need to be created for a RedisEnterprise cluster.
"""Gets the private link resources that need to be created for a Redis Enterprise cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
@ -74,7 +77,7 @@ class PrivateLinkResourcesOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -93,7 +96,6 @@ class PrivateLinkResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -109,7 +111,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

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

@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import sys
from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@ -17,12 +18,13 @@ 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
@ -30,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._redis_enterprise_operations import (
build_create_request,
build_delete_request,
@ -40,6 +41,10 @@ from ...operations._redis_enterprise_operations import (
build_update_request,
)
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@ -65,8 +70,8 @@ class RedisEnterpriseOperations:
async def _create_initial(
self, resource_group_name: str, cluster_name: str, parameters: Union[_models.Cluster, IO[bytes]], **kwargs: Any
) -> _models.Cluster:
error_map = {
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -79,7 +84,7 @@ class RedisEnterpriseOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Cluster] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -100,10 +105,10 @@ class RedisEnterpriseOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -111,15 +116,15 @@ class RedisEnterpriseOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("Cluster", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("Cluster", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -143,7 +148,7 @@ class RedisEnterpriseOperations:
:type resource_group_name: str
:param cluster_name: The name of the Redis Enterprise cluster. Required.
:type cluster_name: str
:param parameters: Parameters supplied to the Create RedisEnterprise operation. Required.
:param parameters: Parameters supplied to the Create Redis Enterprise operation. Required.
:type parameters: ~azure.mgmt.redisenterprise.models.Cluster
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
@ -171,7 +176,7 @@ class RedisEnterpriseOperations:
:type resource_group_name: str
:param cluster_name: The name of the Redis Enterprise cluster. Required.
:type cluster_name: str
:param parameters: Parameters supplied to the Create RedisEnterprise operation. Required.
:param parameters: Parameters supplied to the Create Redis Enterprise operation. Required.
:type parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
@ -193,7 +198,7 @@ class RedisEnterpriseOperations:
:type resource_group_name: str
:param cluster_name: The name of the Redis Enterprise cluster. Required.
:type cluster_name: str
:param parameters: Parameters supplied to the Create RedisEnterprise operation. Is either a
:param parameters: Parameters supplied to the Create Redis Enterprise operation. Is either a
Cluster type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.redisenterprise.models.Cluster or IO[bytes]
:return: An instance of AsyncLROPoller that returns either Cluster or the result of
@ -222,10 +227,11 @@ class RedisEnterpriseOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("Cluster", pipeline_response)
deserialized = self._deserialize("Cluster", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -256,8 +262,8 @@ class RedisEnterpriseOperations:
cluster_name: str,
parameters: Union[_models.ClusterUpdate, IO[bytes]],
**kwargs: Any
) -> Optional[_models.Cluster]:
error_map = {
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -270,7 +276,7 @@ class RedisEnterpriseOperations:
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.Cluster]] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -291,10 +297,10 @@ class RedisEnterpriseOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -302,16 +308,25 @@ class RedisEnterpriseOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("Cluster", pipeline_response)
response_headers = {}
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
response_headers["Azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("Azure-AsyncOperation")
)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@ -325,14 +340,14 @@ class RedisEnterpriseOperations:
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.Cluster]:
"""Updates an existing RedisEnterprise cluster.
"""Updates an existing Redis Enterprise cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: The name of the Redis Enterprise cluster. Required.
:type cluster_name: str
:param parameters: Parameters supplied to the Update RedisEnterprise operation. Required.
:param parameters: Parameters supplied to the Update Redis Enterprise operation. Required.
:type parameters: ~azure.mgmt.redisenterprise.models.ClusterUpdate
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
@ -353,14 +368,14 @@ class RedisEnterpriseOperations:
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.Cluster]:
"""Updates an existing RedisEnterprise cluster.
"""Updates an existing Redis Enterprise cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: The name of the Redis Enterprise cluster. Required.
:type cluster_name: str
:param parameters: Parameters supplied to the Update RedisEnterprise operation. Required.
:param parameters: Parameters supplied to the Update Redis Enterprise operation. Required.
:type parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
@ -379,14 +394,14 @@ class RedisEnterpriseOperations:
parameters: Union[_models.ClusterUpdate, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.Cluster]:
"""Updates an existing RedisEnterprise cluster.
"""Updates an existing Redis Enterprise cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: The name of the Redis Enterprise cluster. Required.
:type cluster_name: str
:param parameters: Parameters supplied to the Update RedisEnterprise operation. Is either a
:param parameters: Parameters supplied to the Update Redis Enterprise operation. Is either a
ClusterUpdate type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.redisenterprise.models.ClusterUpdate or IO[bytes]
:return: An instance of AsyncLROPoller that returns either Cluster or the result of
@ -415,10 +430,11 @@ class RedisEnterpriseOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("Cluster", pipeline_response)
deserialized = self._deserialize("Cluster", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -443,10 +459,8 @@ class RedisEnterpriseOperations:
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, cluster_name: str, **kwargs: Any
) -> None:
error_map = {
async def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -458,7 +472,7 @@ class RedisEnterpriseOperations:
_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,
@ -468,10 +482,10 @@ class RedisEnterpriseOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -479,16 +493,31 @@ class RedisEnterpriseOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
response_headers["Azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("Azure-AsyncOperation")
)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, None, {}) # 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, cluster_name: str, **kwargs: Any) -> AsyncLROPoller[None]:
"""Deletes a RedisEnterprise cache cluster.
"""Deletes a Redis Enterprise cache cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
@ -508,7 +537,7 @@ class RedisEnterpriseOperations:
lro_delay = kwargs.pop("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,
@ -517,6 +546,7 @@ class RedisEnterpriseOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -543,7 +573,7 @@ class RedisEnterpriseOperations:
@distributed_trace_async
async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _models.Cluster:
"""Gets information about a RedisEnterprise cluster.
"""Gets information about a Redis Enterprise cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
@ -554,7 +584,7 @@ class RedisEnterpriseOperations:
:rtype: ~azure.mgmt.redisenterprise.models.Cluster
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -576,7 +606,6 @@ class RedisEnterpriseOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -591,7 +620,7 @@ class RedisEnterpriseOperations:
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("Cluster", pipeline_response)
deserialized = self._deserialize("Cluster", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -600,7 +629,7 @@ class RedisEnterpriseOperations:
@distributed_trace
def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Cluster"]:
"""Lists all RedisEnterprise clusters in a resource group.
"""Lists all Redis Enterprise clusters in a resource group.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
@ -615,7 +644,7 @@ class RedisEnterpriseOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClusterList] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -633,7 +662,6 @@ class RedisEnterpriseOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -649,7 +677,6 @@ class RedisEnterpriseOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@ -681,7 +708,7 @@ class RedisEnterpriseOperations:
@distributed_trace
def list(self, **kwargs: Any) -> AsyncIterable["_models.Cluster"]:
"""Gets all RedisEnterprise clusters in the specified subscription.
"""Lists all Redis Enterprise clusters in the specified subscription.
:return: An iterator like instance of either Cluster or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redisenterprise.models.Cluster]
@ -693,7 +720,7 @@ class RedisEnterpriseOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClusterList] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -710,7 +737,6 @@ class RedisEnterpriseOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -726,7 +752,6 @@ class RedisEnterpriseOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

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

@ -7,6 +7,9 @@
# --------------------------------------------------------------------------
from ._models_py3 import AccessKeys
from ._models_py3 import AccessPolicyAssignment
from ._models_py3 import AccessPolicyAssignmentList
from ._models_py3 import AccessPolicyAssignmentPropertiesUser
from ._models_py3 import Cluster
from ._models_py3 import ClusterList
from ._models_py3 import ClusterPropertiesEncryption
@ -40,19 +43,25 @@ from ._models_py3 import PrivateLinkResource
from ._models_py3 import PrivateLinkResourceListResult
from ._models_py3 import PrivateLinkServiceConnectionState
from ._models_py3 import ProxyResource
from ._models_py3 import ProxyResourceAutoGenerated
from ._models_py3 import RegenerateKeyParameters
from ._models_py3 import Resource
from ._models_py3 import ResourceAutoGenerated
from ._models_py3 import Sku
from ._models_py3 import SystemData
from ._models_py3 import TrackedResource
from ._models_py3 import UserAssignedIdentity
from ._redis_enterprise_management_client_enums import AccessKeyType
from ._redis_enterprise_management_client_enums import AccessKeysAuthentication
from ._redis_enterprise_management_client_enums import ActionType
from ._redis_enterprise_management_client_enums import AofFrequency
from ._redis_enterprise_management_client_enums import ClusteringPolicy
from ._redis_enterprise_management_client_enums import CmkIdentityType
from ._redis_enterprise_management_client_enums import CreatedByType
from ._redis_enterprise_management_client_enums import DeferUpgradeSetting
from ._redis_enterprise_management_client_enums import EvictionPolicy
from ._redis_enterprise_management_client_enums import HighAvailability
from ._redis_enterprise_management_client_enums import LinkState
from ._redis_enterprise_management_client_enums import ManagedServiceIdentityType
from ._redis_enterprise_management_client_enums import Origin
@ -61,6 +70,7 @@ from ._redis_enterprise_management_client_enums import PrivateEndpointServiceCon
from ._redis_enterprise_management_client_enums import Protocol
from ._redis_enterprise_management_client_enums import ProvisioningState
from ._redis_enterprise_management_client_enums import RdbFrequency
from ._redis_enterprise_management_client_enums import RedundancyMode
from ._redis_enterprise_management_client_enums import ResourceState
from ._redis_enterprise_management_client_enums import SkuName
from ._redis_enterprise_management_client_enums import TlsVersion
@ -70,6 +80,9 @@ from ._patch import patch_sdk as _patch_sdk
__all__ = [
"AccessKeys",
"AccessPolicyAssignment",
"AccessPolicyAssignmentList",
"AccessPolicyAssignmentPropertiesUser",
"Cluster",
"ClusterList",
"ClusterPropertiesEncryption",
@ -103,18 +116,24 @@ __all__ = [
"PrivateLinkResourceListResult",
"PrivateLinkServiceConnectionState",
"ProxyResource",
"ProxyResourceAutoGenerated",
"RegenerateKeyParameters",
"Resource",
"ResourceAutoGenerated",
"Sku",
"SystemData",
"TrackedResource",
"UserAssignedIdentity",
"AccessKeyType",
"AccessKeysAuthentication",
"ActionType",
"AofFrequency",
"ClusteringPolicy",
"CmkIdentityType",
"CreatedByType",
"DeferUpgradeSetting",
"EvictionPolicy",
"HighAvailability",
"LinkState",
"ManagedServiceIdentityType",
"Origin",
@ -123,6 +142,7 @@ __all__ = [
"Protocol",
"ProvisioningState",
"RdbFrequency",
"RedundancyMode",
"ResourceState",
"SkuName",
"TlsVersion",

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

@ -7,6 +7,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import datetime
from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union
from .. import _serialization
@ -79,6 +80,133 @@ class Resource(_serialization.Model):
self.type = None
class ProxyResourceAutoGenerated(Resource):
"""The resource model definition for a Azure Resource Manager proxy resource. It will not have
tags and a location.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
"Microsoft.Storage/storageAccounts".
:vartype type: str
"""
class AccessPolicyAssignment(ProxyResourceAutoGenerated):
"""Describes the access policy assignment of Redis Enterprise database.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar provisioning_state: Current provisioning status of the access policy assignment. Known
values are: "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting".
:vartype provisioning_state: str or ~azure.mgmt.redisenterprise.models.ProvisioningState
:ivar access_policy_name: Name of access policy under specific access policy assignment. Only
"default" policy is supported for now.
:vartype access_policy_name: str
:ivar user: The user associated with the access policy.
:vartype user: ~azure.mgmt.redisenterprise.models.AccessPolicyAssignmentPropertiesUser
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"provisioning_state": {"readonly": True},
"access_policy_name": {"pattern": r"^([a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]|[a-zA-Z0-9])$"},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"access_policy_name": {"key": "properties.accessPolicyName", "type": "str"},
"user": {"key": "properties.user", "type": "AccessPolicyAssignmentPropertiesUser"},
}
def __init__(
self,
*,
access_policy_name: Optional[str] = None,
user: Optional["_models.AccessPolicyAssignmentPropertiesUser"] = None,
**kwargs: Any
) -> None:
"""
:keyword access_policy_name: Name of access policy under specific access policy assignment.
Only "default" policy is supported for now.
:paramtype access_policy_name: str
:keyword user: The user associated with the access policy.
:paramtype user: ~azure.mgmt.redisenterprise.models.AccessPolicyAssignmentPropertiesUser
"""
super().__init__(**kwargs)
self.provisioning_state = None
self.access_policy_name = access_policy_name
self.user = user
class AccessPolicyAssignmentList(_serialization.Model):
"""The response of a list-all operation.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of access policy assignments.
:vartype value: list[~azure.mgmt.redisenterprise.models.AccessPolicyAssignment]
:ivar next_link: The URI to fetch the next page of results.
:vartype next_link: str
"""
_validation = {
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[AccessPolicyAssignment]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, *, value: Optional[List["_models.AccessPolicyAssignment"]] = None, **kwargs: Any) -> None:
"""
:keyword value: List of access policy assignments.
:paramtype value: list[~azure.mgmt.redisenterprise.models.AccessPolicyAssignment]
"""
super().__init__(**kwargs)
self.value = value
self.next_link = None
class AccessPolicyAssignmentPropertiesUser(_serialization.Model):
"""The user associated with the access policy.
:ivar object_id: The object ID of the user.
:vartype object_id: str
"""
_attribute_map = {
"object_id": {"key": "objectId", "type": "str"},
}
def __init__(self, *, object_id: Optional[str] = None, **kwargs: Any) -> None:
"""
:keyword object_id: The object ID of the user.
:paramtype object_id: str
"""
super().__init__(**kwargs)
self.object_id = object_id
class TrackedResource(Resource):
"""The resource model definition for an Azure Resource Manager tracked top level resource which
has 'tags' and a 'location'.
@ -129,7 +257,7 @@ class TrackedResource(Resource):
class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes
"""Describes the RedisEnterprise cluster.
"""Describes the Redis Enterprise cluster.
Variables are only populated by the server, and will be ignored when sending a request.
@ -153,8 +281,14 @@ class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes
:vartype zones: list[str]
:ivar identity: The identity of the resource.
:vartype identity: ~azure.mgmt.redisenterprise.models.ManagedServiceIdentity
:ivar high_availability: Enabled by default. If highAvailability is disabled, the data set is
not replicated. This affects the availability SLA, and increases the risk of data loss. Known
values are: "Enabled" and "Disabled".
:vartype high_availability: str or ~azure.mgmt.redisenterprise.models.HighAvailability
:ivar minimum_tls_version: The minimum TLS version for the cluster to support, e.g. '1.2'.
Known values are: "1.0", "1.1", and "1.2".
Newer versions can be added in the future. Note that TLS 1.0 and TLS 1.1 are now completely
obsolete -- you cannot use them. They are mentioned only for the sake of consistency with old
API versions. Known values are: "1.0", "1.1", and "1.2".
:vartype minimum_tls_version: str or ~azure.mgmt.redisenterprise.models.TlsVersion
:ivar encryption: Encryption-at-rest configuration for the cluster.
:vartype encryption: ~azure.mgmt.redisenterprise.models.ClusterPropertiesEncryption
@ -163,6 +297,9 @@ class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes
:ivar provisioning_state: Current provisioning status of the cluster. Known values are:
"Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting".
:vartype provisioning_state: str or ~azure.mgmt.redisenterprise.models.ProvisioningState
:ivar redundancy_mode: Explains the current redundancy strategy of the cluster, which affects
the expected SLA. Known values are: "None", "LR", and "ZR".
:vartype redundancy_mode: str or ~azure.mgmt.redisenterprise.models.RedundancyMode
:ivar resource_state: Current resource status of the cluster. Known values are: "Running",
"Creating", "CreateFailed", "Updating", "UpdateFailed", "Deleting", "DeleteFailed", "Enabling",
"EnableFailed", "Disabling", "DisableFailed", "Disabled", "Scaling", and "ScalingFailed".
@ -170,7 +307,7 @@ class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes
:ivar redis_version: Version of redis the cluster supports, e.g. '6'.
:vartype redis_version: str
:ivar private_endpoint_connections: List of private endpoint connections associated with the
specified RedisEnterprise cluster.
specified Redis Enterprise cluster.
:vartype private_endpoint_connections:
list[~azure.mgmt.redisenterprise.models.PrivateEndpointConnection]
"""
@ -183,6 +320,7 @@ class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes
"sku": {"required": True},
"host_name": {"readonly": True},
"provisioning_state": {"readonly": True},
"redundancy_mode": {"readonly": True},
"resource_state": {"readonly": True},
"redis_version": {"readonly": True},
"private_endpoint_connections": {"readonly": True},
@ -197,10 +335,12 @@ class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes
"sku": {"key": "sku", "type": "Sku"},
"zones": {"key": "zones", "type": "[str]"},
"identity": {"key": "identity", "type": "ManagedServiceIdentity"},
"high_availability": {"key": "properties.highAvailability", "type": "str"},
"minimum_tls_version": {"key": "properties.minimumTlsVersion", "type": "str"},
"encryption": {"key": "properties.encryption", "type": "ClusterPropertiesEncryption"},
"host_name": {"key": "properties.hostName", "type": "str"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"redundancy_mode": {"key": "properties.redundancyMode", "type": "str"},
"resource_state": {"key": "properties.resourceState", "type": "str"},
"redis_version": {"key": "properties.redisVersion", "type": "str"},
"private_endpoint_connections": {
@ -217,6 +357,7 @@ class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes
tags: Optional[Dict[str, str]] = None,
zones: Optional[List[str]] = None,
identity: Optional["_models.ManagedServiceIdentity"] = None,
high_availability: Optional[Union[str, "_models.HighAvailability"]] = None,
minimum_tls_version: Optional[Union[str, "_models.TlsVersion"]] = None,
encryption: Optional["_models.ClusterPropertiesEncryption"] = None,
**kwargs: Any
@ -232,8 +373,14 @@ class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes
:paramtype zones: list[str]
:keyword identity: The identity of the resource.
:paramtype identity: ~azure.mgmt.redisenterprise.models.ManagedServiceIdentity
:keyword high_availability: Enabled by default. If highAvailability is disabled, the data set
is not replicated. This affects the availability SLA, and increases the risk of data loss.
Known values are: "Enabled" and "Disabled".
:paramtype high_availability: str or ~azure.mgmt.redisenterprise.models.HighAvailability
:keyword minimum_tls_version: The minimum TLS version for the cluster to support, e.g. '1.2'.
Known values are: "1.0", "1.1", and "1.2".
Newer versions can be added in the future. Note that TLS 1.0 and TLS 1.1 are now completely
obsolete -- you cannot use them. They are mentioned only for the sake of consistency with old
API versions. Known values are: "1.0", "1.1", and "1.2".
:paramtype minimum_tls_version: str or ~azure.mgmt.redisenterprise.models.TlsVersion
:keyword encryption: Encryption-at-rest configuration for the cluster.
:paramtype encryption: ~azure.mgmt.redisenterprise.models.ClusterPropertiesEncryption
@ -242,10 +389,12 @@ class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes
self.sku = sku
self.zones = zones
self.identity = identity
self.high_availability = high_availability
self.minimum_tls_version = minimum_tls_version
self.encryption = encryption
self.host_name = None
self.provisioning_state = None
self.redundancy_mode = None
self.resource_state = None
self.redis_version = None
self.private_endpoint_connections = None
@ -402,8 +551,8 @@ class ClusterPropertiesEncryptionCustomerManagedKeyEncryptionKeyIdentity(
self.identity_type = identity_type
class ClusterUpdate(_serialization.Model):
"""A partial update to the RedisEnterprise cluster.
class ClusterUpdate(_serialization.Model): # pylint: disable=too-many-instance-attributes
"""A partial update to the Redis Enterprise cluster.
Variables are only populated by the server, and will be ignored when sending a request.
@ -413,8 +562,14 @@ class ClusterUpdate(_serialization.Model):
:vartype identity: ~azure.mgmt.redisenterprise.models.ManagedServiceIdentity
:ivar tags: Resource tags.
:vartype tags: dict[str, str]
:ivar high_availability: Enabled by default. If highAvailability is disabled, the data set is
not replicated. This affects the availability SLA, and increases the risk of data loss. Known
values are: "Enabled" and "Disabled".
:vartype high_availability: str or ~azure.mgmt.redisenterprise.models.HighAvailability
:ivar minimum_tls_version: The minimum TLS version for the cluster to support, e.g. '1.2'.
Known values are: "1.0", "1.1", and "1.2".
Newer versions can be added in the future. Note that TLS 1.0 and TLS 1.1 are now completely
obsolete -- you cannot use them. They are mentioned only for the sake of consistency with old
API versions. Known values are: "1.0", "1.1", and "1.2".
:vartype minimum_tls_version: str or ~azure.mgmt.redisenterprise.models.TlsVersion
:ivar encryption: Encryption-at-rest configuration for the cluster.
:vartype encryption: ~azure.mgmt.redisenterprise.models.ClusterPropertiesEncryption
@ -423,6 +578,9 @@ class ClusterUpdate(_serialization.Model):
:ivar provisioning_state: Current provisioning status of the cluster. Known values are:
"Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting".
:vartype provisioning_state: str or ~azure.mgmt.redisenterprise.models.ProvisioningState
:ivar redundancy_mode: Explains the current redundancy strategy of the cluster, which affects
the expected SLA. Known values are: "None", "LR", and "ZR".
:vartype redundancy_mode: str or ~azure.mgmt.redisenterprise.models.RedundancyMode
:ivar resource_state: Current resource status of the cluster. Known values are: "Running",
"Creating", "CreateFailed", "Updating", "UpdateFailed", "Deleting", "DeleteFailed", "Enabling",
"EnableFailed", "Disabling", "DisableFailed", "Disabled", "Scaling", and "ScalingFailed".
@ -430,7 +588,7 @@ class ClusterUpdate(_serialization.Model):
:ivar redis_version: Version of redis the cluster supports, e.g. '6'.
:vartype redis_version: str
:ivar private_endpoint_connections: List of private endpoint connections associated with the
specified RedisEnterprise cluster.
specified Redis Enterprise cluster.
:vartype private_endpoint_connections:
list[~azure.mgmt.redisenterprise.models.PrivateEndpointConnection]
"""
@ -438,6 +596,7 @@ class ClusterUpdate(_serialization.Model):
_validation = {
"host_name": {"readonly": True},
"provisioning_state": {"readonly": True},
"redundancy_mode": {"readonly": True},
"resource_state": {"readonly": True},
"redis_version": {"readonly": True},
"private_endpoint_connections": {"readonly": True},
@ -447,10 +606,12 @@ class ClusterUpdate(_serialization.Model):
"sku": {"key": "sku", "type": "Sku"},
"identity": {"key": "identity", "type": "ManagedServiceIdentity"},
"tags": {"key": "tags", "type": "{str}"},
"high_availability": {"key": "properties.highAvailability", "type": "str"},
"minimum_tls_version": {"key": "properties.minimumTlsVersion", "type": "str"},
"encryption": {"key": "properties.encryption", "type": "ClusterPropertiesEncryption"},
"host_name": {"key": "properties.hostName", "type": "str"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"redundancy_mode": {"key": "properties.redundancyMode", "type": "str"},
"resource_state": {"key": "properties.resourceState", "type": "str"},
"redis_version": {"key": "properties.redisVersion", "type": "str"},
"private_endpoint_connections": {
@ -465,6 +626,7 @@ class ClusterUpdate(_serialization.Model):
sku: Optional["_models.Sku"] = None,
identity: Optional["_models.ManagedServiceIdentity"] = None,
tags: Optional[Dict[str, str]] = None,
high_availability: Optional[Union[str, "_models.HighAvailability"]] = None,
minimum_tls_version: Optional[Union[str, "_models.TlsVersion"]] = None,
encryption: Optional["_models.ClusterPropertiesEncryption"] = None,
**kwargs: Any
@ -476,8 +638,14 @@ class ClusterUpdate(_serialization.Model):
:paramtype identity: ~azure.mgmt.redisenterprise.models.ManagedServiceIdentity
:keyword tags: Resource tags.
:paramtype tags: dict[str, str]
:keyword high_availability: Enabled by default. If highAvailability is disabled, the data set
is not replicated. This affects the availability SLA, and increases the risk of data loss.
Known values are: "Enabled" and "Disabled".
:paramtype high_availability: str or ~azure.mgmt.redisenterprise.models.HighAvailability
:keyword minimum_tls_version: The minimum TLS version for the cluster to support, e.g. '1.2'.
Known values are: "1.0", "1.1", and "1.2".
Newer versions can be added in the future. Note that TLS 1.0 and TLS 1.1 are now completely
obsolete -- you cannot use them. They are mentioned only for the sake of consistency with old
API versions. Known values are: "1.0", "1.1", and "1.2".
:paramtype minimum_tls_version: str or ~azure.mgmt.redisenterprise.models.TlsVersion
:keyword encryption: Encryption-at-rest configuration for the cluster.
:paramtype encryption: ~azure.mgmt.redisenterprise.models.ClusterPropertiesEncryption
@ -486,16 +654,59 @@ class ClusterUpdate(_serialization.Model):
self.sku = sku
self.identity = identity
self.tags = tags
self.high_availability = high_availability
self.minimum_tls_version = minimum_tls_version
self.encryption = encryption
self.host_name = None
self.provisioning_state = None
self.redundancy_mode = None
self.resource_state = None
self.redis_version = None
self.private_endpoint_connections = None
class ProxyResource(Resource):
class ResourceAutoGenerated(_serialization.Model):
"""Common fields that are returned in the response for all Azure Resource Manager resources.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
information.
:vartype system_data: ~azure.mgmt.redisenterprise.models.SystemData
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"system_data": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"system_data": {"key": "systemData", "type": "SystemData"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.id = None
self.name = None
self.type = None
self.system_data = None
class ProxyResource(ResourceAutoGenerated):
"""The resource model definition for a Azure Resource Manager proxy resource. It will not have
tags and a location.
@ -509,11 +720,14 @@ class ProxyResource(Resource):
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
information.
:vartype system_data: ~azure.mgmt.redisenterprise.models.SystemData
"""
class Database(ProxyResource): # pylint: disable=too-many-instance-attributes
"""Describes a database on the RedisEnterprise cluster.
"""Describes a database on the Redis Enterprise cluster.
Variables are only populated by the server, and will be ignored when sending a request.
@ -525,6 +739,9 @@ class Database(ProxyResource): # pylint: disable=too-many-instance-attributes
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
information.
:vartype system_data: ~azure.mgmt.redisenterprise.models.SystemData
:ivar client_protocol: Specifies whether redis clients can connect using TLS-encrypted or
plaintext redis protocols. Default is TLS-encrypted. Known values are: "Encrypted" and
"Plaintext".
@ -539,8 +756,9 @@ class Database(ProxyResource): # pylint: disable=too-many-instance-attributes
"Creating", "CreateFailed", "Updating", "UpdateFailed", "Deleting", "DeleteFailed", "Enabling",
"EnableFailed", "Disabling", "DisableFailed", "Disabled", "Scaling", and "ScalingFailed".
:vartype resource_state: str or ~azure.mgmt.redisenterprise.models.ResourceState
:ivar clustering_policy: Clustering policy - default is OSSCluster. Specified at create time.
Known values are: "EnterpriseCluster" and "OSSCluster".
:ivar clustering_policy: Clustering policy - default is OSSCluster. This property must be
chosen at create time, and cannot be changed without deleting the database. Known values are:
"EnterpriseCluster" and "OSSCluster".
:vartype clustering_policy: str or ~azure.mgmt.redisenterprise.models.ClusteringPolicy
:ivar eviction_policy: Redis eviction policy - default is VolatileLRU. Known values are:
"AllKeysLFU", "AllKeysLRU", "AllKeysRandom", "VolatileLRU", "VolatileLFU", "VolatileTTL",
@ -557,15 +775,21 @@ class Database(ProxyResource): # pylint: disable=too-many-instance-attributes
:ivar redis_version: Version of Redis the database is running on, e.g. '6.0'.
:vartype redis_version: str
:ivar defer_upgrade: Option to defer upgrade when newest version is released - default is
NotDeferred. Learn more: https://aka.ms/redisversionupgrade. Known values are: "Deferred" and
NotDeferred. Learn more: https://aka.ms/redisversionupgrade. Known values are: "Deferred" and
"NotDeferred".
:vartype defer_upgrade: str or ~azure.mgmt.redisenterprise.models.DeferUpgradeSetting
:ivar access_keys_authentication: This property can be Enabled/Disabled to allow or deny access
with the current access keys. Can be updated even after database is created. Known values are:
"Disabled" and "Enabled".
:vartype access_keys_authentication: str or
~azure.mgmt.redisenterprise.models.AccessKeysAuthentication
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"system_data": {"readonly": True},
"provisioning_state": {"readonly": True},
"resource_state": {"readonly": True},
"redis_version": {"readonly": True},
@ -575,6 +799,7 @@ class Database(ProxyResource): # pylint: disable=too-many-instance-attributes
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"system_data": {"key": "systemData", "type": "SystemData"},
"client_protocol": {"key": "properties.clientProtocol", "type": "str"},
"port": {"key": "properties.port", "type": "int"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
@ -586,6 +811,7 @@ class Database(ProxyResource): # pylint: disable=too-many-instance-attributes
"geo_replication": {"key": "properties.geoReplication", "type": "DatabasePropertiesGeoReplication"},
"redis_version": {"key": "properties.redisVersion", "type": "str"},
"defer_upgrade": {"key": "properties.deferUpgrade", "type": "str"},
"access_keys_authentication": {"key": "properties.accessKeysAuthentication", "type": "str"},
}
def __init__(
@ -599,6 +825,7 @@ class Database(ProxyResource): # pylint: disable=too-many-instance-attributes
modules: Optional[List["_models.Module"]] = None,
geo_replication: Optional["_models.DatabasePropertiesGeoReplication"] = None,
defer_upgrade: Optional[Union[str, "_models.DeferUpgradeSetting"]] = None,
access_keys_authentication: Optional[Union[str, "_models.AccessKeysAuthentication"]] = None,
**kwargs: Any
) -> None:
"""
@ -609,8 +836,9 @@ class Database(ProxyResource): # pylint: disable=too-many-instance-attributes
:keyword port: TCP port of the database endpoint. Specified at create time. Defaults to an
available port.
:paramtype port: int
:keyword clustering_policy: Clustering policy - default is OSSCluster. Specified at create
time. Known values are: "EnterpriseCluster" and "OSSCluster".
:keyword clustering_policy: Clustering policy - default is OSSCluster. This property must be
chosen at create time, and cannot be changed without deleting the database. Known values are:
"EnterpriseCluster" and "OSSCluster".
:paramtype clustering_policy: str or ~azure.mgmt.redisenterprise.models.ClusteringPolicy
:keyword eviction_policy: Redis eviction policy - default is VolatileLRU. Known values are:
"AllKeysLFU", "AllKeysLRU", "AllKeysRandom", "VolatileLRU", "VolatileLFU", "VolatileTTL",
@ -625,9 +853,14 @@ class Database(ProxyResource): # pylint: disable=too-many-instance-attributes
database.
:paramtype geo_replication: ~azure.mgmt.redisenterprise.models.DatabasePropertiesGeoReplication
:keyword defer_upgrade: Option to defer upgrade when newest version is released - default is
NotDeferred. Learn more: https://aka.ms/redisversionupgrade. Known values are: "Deferred" and
NotDeferred. Learn more: https://aka.ms/redisversionupgrade. Known values are: "Deferred" and
"NotDeferred".
:paramtype defer_upgrade: str or ~azure.mgmt.redisenterprise.models.DeferUpgradeSetting
:keyword access_keys_authentication: This property can be Enabled/Disabled to allow or deny
access with the current access keys. Can be updated even after database is created. Known
values are: "Disabled" and "Enabled".
:paramtype access_keys_authentication: str or
~azure.mgmt.redisenterprise.models.AccessKeysAuthentication
"""
super().__init__(**kwargs)
self.client_protocol = client_protocol
@ -641,6 +874,7 @@ class Database(ProxyResource): # pylint: disable=too-many-instance-attributes
self.geo_replication = geo_replication
self.redis_version = None
self.defer_upgrade = defer_upgrade
self.access_keys_authentication = access_keys_authentication
class DatabaseList(_serialization.Model):
@ -706,7 +940,7 @@ class DatabasePropertiesGeoReplication(_serialization.Model):
class DatabaseUpdate(_serialization.Model): # pylint: disable=too-many-instance-attributes
"""A partial update to the RedisEnterprise database.
"""A partial update to the Redis Enterprise database.
Variables are only populated by the server, and will be ignored when sending a request.
@ -724,8 +958,9 @@ class DatabaseUpdate(_serialization.Model): # pylint: disable=too-many-instance
"Creating", "CreateFailed", "Updating", "UpdateFailed", "Deleting", "DeleteFailed", "Enabling",
"EnableFailed", "Disabling", "DisableFailed", "Disabled", "Scaling", and "ScalingFailed".
:vartype resource_state: str or ~azure.mgmt.redisenterprise.models.ResourceState
:ivar clustering_policy: Clustering policy - default is OSSCluster. Specified at create time.
Known values are: "EnterpriseCluster" and "OSSCluster".
:ivar clustering_policy: Clustering policy - default is OSSCluster. This property must be
chosen at create time, and cannot be changed without deleting the database. Known values are:
"EnterpriseCluster" and "OSSCluster".
:vartype clustering_policy: str or ~azure.mgmt.redisenterprise.models.ClusteringPolicy
:ivar eviction_policy: Redis eviction policy - default is VolatileLRU. Known values are:
"AllKeysLFU", "AllKeysLRU", "AllKeysRandom", "VolatileLRU", "VolatileLFU", "VolatileTTL",
@ -742,9 +977,14 @@ class DatabaseUpdate(_serialization.Model): # pylint: disable=too-many-instance
:ivar redis_version: Version of Redis the database is running on, e.g. '6.0'.
:vartype redis_version: str
:ivar defer_upgrade: Option to defer upgrade when newest version is released - default is
NotDeferred. Learn more: https://aka.ms/redisversionupgrade. Known values are: "Deferred" and
NotDeferred. Learn more: https://aka.ms/redisversionupgrade. Known values are: "Deferred" and
"NotDeferred".
:vartype defer_upgrade: str or ~azure.mgmt.redisenterprise.models.DeferUpgradeSetting
:ivar access_keys_authentication: This property can be Enabled/Disabled to allow or deny access
with the current access keys. Can be updated even after database is created. Known values are:
"Disabled" and "Enabled".
:vartype access_keys_authentication: str or
~azure.mgmt.redisenterprise.models.AccessKeysAuthentication
"""
_validation = {
@ -765,6 +1005,7 @@ class DatabaseUpdate(_serialization.Model): # pylint: disable=too-many-instance
"geo_replication": {"key": "properties.geoReplication", "type": "DatabasePropertiesGeoReplication"},
"redis_version": {"key": "properties.redisVersion", "type": "str"},
"defer_upgrade": {"key": "properties.deferUpgrade", "type": "str"},
"access_keys_authentication": {"key": "properties.accessKeysAuthentication", "type": "str"},
}
def __init__(
@ -778,6 +1019,7 @@ class DatabaseUpdate(_serialization.Model): # pylint: disable=too-many-instance
modules: Optional[List["_models.Module"]] = None,
geo_replication: Optional["_models.DatabasePropertiesGeoReplication"] = None,
defer_upgrade: Optional[Union[str, "_models.DeferUpgradeSetting"]] = None,
access_keys_authentication: Optional[Union[str, "_models.AccessKeysAuthentication"]] = None,
**kwargs: Any
) -> None:
"""
@ -788,8 +1030,9 @@ class DatabaseUpdate(_serialization.Model): # pylint: disable=too-many-instance
:keyword port: TCP port of the database endpoint. Specified at create time. Defaults to an
available port.
:paramtype port: int
:keyword clustering_policy: Clustering policy - default is OSSCluster. Specified at create
time. Known values are: "EnterpriseCluster" and "OSSCluster".
:keyword clustering_policy: Clustering policy - default is OSSCluster. This property must be
chosen at create time, and cannot be changed without deleting the database. Known values are:
"EnterpriseCluster" and "OSSCluster".
:paramtype clustering_policy: str or ~azure.mgmt.redisenterprise.models.ClusteringPolicy
:keyword eviction_policy: Redis eviction policy - default is VolatileLRU. Known values are:
"AllKeysLFU", "AllKeysLRU", "AllKeysRandom", "VolatileLRU", "VolatileLFU", "VolatileTTL",
@ -804,9 +1047,14 @@ class DatabaseUpdate(_serialization.Model): # pylint: disable=too-many-instance
database.
:paramtype geo_replication: ~azure.mgmt.redisenterprise.models.DatabasePropertiesGeoReplication
:keyword defer_upgrade: Option to defer upgrade when newest version is released - default is
NotDeferred. Learn more: https://aka.ms/redisversionupgrade. Known values are: "Deferred" and
NotDeferred. Learn more: https://aka.ms/redisversionupgrade. Known values are: "Deferred" and
"NotDeferred".
:paramtype defer_upgrade: str or ~azure.mgmt.redisenterprise.models.DeferUpgradeSetting
:keyword access_keys_authentication: This property can be Enabled/Disabled to allow or deny
access with the current access keys. Can be updated even after database is created. Known
values are: "Disabled" and "Enabled".
:paramtype access_keys_authentication: str or
~azure.mgmt.redisenterprise.models.AccessKeysAuthentication
"""
super().__init__(**kwargs)
self.client_protocol = client_protocol
@ -820,6 +1068,7 @@ class DatabaseUpdate(_serialization.Model): # pylint: disable=too-many-instance
self.geo_replication = geo_replication
self.redis_version = None
self.defer_upgrade = defer_upgrade
self.access_keys_authentication = access_keys_authentication
class ErrorAdditionalInfo(_serialization.Model):
@ -1003,7 +1252,7 @@ class ForceLinkParameters(_serialization.Model):
class ForceUnlinkParameters(_serialization.Model):
"""Parameters for a Redis Enterprise Active Geo Replication Force Unlink operation.
"""Parameters for a redis enterprise active geo-replication force unlink operation.
All required parameters must be populated in order to send to server.
@ -1372,14 +1621,17 @@ class OperationStatus(_serialization.Model):
class Persistence(_serialization.Model):
"""Persistence-related configuration for the RedisEnterprise database.
"""Persistence-related configuration for the Redis Enterprise database.
:ivar aof_enabled: Sets whether AOF is enabled.
:ivar aof_enabled: Sets whether AOF is enabled. Note that at most one of AOF or RDB persistence
may be enabled.
:vartype aof_enabled: bool
:ivar rdb_enabled: Sets whether RDB is enabled.
:ivar rdb_enabled: Sets whether RDB is enabled. Note that at most one of AOF or RDB persistence
may be enabled.
:vartype rdb_enabled: bool
:ivar aof_frequency: Sets the frequency at which data is written to disk. Known values are:
"1s" and "always".
:ivar aof_frequency: Sets the frequency at which data is written to disk. Defaults to '1s',
meaning 'every second'. Note that the 'always' setting is deprecated, because of its
performance impact. Known values are: "1s" and "always".
:vartype aof_frequency: str or ~azure.mgmt.redisenterprise.models.AofFrequency
:ivar rdb_frequency: Sets the frequency at which a snapshot of the database is created. Known
values are: "1h", "6h", and "12h".
@ -1403,12 +1655,15 @@ class Persistence(_serialization.Model):
**kwargs: Any
) -> None:
"""
:keyword aof_enabled: Sets whether AOF is enabled.
:keyword aof_enabled: Sets whether AOF is enabled. Note that at most one of AOF or RDB
persistence may be enabled.
:paramtype aof_enabled: bool
:keyword rdb_enabled: Sets whether RDB is enabled.
:keyword rdb_enabled: Sets whether RDB is enabled. Note that at most one of AOF or RDB
persistence may be enabled.
:paramtype rdb_enabled: bool
:keyword aof_frequency: Sets the frequency at which data is written to disk. Known values are:
"1s" and "always".
:keyword aof_frequency: Sets the frequency at which data is written to disk. Defaults to '1s',
meaning 'every second'. Note that the 'always' setting is deprecated, because of its
performance impact. Known values are: "1s" and "always".
:paramtype aof_frequency: str or ~azure.mgmt.redisenterprise.models.AofFrequency
:keyword rdb_frequency: Sets the frequency at which a snapshot of the database is created.
Known values are: "1h", "6h", and "12h".
@ -1673,17 +1928,32 @@ class RegenerateKeyParameters(_serialization.Model):
class Sku(_serialization.Model):
"""SKU parameters supplied to the create RedisEnterprise operation.
"""SKU parameters supplied to the create Redis Enterprise cluster operation.
All required parameters must be populated in order to send to server.
:ivar name: The type of RedisEnterprise cluster to deploy. Possible values: (Enterprise_E10,
EnterpriseFlash_F300 etc.). Required. Known values are: "Enterprise_E5", "Enterprise_E10",
"Enterprise_E20", "Enterprise_E50", "Enterprise_E100", "EnterpriseFlash_F300",
"EnterpriseFlash_F700", and "EnterpriseFlash_F1500".
:ivar name: The level of Redis Enterprise cluster to deploy. Possible values: ('Balanced_B5',
'MemoryOptimized_M10', 'ComputeOptimized_X5', etc.). For more information on SKUs see the
latest pricing documentation. Note that additional SKUs may become supported in the future.
Required. Known values are: "Enterprise_E1", "Enterprise_E5", "Enterprise_E10",
"Enterprise_E20", "Enterprise_E50", "Enterprise_E100", "Enterprise_E200", "Enterprise_E400",
"EnterpriseFlash_F300", "EnterpriseFlash_F700", "EnterpriseFlash_F1500", "Balanced_B0",
"Balanced_B1", "Balanced_B3", "Balanced_B5", "Balanced_B10", "Balanced_B20", "Balanced_B50",
"Balanced_B100", "Balanced_B150", "Balanced_B250", "Balanced_B350", "Balanced_B500",
"Balanced_B700", "Balanced_B1000", "MemoryOptimized_M10", "MemoryOptimized_M20",
"MemoryOptimized_M50", "MemoryOptimized_M100", "MemoryOptimized_M150", "MemoryOptimized_M250",
"MemoryOptimized_M350", "MemoryOptimized_M500", "MemoryOptimized_M700",
"MemoryOptimized_M1000", "MemoryOptimized_M1500", "MemoryOptimized_M2000",
"ComputeOptimized_X3", "ComputeOptimized_X5", "ComputeOptimized_X10", "ComputeOptimized_X20",
"ComputeOptimized_X50", "ComputeOptimized_X100", "ComputeOptimized_X150",
"ComputeOptimized_X250", "ComputeOptimized_X350", "ComputeOptimized_X500",
"ComputeOptimized_X700", "FlashOptimized_A250", "FlashOptimized_A500", "FlashOptimized_A700",
"FlashOptimized_A1000", "FlashOptimized_A1500", "FlashOptimized_A2000", and
"FlashOptimized_A4500".
:vartype name: str or ~azure.mgmt.redisenterprise.models.SkuName
:ivar capacity: The size of the RedisEnterprise cluster. Defaults to 2 or 3 depending on SKU.
Valid values are (2, 4, 6, ...) for Enterprise SKUs and (3, 9, 15, ...) for Flash SKUs.
:ivar capacity: This property is only used with Enterprise and EnterpriseFlash SKUs. Determines
the size of the cluster. Valid values are (2, 4, 6, ...) for Enterprise SKUs and (3, 9, 15,
...) for EnterpriseFlash SKUs.
:vartype capacity: int
"""
@ -1698,13 +1968,28 @@ class Sku(_serialization.Model):
def __init__(self, *, name: Union[str, "_models.SkuName"], capacity: Optional[int] = None, **kwargs: Any) -> None:
"""
:keyword name: The type of RedisEnterprise cluster to deploy. Possible values: (Enterprise_E10,
EnterpriseFlash_F300 etc.). Required. Known values are: "Enterprise_E5", "Enterprise_E10",
"Enterprise_E20", "Enterprise_E50", "Enterprise_E100", "EnterpriseFlash_F300",
"EnterpriseFlash_F700", and "EnterpriseFlash_F1500".
:keyword name: The level of Redis Enterprise cluster to deploy. Possible values:
('Balanced_B5', 'MemoryOptimized_M10', 'ComputeOptimized_X5', etc.). For more information on
SKUs see the latest pricing documentation. Note that additional SKUs may become supported in
the future. Required. Known values are: "Enterprise_E1", "Enterprise_E5", "Enterprise_E10",
"Enterprise_E20", "Enterprise_E50", "Enterprise_E100", "Enterprise_E200", "Enterprise_E400",
"EnterpriseFlash_F300", "EnterpriseFlash_F700", "EnterpriseFlash_F1500", "Balanced_B0",
"Balanced_B1", "Balanced_B3", "Balanced_B5", "Balanced_B10", "Balanced_B20", "Balanced_B50",
"Balanced_B100", "Balanced_B150", "Balanced_B250", "Balanced_B350", "Balanced_B500",
"Balanced_B700", "Balanced_B1000", "MemoryOptimized_M10", "MemoryOptimized_M20",
"MemoryOptimized_M50", "MemoryOptimized_M100", "MemoryOptimized_M150", "MemoryOptimized_M250",
"MemoryOptimized_M350", "MemoryOptimized_M500", "MemoryOptimized_M700",
"MemoryOptimized_M1000", "MemoryOptimized_M1500", "MemoryOptimized_M2000",
"ComputeOptimized_X3", "ComputeOptimized_X5", "ComputeOptimized_X10", "ComputeOptimized_X20",
"ComputeOptimized_X50", "ComputeOptimized_X100", "ComputeOptimized_X150",
"ComputeOptimized_X250", "ComputeOptimized_X350", "ComputeOptimized_X500",
"ComputeOptimized_X700", "FlashOptimized_A250", "FlashOptimized_A500", "FlashOptimized_A700",
"FlashOptimized_A1000", "FlashOptimized_A1500", "FlashOptimized_A2000", and
"FlashOptimized_A4500".
:paramtype name: str or ~azure.mgmt.redisenterprise.models.SkuName
:keyword capacity: The size of the RedisEnterprise cluster. Defaults to 2 or 3 depending on
SKU. Valid values are (2, 4, 6, ...) for Enterprise SKUs and (3, 9, 15, ...) for Flash SKUs.
:keyword capacity: This property is only used with Enterprise and EnterpriseFlash SKUs.
Determines the size of the cluster. Valid values are (2, 4, 6, ...) for Enterprise SKUs and (3,
9, 15, ...) for EnterpriseFlash SKUs.
:paramtype capacity: int
"""
super().__init__(**kwargs)
@ -1712,6 +1997,70 @@ class Sku(_serialization.Model):
self.capacity = capacity
class SystemData(_serialization.Model):
"""Metadata pertaining to creation and last modification of the resource.
:ivar created_by: The identity that created the resource.
:vartype created_by: str
:ivar created_by_type: The type of identity that created the resource. Known values are:
"User", "Application", "ManagedIdentity", and "Key".
:vartype created_by_type: str or ~azure.mgmt.redisenterprise.models.CreatedByType
:ivar created_at: The timestamp of resource creation (UTC).
:vartype created_at: ~datetime.datetime
:ivar last_modified_by: The identity that last modified the resource.
:vartype last_modified_by: str
:ivar last_modified_by_type: The type of identity that last modified the resource. Known values
are: "User", "Application", "ManagedIdentity", and "Key".
:vartype last_modified_by_type: str or ~azure.mgmt.redisenterprise.models.CreatedByType
:ivar last_modified_at: The timestamp of resource last modification (UTC).
:vartype last_modified_at: ~datetime.datetime
"""
_attribute_map = {
"created_by": {"key": "createdBy", "type": "str"},
"created_by_type": {"key": "createdByType", "type": "str"},
"created_at": {"key": "createdAt", "type": "iso-8601"},
"last_modified_by": {"key": "lastModifiedBy", "type": "str"},
"last_modified_by_type": {"key": "lastModifiedByType", "type": "str"},
"last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"},
}
def __init__(
self,
*,
created_by: Optional[str] = None,
created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None,
created_at: Optional[datetime.datetime] = None,
last_modified_by: Optional[str] = None,
last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None,
last_modified_at: Optional[datetime.datetime] = None,
**kwargs: Any
) -> None:
"""
:keyword created_by: The identity that created the resource.
:paramtype created_by: str
:keyword created_by_type: The type of identity that created the resource. Known values are:
"User", "Application", "ManagedIdentity", and "Key".
:paramtype created_by_type: str or ~azure.mgmt.redisenterprise.models.CreatedByType
:keyword created_at: The timestamp of resource creation (UTC).
:paramtype created_at: ~datetime.datetime
:keyword last_modified_by: The identity that last modified the resource.
:paramtype last_modified_by: str
:keyword last_modified_by_type: The type of identity that last modified the resource. Known
values are: "User", "Application", "ManagedIdentity", and "Key".
:paramtype last_modified_by_type: str or ~azure.mgmt.redisenterprise.models.CreatedByType
:keyword last_modified_at: The timestamp of resource last modification (UTC).
:paramtype last_modified_at: ~datetime.datetime
"""
super().__init__(**kwargs)
self.created_by = created_by
self.created_by_type = created_by_type
self.created_at = created_at
self.last_modified_by = last_modified_by
self.last_modified_by_type = last_modified_by_type
self.last_modified_at = last_modified_at
class UserAssignedIdentity(_serialization.Model):
"""User assigned identity properties.

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

@ -10,6 +10,15 @@ from enum import Enum
from azure.core import CaseInsensitiveEnumMeta
class AccessKeysAuthentication(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""This property can be Enabled/Disabled to allow or deny access with the current access keys. Can
be updated even after database is created.
"""
DISABLED = "Disabled"
ENABLED = "Enabled"
class AccessKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Which access key to regenerate."""
@ -24,17 +33,25 @@ class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
class AofFrequency(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Sets the frequency at which data is written to disk."""
"""Sets the frequency at which data is written to disk. Defaults to '1s', meaning 'every second'.
Note that the 'always' setting is deprecated, because of its performance impact.
"""
ONE_S = "1s"
ALWAYS = "always"
class ClusteringPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Clustering policy - default is OSSCluster. Specified at create time."""
"""Clustering policy - default is OSSCluster. This property must be chosen at create time, and
cannot be changed without deleting the database.
"""
ENTERPRISE_CLUSTER = "EnterpriseCluster"
"""Enterprise clustering policy uses only the classic redis protocol, which does not support redis
cluster commands."""
OSS_CLUSTER = "OSSCluster"
"""OSS clustering policy follows the redis cluster specification, and requires all clients to
support redis clustering."""
class CmkIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@ -46,6 +63,15 @@ class CmkIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
USER_ASSIGNED_IDENTITY = "userAssignedIdentity"
class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The type of identity that created the resource."""
USER = "User"
APPLICATION = "Application"
MANAGED_IDENTITY = "ManagedIdentity"
KEY = "Key"
class DeferUpgradeSetting(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Option to defer upgrade when newest version is released - default is NotDeferred. Learn more:
https://aka.ms/redisversionupgrade.
@ -68,6 +94,15 @@ class EvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta):
NO_EVICTION = "NoEviction"
class HighAvailability(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Enabled by default. If highAvailability is disabled, the data set is not replicated. This
affects the availability SLA, and increases the risk of data loss.
"""
ENABLED = "Enabled"
DISABLED = "Disabled"
class LinkState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""State of the link between the database resources."""
@ -144,6 +179,17 @@ class RdbFrequency(str, Enum, metaclass=CaseInsensitiveEnumMeta):
TWELVE_H = "12h"
class RedundancyMode(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Explains the current redundancy strategy of the cluster, which affects the expected SLA."""
NONE = "None"
"""No redundancy. Availability loss will occur."""
LR = "LR"
"""Local redundancy with high availability."""
ZR = "ZR"
"""Zone redundant. Higher availability."""
class ResourceState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Current resource status."""
@ -164,22 +210,73 @@ class ResourceState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The type of RedisEnterprise cluster to deploy. Possible values: (Enterprise_E10,
EnterpriseFlash_F300 etc.).
"""The level of Redis Enterprise cluster to deploy. Possible values: ('Balanced_B5',
'MemoryOptimized_M10', 'ComputeOptimized_X5', etc.). For more information on SKUs see the
latest pricing documentation. Note that additional SKUs may become supported in the future.
"""
ENTERPRISE_E1 = "Enterprise_E1"
ENTERPRISE_E5 = "Enterprise_E5"
ENTERPRISE_E10 = "Enterprise_E10"
ENTERPRISE_E20 = "Enterprise_E20"
ENTERPRISE_E50 = "Enterprise_E50"
ENTERPRISE_E100 = "Enterprise_E100"
ENTERPRISE_E200 = "Enterprise_E200"
ENTERPRISE_E400 = "Enterprise_E400"
ENTERPRISE_FLASH_F300 = "EnterpriseFlash_F300"
ENTERPRISE_FLASH_F700 = "EnterpriseFlash_F700"
ENTERPRISE_FLASH_F1500 = "EnterpriseFlash_F1500"
BALANCED_B0 = "Balanced_B0"
BALANCED_B1 = "Balanced_B1"
BALANCED_B3 = "Balanced_B3"
BALANCED_B5 = "Balanced_B5"
BALANCED_B10 = "Balanced_B10"
BALANCED_B20 = "Balanced_B20"
BALANCED_B50 = "Balanced_B50"
BALANCED_B100 = "Balanced_B100"
BALANCED_B150 = "Balanced_B150"
BALANCED_B250 = "Balanced_B250"
BALANCED_B350 = "Balanced_B350"
BALANCED_B500 = "Balanced_B500"
BALANCED_B700 = "Balanced_B700"
BALANCED_B1000 = "Balanced_B1000"
MEMORY_OPTIMIZED_M10 = "MemoryOptimized_M10"
MEMORY_OPTIMIZED_M20 = "MemoryOptimized_M20"
MEMORY_OPTIMIZED_M50 = "MemoryOptimized_M50"
MEMORY_OPTIMIZED_M100 = "MemoryOptimized_M100"
MEMORY_OPTIMIZED_M150 = "MemoryOptimized_M150"
MEMORY_OPTIMIZED_M250 = "MemoryOptimized_M250"
MEMORY_OPTIMIZED_M350 = "MemoryOptimized_M350"
MEMORY_OPTIMIZED_M500 = "MemoryOptimized_M500"
MEMORY_OPTIMIZED_M700 = "MemoryOptimized_M700"
MEMORY_OPTIMIZED_M1000 = "MemoryOptimized_M1000"
MEMORY_OPTIMIZED_M1500 = "MemoryOptimized_M1500"
MEMORY_OPTIMIZED_M2000 = "MemoryOptimized_M2000"
COMPUTE_OPTIMIZED_X3 = "ComputeOptimized_X3"
COMPUTE_OPTIMIZED_X5 = "ComputeOptimized_X5"
COMPUTE_OPTIMIZED_X10 = "ComputeOptimized_X10"
COMPUTE_OPTIMIZED_X20 = "ComputeOptimized_X20"
COMPUTE_OPTIMIZED_X50 = "ComputeOptimized_X50"
COMPUTE_OPTIMIZED_X100 = "ComputeOptimized_X100"
COMPUTE_OPTIMIZED_X150 = "ComputeOptimized_X150"
COMPUTE_OPTIMIZED_X250 = "ComputeOptimized_X250"
COMPUTE_OPTIMIZED_X350 = "ComputeOptimized_X350"
COMPUTE_OPTIMIZED_X500 = "ComputeOptimized_X500"
COMPUTE_OPTIMIZED_X700 = "ComputeOptimized_X700"
FLASH_OPTIMIZED_A250 = "FlashOptimized_A250"
FLASH_OPTIMIZED_A500 = "FlashOptimized_A500"
FLASH_OPTIMIZED_A700 = "FlashOptimized_A700"
FLASH_OPTIMIZED_A1000 = "FlashOptimized_A1000"
FLASH_OPTIMIZED_A1500 = "FlashOptimized_A1500"
FLASH_OPTIMIZED_A2000 = "FlashOptimized_A2000"
FLASH_OPTIMIZED_A4500 = "FlashOptimized_A4500"
class TlsVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The minimum TLS version for the cluster to support, e.g. '1.2'."""
"""The minimum TLS version for the cluster to support, e.g. '1.2'. Newer versions can be added in
the future. Note that TLS 1.0 and TLS 1.1 are now completely obsolete -- you cannot use them.
They are mentioned only for the sake of consistency with old API versions.
"""
ONE0 = "1.0"
ONE1 = "1.1"

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

@ -10,6 +10,7 @@ from ._operations import Operations
from ._operations_status_operations import OperationsStatusOperations
from ._redis_enterprise_operations import RedisEnterpriseOperations
from ._databases_operations import DatabasesOperations
from ._access_policy_assignment_operations import AccessPolicyAssignmentOperations
from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations
from ._private_link_resources_operations import PrivateLinkResourcesOperations
@ -22,6 +23,7 @@ __all__ = [
"OperationsStatusOperations",
"RedisEnterpriseOperations",
"DatabasesOperations",
"AccessPolicyAssignmentOperations",
"PrivateEndpointConnectionsOperations",
"PrivateLinkResourcesOperations",
]

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

@ -0,0 +1,746 @@
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
import sys
from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
StreamClosedError,
StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_create_update_request(
resource_group_name: str,
cluster_name: str,
database_name: str,
access_policy_assignment_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/accessPolicyAssignments/{accessPolicyAssignmentName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"),
"databaseName": _SERIALIZER.url("database_name", database_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"),
"accessPolicyAssignmentName": _SERIALIZER.url(
"access_policy_assignment_name", access_policy_assignment_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_request(
resource_group_name: str,
cluster_name: str,
database_name: str,
access_policy_assignment_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/accessPolicyAssignments/{accessPolicyAssignmentName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"),
"databaseName": _SERIALIZER.url("database_name", database_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"),
"accessPolicyAssignmentName": _SERIALIZER.url(
"access_policy_assignment_name", access_policy_assignment_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_request(
resource_group_name: str,
cluster_name: str,
database_name: str,
access_policy_assignment_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/accessPolicyAssignments/{accessPolicyAssignmentName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"),
"databaseName": _SERIALIZER.url("database_name", database_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"),
"accessPolicyAssignmentName": _SERIALIZER.url(
"access_policy_assignment_name", access_policy_assignment_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_request(
resource_group_name: str, cluster_name: str, database_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/accessPolicyAssignments",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"),
"databaseName": _SERIALIZER.url("database_name", database_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
class AccessPolicyAssignmentOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.redisenterprise.RedisEnterpriseManagementClient`'s
:attr:`access_policy_assignment` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
def _create_update_initial(
self,
resource_group_name: str,
cluster_name: str,
database_name: str,
access_policy_assignment_name: str,
parameters: Union[_models.AccessPolicyAssignment, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "AccessPolicyAssignment")
_request = build_create_update_request(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
database_name=database_name,
access_policy_assignment_name=access_policy_assignment_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
@overload
def begin_create_update(
self,
resource_group_name: str,
cluster_name: str,
database_name: str,
access_policy_assignment_name: str,
parameters: _models.AccessPolicyAssignment,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.AccessPolicyAssignment]:
"""Creates/Updates a particular access policy assignment for a database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: The name of the Redis Enterprise cluster. Required.
:type cluster_name: str
:param database_name: The name of the Redis Enterprise database. Required.
:type database_name: str
:param access_policy_assignment_name: The name of the Redis Enterprise database access policy
assignment. Required.
:type access_policy_assignment_name: str
:param parameters: Parameters supplied to the create access policy assignment for database.
Required.
:type parameters: ~azure.mgmt.redisenterprise.models.AccessPolicyAssignment
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either AccessPolicyAssignment or the result of
cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.redisenterprise.models.AccessPolicyAssignment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_update(
self,
resource_group_name: str,
cluster_name: str,
database_name: str,
access_policy_assignment_name: str,
parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.AccessPolicyAssignment]:
"""Creates/Updates a particular access policy assignment for a database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: The name of the Redis Enterprise cluster. Required.
:type cluster_name: str
:param database_name: The name of the Redis Enterprise database. Required.
:type database_name: str
:param access_policy_assignment_name: The name of the Redis Enterprise database access policy
assignment. Required.
:type access_policy_assignment_name: str
:param parameters: Parameters supplied to the create access policy assignment for database.
Required.
:type parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either AccessPolicyAssignment or the result of
cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.redisenterprise.models.AccessPolicyAssignment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_update(
self,
resource_group_name: str,
cluster_name: str,
database_name: str,
access_policy_assignment_name: str,
parameters: Union[_models.AccessPolicyAssignment, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.AccessPolicyAssignment]:
"""Creates/Updates a particular access policy assignment for a database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: The name of the Redis Enterprise cluster. Required.
:type cluster_name: str
:param database_name: The name of the Redis Enterprise database. Required.
:type database_name: str
:param access_policy_assignment_name: The name of the Redis Enterprise database access policy
assignment. Required.
:type access_policy_assignment_name: str
:param parameters: Parameters supplied to the create access policy assignment for database. Is
either a AccessPolicyAssignment type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.redisenterprise.models.AccessPolicyAssignment or IO[bytes]
:return: An instance of LROPoller that returns either AccessPolicyAssignment or the result of
cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.redisenterprise.models.AccessPolicyAssignment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.AccessPolicyAssignment] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_update_initial(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
database_name=database_name,
access_policy_assignment_name=access_policy_assignment_name,
parameters=parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("AccessPolicyAssignment", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(
PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs)
)
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.AccessPolicyAssignment].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.AccessPolicyAssignment](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
@distributed_trace
def get(
self,
resource_group_name: str,
cluster_name: str,
database_name: str,
access_policy_assignment_name: str,
**kwargs: Any
) -> _models.AccessPolicyAssignment:
"""Gets information about access policy assignment for database.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: The name of the Redis Enterprise cluster. Required.
:type cluster_name: str
:param database_name: The name of the Redis Enterprise database. Required.
:type database_name: str
:param access_policy_assignment_name: The name of the Redis Enterprise database access policy
assignment. Required.
:type access_policy_assignment_name: str
:return: AccessPolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.redisenterprise.models.AccessPolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.AccessPolicyAssignment] = kwargs.pop("cls", None)
_request = build_get_request(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
database_name=database_name,
access_policy_assignment_name=access_policy_assignment_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("AccessPolicyAssignment", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _delete_initial(
self,
resource_group_name: str,
cluster_name: str,
database_name: str,
access_policy_assignment_name: str,
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
database_name=database_name,
access_policy_assignment_name=access_policy_assignment_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [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)
response_headers = {}
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
response_headers["Azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("Azure-AsyncOperation")
)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_delete(
self,
resource_group_name: str,
cluster_name: str,
database_name: str,
access_policy_assignment_name: str,
**kwargs: Any
) -> LROPoller[None]:
"""Deletes a single access policy assignment.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: The name of the Redis Enterprise cluster. Required.
:type cluster_name: str
:param database_name: The name of the Redis Enterprise database. Required.
:type database_name: str
:param access_policy_assignment_name: The name of the Redis Enterprise database access policy
assignment. Required.
:type access_policy_assignment_name: str
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
database_name=database_name,
access_policy_assignment_name=access_policy_assignment_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(
PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs)
)
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
self, resource_group_name: str, cluster_name: str, database_name: str, **kwargs: Any
) -> Iterable["_models.AccessPolicyAssignment"]:
"""Gets all access policy assignments..
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: The name of the Redis Enterprise cluster. Required.
:type cluster_name: str
:param database_name: The name of the Redis Enterprise database. Required.
:type database_name: str
:return: An iterator like instance of either AccessPolicyAssignment or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redisenterprise.models.AccessPolicyAssignment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.AccessPolicyAssignmentList] = kwargs.pop("cls", None)
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_request(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
database_name=database_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("AccessPolicyAssignmentList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)

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

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

@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import sys
from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@ -19,16 +20,18 @@ from azure.core.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
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@ -40,7 +43,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -88,7 +91,7 @@ class Operations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -104,7 +107,6 @@ class Operations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -120,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

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

@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, Callable, Dict, Optional, TypeVar
import sys
from typing import Any, Callable, Dict, Optional, Type, TypeVar
from azure.core.exceptions import (
ClientAuthenticationError,
@ -17,16 +18,18 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.rest import HttpRequest
from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@ -38,7 +41,7 @@ def build_get_request(location: str, operation_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-03-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -94,7 +97,7 @@ class OperationsStatusOperations:
:rtype: ~azure.mgmt.redisenterprise.models.OperationStatus
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -116,7 +119,6 @@ class OperationsStatusOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -131,7 +133,7 @@ class OperationsStatusOperations:
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("OperationStatus", pipeline_response)
deserialized = self._deserialize("OperationStatus", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore

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

@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import sys
from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@ -16,13 +17,14 @@ 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
@ -30,8 +32,11 @@ 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
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@ -43,7 +48,7 @@ def build_list_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-03-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -80,7 +85,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -120,7 +125,7 @@ def build_put_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -163,7 +168,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-03-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -216,7 +221,7 @@ class PrivateEndpointConnectionsOperations:
def list(
self, resource_group_name: str, cluster_name: str, **kwargs: Any
) -> Iterable["_models.PrivateEndpointConnection"]:
"""Lists all the private endpoint connections associated with the RedisEnterprise cluster.
"""Lists all the private endpoint connections associated with the Redis Enterprise cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
@ -235,7 +240,7 @@ class PrivateEndpointConnectionsOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -254,7 +259,6 @@ class PrivateEndpointConnectionsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -270,7 +274,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
@ -304,7 +307,7 @@ class PrivateEndpointConnectionsOperations:
def get(
self, resource_group_name: str, cluster_name: str, private_endpoint_connection_name: str, **kwargs: Any
) -> _models.PrivateEndpointConnection:
"""Gets the specified private endpoint connection associated with the RedisEnterprise cluster.
"""Gets the specified private endpoint connection associated with the Redis Enterprise cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
@ -318,7 +321,7 @@ class PrivateEndpointConnectionsOperations:
:rtype: ~azure.mgmt.redisenterprise.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -341,7 +344,6 @@ class PrivateEndpointConnectionsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -356,7 +358,7 @@ class PrivateEndpointConnectionsOperations:
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -370,8 +372,8 @@ class PrivateEndpointConnectionsOperations:
private_endpoint_connection_name: str,
properties: Union[_models.PrivateEndpointConnection, IO[bytes]],
**kwargs: Any
) -> _models.PrivateEndpointConnection:
error_map = {
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -384,7 +386,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[_models.PrivateEndpointConnection] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -406,10 +408,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
)
@ -417,11 +419,15 @@ class PrivateEndpointConnectionsOperations:
response = pipeline_response.http_response
if response.status_code not in [201]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -439,8 +445,8 @@ class PrivateEndpointConnectionsOperations:
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PrivateEndpointConnection]:
"""Updates the state of the specified private endpoint connection associated with the
RedisEnterprise cluster.
"""Updates the state of the specified private endpoint connection associated with the Redis
Enterprise cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
@ -473,8 +479,8 @@ class PrivateEndpointConnectionsOperations:
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PrivateEndpointConnection]:
"""Updates the state of the specified private endpoint connection associated with the
RedisEnterprise cluster.
"""Updates the state of the specified private endpoint connection associated with the Redis
Enterprise cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
@ -505,8 +511,8 @@ class PrivateEndpointConnectionsOperations:
properties: Union[_models.PrivateEndpointConnection, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.PrivateEndpointConnection]:
"""Updates the state of the specified private endpoint connection associated with the
RedisEnterprise cluster.
"""Updates the state of the specified private endpoint connection associated with the Redis
Enterprise cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
@ -547,10 +553,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
@ -572,10 +579,10 @@ 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, cluster_name: str, private_endpoint_connection_name: str, **kwargs: Any
) -> None:
error_map = {
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -587,7 +594,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,
@ -598,10 +605,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
)
@ -609,6 +616,10 @@ class PrivateEndpointConnectionsOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
@ -620,14 +631,18 @@ class PrivateEndpointConnectionsOperations:
"str", response.headers.get("Azure-AsyncOperation")
)
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, cluster_name: str, private_endpoint_connection_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Deletes the specified private endpoint connection associated with the RedisEnterprise cluster.
"""Deletes the specified private endpoint connection associated with the Redis Enterprise cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
@ -650,7 +665,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,
cluster_name=cluster_name,
private_endpoint_connection_name=private_endpoint_connection_name,
@ -660,6 +675,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

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

@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import sys
from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@ -19,16 +20,18 @@ from azure.core.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
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@ -42,7 +45,7 @@ def build_list_by_cluster_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -92,7 +95,7 @@ class PrivateLinkResourcesOperations:
def list_by_cluster(
self, resource_group_name: str, cluster_name: str, **kwargs: Any
) -> Iterable["_models.PrivateLinkResource"]:
"""Gets the private link resources that need to be created for a RedisEnterprise cluster.
"""Gets the private link resources that need to be created for a Redis Enterprise cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
@ -109,7 +112,7 @@ class PrivateLinkResourcesOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -128,7 +131,6 @@ class PrivateLinkResourcesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -144,7 +146,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

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

@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import sys
from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@ -16,13 +17,14 @@ 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
@ -30,8 +32,11 @@ 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
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@ -45,7 +50,7 @@ def build_create_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -81,7 +86,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -117,7 +122,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -148,7 +153,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-03-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -179,7 +184,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-03-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -209,7 +214,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-03-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -250,8 +255,8 @@ class RedisEnterpriseOperations:
def _create_initial(
self, resource_group_name: str, cluster_name: str, parameters: Union[_models.Cluster, IO[bytes]], **kwargs: Any
) -> _models.Cluster:
error_map = {
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -264,7 +269,7 @@ class RedisEnterpriseOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Cluster] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -285,10 +290,10 @@ class RedisEnterpriseOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -296,15 +301,15 @@ class RedisEnterpriseOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("Cluster", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("Cluster", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -328,7 +333,7 @@ class RedisEnterpriseOperations:
:type resource_group_name: str
:param cluster_name: The name of the Redis Enterprise cluster. Required.
:type cluster_name: str
:param parameters: Parameters supplied to the Create RedisEnterprise operation. Required.
:param parameters: Parameters supplied to the Create Redis Enterprise operation. Required.
:type parameters: ~azure.mgmt.redisenterprise.models.Cluster
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
@ -355,7 +360,7 @@ class RedisEnterpriseOperations:
:type resource_group_name: str
:param cluster_name: The name of the Redis Enterprise cluster. Required.
:type cluster_name: str
:param parameters: Parameters supplied to the Create RedisEnterprise operation. Required.
:param parameters: Parameters supplied to the Create Redis Enterprise operation. Required.
:type parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
@ -376,7 +381,7 @@ class RedisEnterpriseOperations:
:type resource_group_name: str
:param cluster_name: The name of the Redis Enterprise cluster. Required.
:type cluster_name: str
:param parameters: Parameters supplied to the Create RedisEnterprise operation. Is either a
:param parameters: Parameters supplied to the Create Redis Enterprise operation. Is either a
Cluster type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.redisenterprise.models.Cluster or IO[bytes]
:return: An instance of LROPoller that returns either Cluster or the result of cls(response)
@ -404,10 +409,11 @@ class RedisEnterpriseOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("Cluster", pipeline_response)
deserialized = self._deserialize("Cluster", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -437,8 +443,8 @@ class RedisEnterpriseOperations:
cluster_name: str,
parameters: Union[_models.ClusterUpdate, IO[bytes]],
**kwargs: Any
) -> Optional[_models.Cluster]:
error_map = {
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -451,7 +457,7 @@ class RedisEnterpriseOperations:
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.Cluster]] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -472,10 +478,10 @@ class RedisEnterpriseOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -483,16 +489,25 @@ class RedisEnterpriseOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("Cluster", pipeline_response)
response_headers = {}
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
response_headers["Azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("Azure-AsyncOperation")
)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@ -506,14 +521,14 @@ class RedisEnterpriseOperations:
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.Cluster]:
"""Updates an existing RedisEnterprise cluster.
"""Updates an existing Redis Enterprise cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: The name of the Redis Enterprise cluster. Required.
:type cluster_name: str
:param parameters: Parameters supplied to the Update RedisEnterprise operation. Required.
:param parameters: Parameters supplied to the Update Redis Enterprise operation. Required.
:type parameters: ~azure.mgmt.redisenterprise.models.ClusterUpdate
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
@ -533,14 +548,14 @@ class RedisEnterpriseOperations:
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.Cluster]:
"""Updates an existing RedisEnterprise cluster.
"""Updates an existing Redis Enterprise cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: The name of the Redis Enterprise cluster. Required.
:type cluster_name: str
:param parameters: Parameters supplied to the Update RedisEnterprise operation. Required.
:param parameters: Parameters supplied to the Update Redis Enterprise operation. Required.
:type parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
@ -558,14 +573,14 @@ class RedisEnterpriseOperations:
parameters: Union[_models.ClusterUpdate, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.Cluster]:
"""Updates an existing RedisEnterprise cluster.
"""Updates an existing Redis Enterprise cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_name: The name of the Redis Enterprise cluster. Required.
:type cluster_name: str
:param parameters: Parameters supplied to the Update RedisEnterprise operation. Is either a
:param parameters: Parameters supplied to the Update Redis Enterprise operation. Is either a
ClusterUpdate type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.redisenterprise.models.ClusterUpdate or IO[bytes]
:return: An instance of LROPoller that returns either Cluster or the result of cls(response)
@ -593,10 +608,11 @@ class RedisEnterpriseOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("Cluster", pipeline_response)
deserialized = self._deserialize("Cluster", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -620,10 +636,8 @@ class RedisEnterpriseOperations:
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, cluster_name: str, **kwargs: Any
) -> None:
error_map = {
def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -635,7 +649,7 @@ class RedisEnterpriseOperations:
_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,
@ -645,10 +659,10 @@ class RedisEnterpriseOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -656,16 +670,31 @@ class RedisEnterpriseOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
response_headers["Azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("Azure-AsyncOperation")
)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, None, {}) # 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, cluster_name: str, **kwargs: Any) -> LROPoller[None]:
"""Deletes a RedisEnterprise cache cluster.
"""Deletes a Redis Enterprise cache cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
@ -685,7 +714,7 @@ class RedisEnterpriseOperations:
lro_delay = kwargs.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,
@ -694,6 +723,7 @@ class RedisEnterpriseOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -719,7 +749,7 @@ class RedisEnterpriseOperations:
@distributed_trace
def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _models.Cluster:
"""Gets information about a RedisEnterprise cluster.
"""Gets information about a Redis Enterprise cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
@ -730,7 +760,7 @@ class RedisEnterpriseOperations:
:rtype: ~azure.mgmt.redisenterprise.models.Cluster
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -752,7 +782,6 @@ class RedisEnterpriseOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -767,7 +796,7 @@ class RedisEnterpriseOperations:
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("Cluster", pipeline_response)
deserialized = self._deserialize("Cluster", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -776,7 +805,7 @@ class RedisEnterpriseOperations:
@distributed_trace
def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Cluster"]:
"""Lists all RedisEnterprise clusters in a resource group.
"""Lists all Redis Enterprise clusters in a resource group.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
@ -791,7 +820,7 @@ class RedisEnterpriseOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClusterList] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -809,7 +838,6 @@ class RedisEnterpriseOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -825,7 +853,6 @@ class RedisEnterpriseOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@ -857,7 +884,7 @@ class RedisEnterpriseOperations:
@distributed_trace
def list(self, **kwargs: Any) -> Iterable["_models.Cluster"]:
"""Gets all RedisEnterprise clusters in the specified subscription.
"""Lists all Redis Enterprise clusters in the specified subscription.
:return: An iterator like instance of either Cluster or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redisenterprise.models.Cluster]
@ -869,7 +896,7 @@ class RedisEnterpriseOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClusterList] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -886,7 +913,6 @@ class RedisEnterpriseOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -902,7 +928,6 @@ class RedisEnterpriseOperations:
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

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

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

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

@ -35,6 +35,6 @@ def main():
print(item)
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-03-01-preview/examples/OperationsList.json
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/OperationsList.json
if __name__ == "__main__":
main()

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

@ -27,7 +27,7 @@ from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
def main():
client = RedisEnterpriseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f",
)
response = client.operations_status.get(
@ -37,6 +37,6 @@ def main():
print(response)
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-03-01-preview/examples/OperationsStatusGet.json
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/OperationsStatusGet.json
if __name__ == "__main__":
main()

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

@ -0,0 +1,47 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-redisenterprise
# USAGE
python redis_enterprise_access_policy_assignment_create_update.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = RedisEnterpriseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f",
)
response = client.access_policy_assignment.begin_create_update(
resource_group_name="rg1",
cluster_name="cache1",
database_name="default",
access_policy_assignment_name="defaultTestEntraApp1",
parameters={
"properties": {"accessPolicyName": "default", "user": {"objectId": "6497c918-11ad-41e7-1b0f-7c518a87d0b0"}}
},
).result()
print(response)
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseAccessPolicyAssignmentCreateUpdate.json
if __name__ == "__main__":
main()

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

@ -0,0 +1,43 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-redisenterprise
# USAGE
python redis_enterprise_access_policy_assignment_delete.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = RedisEnterpriseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f",
)
client.access_policy_assignment.begin_delete(
resource_group_name="rg1",
cluster_name="cache1",
database_name="default",
access_policy_assignment_name="defaultTestEntraApp1",
).result()
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseAccessPolicyAssignmentDelete.json
if __name__ == "__main__":
main()

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

@ -0,0 +1,44 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-redisenterprise
# USAGE
python redis_enterprise_access_policy_assignment_get.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = RedisEnterpriseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f",
)
response = client.access_policy_assignment.get(
resource_group_name="rg1",
cluster_name="cache1",
database_name="default",
access_policy_assignment_name="accessPolicyAssignmentName1",
)
print(response)
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseAccessPolicyAssignmentGet.json
if __name__ == "__main__":
main()

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

@ -0,0 +1,44 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-redisenterprise
# USAGE
python redis_enterprise_access_policy_assignments_list.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = RedisEnterpriseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f",
)
response = client.access_policy_assignment.list(
resource_group_name="rg1",
cluster_name="cache1",
database_name="default",
)
for item in response:
print(item)
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseAccessPolicyAssignmentsList.json
if __name__ == "__main__":
main()

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

@ -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.redisenterprise import RedisEnterpriseManagementClient
@ -29,7 +27,7 @@ from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
def main():
client = RedisEnterpriseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f",
)
response = client.redis_enterprise.begin_create(
@ -63,6 +61,6 @@ def main():
print(response)
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-03-01-preview/examples/RedisEnterpriseCreate.json
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseCreate.json
if __name__ == "__main__":
main()

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

@ -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.redisenterprise import RedisEnterpriseManagementClient
@ -29,7 +27,7 @@ from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
def main():
client = RedisEnterpriseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f",
)
response = client.databases.begin_create(
@ -38,6 +36,7 @@ def main():
database_name="default",
parameters={
"properties": {
"accessKeysAuthentication": "Enabled",
"clientProtocol": "Encrypted",
"clusteringPolicy": "EnterpriseCluster",
"deferUpgrade": "NotDeferred",
@ -55,6 +54,6 @@ def main():
print(response)
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-03-01-preview/examples/RedisEnterpriseDatabasesCreate.json
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDatabasesCreate.json
if __name__ == "__main__":
main()

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

@ -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.redisenterprise import RedisEnterpriseManagementClient
@ -29,7 +27,7 @@ from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
def main():
client = RedisEnterpriseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid1",
subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f",
)
response = client.databases.begin_create(
@ -38,6 +36,7 @@ def main():
database_name="default",
parameters={
"properties": {
"accessKeysAuthentication": "Enabled",
"clientProtocol": "Encrypted",
"clusteringPolicy": "EnterpriseCluster",
"evictionPolicy": "NoEviction",
@ -45,10 +44,10 @@ def main():
"groupNickname": "groupName",
"linkedDatabases": [
{
"id": "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Cache/redisEnterprise/cache1/databases/default"
"id": "/subscriptions/e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f/resourceGroups/rg1/providers/Microsoft.Cache/redisEnterprise/cache1/databases/default"
},
{
"id": "/subscriptions/subid2/resourceGroups/rg2/providers/Microsoft.Cache/redisEnterprise/cache2/databases/default"
"id": "/subscriptions/e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8e/resourceGroups/rg2/providers/Microsoft.Cache/redisEnterprise/cache2/databases/default"
},
],
},
@ -59,6 +58,6 @@ def main():
print(response)
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-03-01-preview/examples/RedisEnterpriseDatabasesCreateWithGeoReplication.json
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDatabasesCreateWithGeoReplication.json
if __name__ == "__main__":
main()

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

@ -27,7 +27,7 @@ from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
def main():
client = RedisEnterpriseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f",
)
client.databases.begin_delete(
@ -37,6 +37,6 @@ def main():
).result()
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-03-01-preview/examples/RedisEnterpriseDatabasesDelete.json
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDatabasesDelete.json
if __name__ == "__main__":
main()

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

@ -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.redisenterprise import RedisEnterpriseManagementClient
@ -29,7 +27,7 @@ from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
def main():
client = RedisEnterpriseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f",
)
client.databases.begin_export(
@ -40,6 +38,6 @@ def main():
).result()
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-03-01-preview/examples/RedisEnterpriseDatabasesExport.json
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDatabasesExport.json
if __name__ == "__main__":
main()

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

@ -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.redisenterprise import RedisEnterpriseManagementClient
@ -29,7 +27,7 @@ from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
def main():
client = RedisEnterpriseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f",
)
client.databases.begin_flush(
@ -38,12 +36,12 @@ def main():
database_name="default",
parameters={
"ids": [
"/subscriptions/subid2/resourceGroups/rg2/providers/Microsoft.Cache/redisEnterprise/cache2/databases/default"
"/subscriptions/e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f2/resourceGroups/rg2/providers/Microsoft.Cache/redisEnterprise/cache2/databases/default"
]
},
).result()
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-03-01-preview/examples/RedisEnterpriseDatabasesFlush.json
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDatabasesFlush.json
if __name__ == "__main__":
main()

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

@ -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.redisenterprise import RedisEnterpriseManagementClient
@ -50,6 +48,6 @@ def main():
).result()
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-03-01-preview/examples/RedisEnterpriseDatabasesForceLink.json
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDatabasesForceLink.json
if __name__ == "__main__":
main()

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

@ -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.redisenterprise import RedisEnterpriseManagementClient
@ -29,7 +27,7 @@ from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
def main():
client = RedisEnterpriseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f",
)
client.databases.begin_force_unlink(
@ -38,12 +36,12 @@ def main():
database_name="default",
parameters={
"ids": [
"/subscriptions/subid2/resourceGroups/rg2/providers/Microsoft.Cache/redisEnterprise/cache2/databases/default"
"/subscriptions/e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f2/resourceGroups/rg2/providers/Microsoft.Cache/redisEnterprise/cache2/databases/default"
]
},
).result()
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-03-01-preview/examples/RedisEnterpriseDatabasesForceUnlink.json
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDatabasesForceUnlink.json
if __name__ == "__main__":
main()

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

@ -27,7 +27,7 @@ from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
def main():
client = RedisEnterpriseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f",
)
response = client.databases.get(
@ -38,6 +38,6 @@ def main():
print(response)
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-03-01-preview/examples/RedisEnterpriseDatabasesGet.json
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDatabasesGet.json
if __name__ == "__main__":
main()

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

@ -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.redisenterprise import RedisEnterpriseManagementClient
@ -29,7 +27,7 @@ from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
def main():
client = RedisEnterpriseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f",
)
client.databases.begin_import_method(
@ -45,6 +43,6 @@ def main():
).result()
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-03-01-preview/examples/RedisEnterpriseDatabasesImport.json
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDatabasesImport.json
if __name__ == "__main__":
main()

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

@ -27,7 +27,7 @@ from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
def main():
client = RedisEnterpriseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f",
)
response = client.databases.list_by_cluster(
@ -38,6 +38,6 @@ def main():
print(item)
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-03-01-preview/examples/RedisEnterpriseDatabasesListByCluster.json
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDatabasesListByCluster.json
if __name__ == "__main__":
main()

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

@ -27,7 +27,7 @@ from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
def main():
client = RedisEnterpriseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f",
)
response = client.databases.list_keys(
@ -38,6 +38,6 @@ def main():
print(response)
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-03-01-preview/examples/RedisEnterpriseDatabasesListKeys.json
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDatabasesListKeys.json
if __name__ == "__main__":
main()

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

@ -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.redisenterprise import RedisEnterpriseManagementClient
@ -29,7 +27,7 @@ from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
def main():
client = RedisEnterpriseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f",
)
response = client.databases.begin_regenerate_key(
@ -41,6 +39,6 @@ def main():
print(response)
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-03-01-preview/examples/RedisEnterpriseDatabasesRegenerateKey.json
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDatabasesRegenerateKey.json
if __name__ == "__main__":
main()

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

@ -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.redisenterprise import RedisEnterpriseManagementClient
@ -29,7 +27,7 @@ from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
def main():
client = RedisEnterpriseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f",
)
response = client.databases.begin_update(
@ -38,6 +36,7 @@ def main():
database_name="default",
parameters={
"properties": {
"accessKeysAuthentication": "Enabled",
"clientProtocol": "Encrypted",
"evictionPolicy": "AllKeysLRU",
"persistence": {"rdbEnabled": True, "rdbFrequency": "12h"},
@ -47,6 +46,6 @@ def main():
print(response)
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-03-01-preview/examples/RedisEnterpriseDatabasesUpdate.json
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDatabasesUpdate.json
if __name__ == "__main__":
main()

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

@ -27,7 +27,7 @@ from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
def main():
client = RedisEnterpriseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f",
)
client.databases.begin_upgrade_db_redis_version(
@ -37,6 +37,6 @@ def main():
).result()
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-03-01-preview/examples/RedisEnterpriseDatabasesUpgradeDBRedisVersion.json
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDatabasesUpgradeDBRedisVersion.json
if __name__ == "__main__":
main()

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

@ -27,7 +27,7 @@ from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
def main():
client = RedisEnterpriseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f",
)
client.redis_enterprise.begin_delete(
@ -36,6 +36,6 @@ def main():
).result()
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-03-01-preview/examples/RedisEnterpriseDelete.json
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDelete.json
if __name__ == "__main__":
main()

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

@ -27,7 +27,7 @@ from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
def main():
client = RedisEnterpriseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f",
)
client.private_endpoint_connections.begin_delete(
@ -37,6 +37,6 @@ def main():
).result()
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-03-01-preview/examples/RedisEnterpriseDeletePrivateEndpointConnection.json
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDeletePrivateEndpointConnection.json
if __name__ == "__main__":
main()

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

@ -27,7 +27,7 @@ from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
def main():
client = RedisEnterpriseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f",
)
response = client.redis_enterprise.get(
@ -37,6 +37,6 @@ def main():
print(response)
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-03-01-preview/examples/RedisEnterpriseGet.json
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseGet.json
if __name__ == "__main__":
main()

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

@ -27,7 +27,7 @@ from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
def main():
client = RedisEnterpriseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f",
)
response = client.private_endpoint_connections.get(
@ -38,6 +38,6 @@ def main():
print(response)
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-03-01-preview/examples/RedisEnterpriseGetPrivateEndpointConnection.json
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseGetPrivateEndpointConnection.json
if __name__ == "__main__":
main()

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

@ -27,7 +27,7 @@ from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
def main():
client = RedisEnterpriseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f",
)
response = client.redis_enterprise.list()
@ -35,6 +35,6 @@ def main():
print(item)
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-03-01-preview/examples/RedisEnterpriseList.json
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseList.json
if __name__ == "__main__":
main()

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

@ -27,7 +27,7 @@ from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
def main():
client = RedisEnterpriseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f",
)
response = client.redis_enterprise.list_by_resource_group(
@ -37,6 +37,6 @@ def main():
print(item)
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-03-01-preview/examples/RedisEnterpriseListByResourceGroup.json
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseListByResourceGroup.json
if __name__ == "__main__":
main()

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

@ -27,7 +27,7 @@ from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
def main():
client = RedisEnterpriseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f",
)
response = client.private_endpoint_connections.list(
@ -38,6 +38,6 @@ def main():
print(item)
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-03-01-preview/examples/RedisEnterpriseListPrivateEndpointConnections.json
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseListPrivateEndpointConnections.json
if __name__ == "__main__":
main()

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

@ -27,7 +27,7 @@ from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
def main():
client = RedisEnterpriseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f",
)
response = client.private_link_resources.list_by_cluster(
@ -38,6 +38,6 @@ def main():
print(item)
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-03-01-preview/examples/RedisEnterpriseListPrivateLinkResources.json
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseListPrivateLinkResources.json
if __name__ == "__main__":
main()

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

@ -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.redisenterprise import RedisEnterpriseManagementClient
@ -29,7 +27,7 @@ from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
def main():
client = RedisEnterpriseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f",
)
response = client.private_endpoint_connections.begin_put(
@ -43,6 +41,6 @@ def main():
print(response)
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-03-01-preview/examples/RedisEnterprisePutPrivateEndpointConnection.json
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterprisePutPrivateEndpointConnection.json
if __name__ == "__main__":
main()

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

@ -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.redisenterprise import RedisEnterpriseManagementClient
@ -29,7 +27,7 @@ from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
def main():
client = RedisEnterpriseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f",
)
response = client.redis_enterprise.begin_update(
@ -44,6 +42,6 @@ def main():
print(response)
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-03-01-preview/examples/RedisEnterpriseUpdate.json
# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseUpdate.json
if __name__ == "__main__":
main()

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

@ -0,0 +1,43 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import os
import pytest
from dotenv import load_dotenv
from devtools_testutils import (
test_proxy,
add_general_regex_sanitizer,
add_body_key_sanitizer,
add_header_regex_sanitizer,
)
load_dotenv()
# aovid record sensitive identity information in recordings
@pytest.fixture(scope="session", autouse=True)
def add_sanitizers(test_proxy):
redisenterprisemanagement_subscription_id = os.environ.get(
"AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000"
)
redisenterprisemanagement_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000")
redisenterprisemanagement_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000")
redisenterprisemanagement_client_secret = os.environ.get(
"AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000"
)
add_general_regex_sanitizer(
regex=redisenterprisemanagement_subscription_id, value="00000000-0000-0000-0000-000000000000"
)
add_general_regex_sanitizer(regex=redisenterprisemanagement_tenant_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=redisenterprisemanagement_client_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(
regex=redisenterprisemanagement_client_secret, value="00000000-0000-0000-0000-000000000000"
)
add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]")
add_header_regex_sanitizer(key="Cookie", value="cookie;")
add_body_key_sanitizer(json_path="$..access_token", value="access_token")

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

@ -0,0 +1,82 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestRedisEnterpriseManagementAccessPolicyAssignmentOperations(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(RedisEnterpriseManagementClient)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_begin_create_update(self, resource_group):
response = self.client.access_policy_assignment.begin_create_update(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
access_policy_assignment_name="str",
parameters={
"accessPolicyName": "str",
"id": "str",
"name": "str",
"provisioningState": "str",
"type": "str",
"user": {"objectId": "str"},
},
api_version="2024-09-01-preview",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_get(self, resource_group):
response = self.client.access_policy_assignment.get(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
access_policy_assignment_name="str",
api_version="2024-09-01-preview",
)
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_begin_delete(self, resource_group):
response = self.client.access_policy_assignment.begin_delete(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
access_policy_assignment_name="str",
api_version="2024-09-01-preview",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_list(self, resource_group):
response = self.client.access_policy_assignment.list(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
api_version="2024-09-01-preview",
)
result = [r for r in response]
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,87 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.redisenterprise.aio import RedisEnterpriseManagementClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
from devtools_testutils.aio import recorded_by_proxy_async
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestRedisEnterpriseManagementAccessPolicyAssignmentOperationsAsync(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(RedisEnterpriseManagementClient, is_async=True)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_begin_create_update(self, resource_group):
response = await (
await self.client.access_policy_assignment.begin_create_update(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
access_policy_assignment_name="str",
parameters={
"accessPolicyName": "str",
"id": "str",
"name": "str",
"provisioningState": "str",
"type": "str",
"user": {"objectId": "str"},
},
api_version="2024-09-01-preview",
)
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_get(self, resource_group):
response = await self.client.access_policy_assignment.get(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
access_policy_assignment_name="str",
api_version="2024-09-01-preview",
)
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_begin_delete(self, resource_group):
response = await (
await self.client.access_policy_assignment.begin_delete(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
access_policy_assignment_name="str",
api_version="2024-09-01-preview",
)
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_list(self, resource_group):
response = self.client.access_policy_assignment.list(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
api_version="2024-09-01-preview",
)
result = [r async for r in response]
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,232 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestRedisEnterpriseManagementDatabasesOperations(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(RedisEnterpriseManagementClient)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_list_by_cluster(self, resource_group):
response = self.client.databases.list_by_cluster(
resource_group_name=resource_group.name,
cluster_name="str",
api_version="2024-09-01-preview",
)
result = [r for r in response]
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_begin_create(self, resource_group):
response = self.client.databases.begin_create(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
parameters={
"accessKeysAuthentication": "str",
"clientProtocol": "str",
"clusteringPolicy": "str",
"deferUpgrade": "str",
"evictionPolicy": "str",
"geoReplication": {"groupNickname": "str", "linkedDatabases": [{"id": "str", "state": "str"}]},
"id": "str",
"modules": [{"name": "str", "args": "str", "version": "str"}],
"name": "str",
"persistence": {"aofEnabled": bool, "aofFrequency": "str", "rdbEnabled": bool, "rdbFrequency": "str"},
"port": 0,
"provisioningState": "str",
"redisVersion": "str",
"resourceState": "str",
"systemData": {
"createdAt": "2020-02-20 00:00:00",
"createdBy": "str",
"createdByType": "str",
"lastModifiedAt": "2020-02-20 00:00:00",
"lastModifiedBy": "str",
"lastModifiedByType": "str",
},
"type": "str",
},
api_version="2024-09-01-preview",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_begin_update(self, resource_group):
response = self.client.databases.begin_update(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
parameters={
"accessKeysAuthentication": "str",
"clientProtocol": "str",
"clusteringPolicy": "str",
"deferUpgrade": "str",
"evictionPolicy": "str",
"geoReplication": {"groupNickname": "str", "linkedDatabases": [{"id": "str", "state": "str"}]},
"modules": [{"name": "str", "args": "str", "version": "str"}],
"persistence": {"aofEnabled": bool, "aofFrequency": "str", "rdbEnabled": bool, "rdbFrequency": "str"},
"port": 0,
"provisioningState": "str",
"redisVersion": "str",
"resourceState": "str",
},
api_version="2024-09-01-preview",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_get(self, resource_group):
response = self.client.databases.get(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
api_version="2024-09-01-preview",
)
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_begin_delete(self, resource_group):
response = self.client.databases.begin_delete(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
api_version="2024-09-01-preview",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_list_keys(self, resource_group):
response = self.client.databases.list_keys(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
api_version="2024-09-01-preview",
)
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_begin_regenerate_key(self, resource_group):
response = self.client.databases.begin_regenerate_key(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
parameters={"keyType": "str"},
api_version="2024-09-01-preview",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_begin_import_method(self, resource_group):
response = self.client.databases.begin_import_method(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
parameters={"sasUris": ["str"]},
api_version="2024-09-01-preview",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_begin_export(self, resource_group):
response = self.client.databases.begin_export(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
parameters={"sasUri": "str"},
api_version="2024-09-01-preview",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_begin_force_unlink(self, resource_group):
response = self.client.databases.begin_force_unlink(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
parameters={"ids": ["str"]},
api_version="2024-09-01-preview",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_begin_force_link_to_replication_group(self, resource_group):
response = self.client.databases.begin_force_link_to_replication_group(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
parameters={"groupNickname": "str", "linkedDatabases": [{"id": "str", "state": "str"}]},
api_version="2024-09-01-preview",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_begin_flush(self, resource_group):
response = self.client.databases.begin_flush(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
parameters={"ids": ["str"]},
api_version="2024-09-01-preview",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_begin_upgrade_db_redis_version(self, resource_group):
response = self.client.databases.begin_upgrade_db_redis_version(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
api_version="2024-09-01-preview",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,263 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.redisenterprise.aio import RedisEnterpriseManagementClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
from devtools_testutils.aio import recorded_by_proxy_async
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestRedisEnterpriseManagementDatabasesOperationsAsync(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(RedisEnterpriseManagementClient, is_async=True)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_list_by_cluster(self, resource_group):
response = self.client.databases.list_by_cluster(
resource_group_name=resource_group.name,
cluster_name="str",
api_version="2024-09-01-preview",
)
result = [r async for r in response]
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_begin_create(self, resource_group):
response = await (
await self.client.databases.begin_create(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
parameters={
"accessKeysAuthentication": "str",
"clientProtocol": "str",
"clusteringPolicy": "str",
"deferUpgrade": "str",
"evictionPolicy": "str",
"geoReplication": {"groupNickname": "str", "linkedDatabases": [{"id": "str", "state": "str"}]},
"id": "str",
"modules": [{"name": "str", "args": "str", "version": "str"}],
"name": "str",
"persistence": {
"aofEnabled": bool,
"aofFrequency": "str",
"rdbEnabled": bool,
"rdbFrequency": "str",
},
"port": 0,
"provisioningState": "str",
"redisVersion": "str",
"resourceState": "str",
"systemData": {
"createdAt": "2020-02-20 00:00:00",
"createdBy": "str",
"createdByType": "str",
"lastModifiedAt": "2020-02-20 00:00:00",
"lastModifiedBy": "str",
"lastModifiedByType": "str",
},
"type": "str",
},
api_version="2024-09-01-preview",
)
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_begin_update(self, resource_group):
response = await (
await self.client.databases.begin_update(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
parameters={
"accessKeysAuthentication": "str",
"clientProtocol": "str",
"clusteringPolicy": "str",
"deferUpgrade": "str",
"evictionPolicy": "str",
"geoReplication": {"groupNickname": "str", "linkedDatabases": [{"id": "str", "state": "str"}]},
"modules": [{"name": "str", "args": "str", "version": "str"}],
"persistence": {
"aofEnabled": bool,
"aofFrequency": "str",
"rdbEnabled": bool,
"rdbFrequency": "str",
},
"port": 0,
"provisioningState": "str",
"redisVersion": "str",
"resourceState": "str",
},
api_version="2024-09-01-preview",
)
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_get(self, resource_group):
response = await self.client.databases.get(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
api_version="2024-09-01-preview",
)
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_begin_delete(self, resource_group):
response = await (
await self.client.databases.begin_delete(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
api_version="2024-09-01-preview",
)
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_list_keys(self, resource_group):
response = await self.client.databases.list_keys(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
api_version="2024-09-01-preview",
)
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_begin_regenerate_key(self, resource_group):
response = await (
await self.client.databases.begin_regenerate_key(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
parameters={"keyType": "str"},
api_version="2024-09-01-preview",
)
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_begin_import_method(self, resource_group):
response = await (
await self.client.databases.begin_import_method(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
parameters={"sasUris": ["str"]},
api_version="2024-09-01-preview",
)
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_begin_export(self, resource_group):
response = await (
await self.client.databases.begin_export(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
parameters={"sasUri": "str"},
api_version="2024-09-01-preview",
)
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_begin_force_unlink(self, resource_group):
response = await (
await self.client.databases.begin_force_unlink(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
parameters={"ids": ["str"]},
api_version="2024-09-01-preview",
)
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_begin_force_link_to_replication_group(self, resource_group):
response = await (
await self.client.databases.begin_force_link_to_replication_group(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
parameters={"groupNickname": "str", "linkedDatabases": [{"id": "str", "state": "str"}]},
api_version="2024-09-01-preview",
)
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_begin_flush(self, resource_group):
response = await (
await self.client.databases.begin_flush(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
parameters={"ids": ["str"]},
api_version="2024-09-01-preview",
)
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_begin_upgrade_db_redis_version(self, resource_group):
response = await (
await self.client.databases.begin_upgrade_db_redis_version(
resource_group_name=resource_group.name,
cluster_name="str",
database_name="str",
api_version="2024-09-01-preview",
)
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,29 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestRedisEnterpriseManagementOperations(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(RedisEnterpriseManagementClient)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_list(self, resource_group):
response = self.client.operations.list(
api_version="2024-09-01-preview",
)
result = [r for r in response]
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,30 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.redisenterprise.aio import RedisEnterpriseManagementClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
from devtools_testutils.aio import recorded_by_proxy_async
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestRedisEnterpriseManagementOperationsAsync(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(RedisEnterpriseManagementClient, is_async=True)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_list(self, resource_group):
response = self.client.operations.list(
api_version="2024-09-01-preview",
)
result = [r async for r in response]
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,31 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestRedisEnterpriseManagementOperationsStatusOperations(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(RedisEnterpriseManagementClient)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_get(self, resource_group):
response = self.client.operations_status.get(
location="str",
operation_id="str",
api_version="2024-09-01-preview",
)
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,32 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.redisenterprise.aio import RedisEnterpriseManagementClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
from devtools_testutils.aio import recorded_by_proxy_async
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestRedisEnterpriseManagementOperationsStatusOperationsAsync(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(RedisEnterpriseManagementClient, is_async=True)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_get(self, resource_group):
response = await self.client.operations_status.get(
location="str",
operation_id="str",
api_version="2024-09-01-preview",
)
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,78 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestRedisEnterpriseManagementPrivateEndpointConnectionsOperations(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(RedisEnterpriseManagementClient)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_list(self, resource_group):
response = self.client.private_endpoint_connections.list(
resource_group_name=resource_group.name,
cluster_name="str",
api_version="2024-09-01-preview",
)
result = [r for r in response]
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_get(self, resource_group):
response = self.client.private_endpoint_connections.get(
resource_group_name=resource_group.name,
cluster_name="str",
private_endpoint_connection_name="str",
api_version="2024-09-01-preview",
)
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_begin_put(self, resource_group):
response = self.client.private_endpoint_connections.begin_put(
resource_group_name=resource_group.name,
cluster_name="str",
private_endpoint_connection_name="str",
properties={
"id": "str",
"name": "str",
"privateEndpoint": {"id": "str"},
"privateLinkServiceConnectionState": {"actionsRequired": "str", "description": "str", "status": "str"},
"provisioningState": "str",
"type": "str",
},
api_version="2024-09-01-preview",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_begin_delete(self, resource_group):
response = self.client.private_endpoint_connections.begin_delete(
resource_group_name=resource_group.name,
cluster_name="str",
private_endpoint_connection_name="str",
api_version="2024-09-01-preview",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,87 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.redisenterprise.aio import RedisEnterpriseManagementClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
from devtools_testutils.aio import recorded_by_proxy_async
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestRedisEnterpriseManagementPrivateEndpointConnectionsOperationsAsync(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(RedisEnterpriseManagementClient, is_async=True)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_list(self, resource_group):
response = self.client.private_endpoint_connections.list(
resource_group_name=resource_group.name,
cluster_name="str",
api_version="2024-09-01-preview",
)
result = [r async for r in response]
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_get(self, resource_group):
response = await self.client.private_endpoint_connections.get(
resource_group_name=resource_group.name,
cluster_name="str",
private_endpoint_connection_name="str",
api_version="2024-09-01-preview",
)
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_begin_put(self, resource_group):
response = await (
await self.client.private_endpoint_connections.begin_put(
resource_group_name=resource_group.name,
cluster_name="str",
private_endpoint_connection_name="str",
properties={
"id": "str",
"name": "str",
"privateEndpoint": {"id": "str"},
"privateLinkServiceConnectionState": {
"actionsRequired": "str",
"description": "str",
"status": "str",
},
"provisioningState": "str",
"type": "str",
},
api_version="2024-09-01-preview",
)
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_begin_delete(self, resource_group):
response = await (
await self.client.private_endpoint_connections.begin_delete(
resource_group_name=resource_group.name,
cluster_name="str",
private_endpoint_connection_name="str",
api_version="2024-09-01-preview",
)
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,31 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestRedisEnterpriseManagementPrivateLinkResourcesOperations(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(RedisEnterpriseManagementClient)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_list_by_cluster(self, resource_group):
response = self.client.private_link_resources.list_by_cluster(
resource_group_name=resource_group.name,
cluster_name="str",
api_version="2024-09-01-preview",
)
result = [r for r in response]
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,32 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.redisenterprise.aio import RedisEnterpriseManagementClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
from devtools_testutils.aio import recorded_by_proxy_async
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestRedisEnterpriseManagementPrivateLinkResourcesOperationsAsync(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(RedisEnterpriseManagementClient, is_async=True)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_list_by_cluster(self, resource_group):
response = self.client.private_link_resources.list_by_cluster(
resource_group_name=resource_group.name,
cluster_name="str",
api_version="2024-09-01-preview",
)
result = [r async for r in response]
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,167 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestRedisEnterpriseManagementRedisEnterpriseOperations(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(RedisEnterpriseManagementClient)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_begin_create(self, resource_group):
response = self.client.redis_enterprise.begin_create(
resource_group_name=resource_group.name,
cluster_name="str",
parameters={
"location": "str",
"sku": {"name": "str", "capacity": 0},
"encryption": {
"customerManagedKeyEncryption": {
"keyEncryptionKeyIdentity": {"identityType": "str", "userAssignedIdentityResourceId": "str"},
"keyEncryptionKeyUrl": "str",
}
},
"highAvailability": "str",
"hostName": "str",
"id": "str",
"identity": {
"type": "str",
"principalId": "str",
"tenantId": "str",
"userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
},
"minimumTlsVersion": "str",
"name": "str",
"privateEndpointConnections": [
{
"id": "str",
"name": "str",
"privateEndpoint": {"id": "str"},
"privateLinkServiceConnectionState": {
"actionsRequired": "str",
"description": "str",
"status": "str",
},
"provisioningState": "str",
"type": "str",
}
],
"provisioningState": "str",
"redisVersion": "str",
"redundancyMode": "str",
"resourceState": "str",
"tags": {"str": "str"},
"type": "str",
"zones": ["str"],
},
api_version="2024-09-01-preview",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_begin_update(self, resource_group):
response = self.client.redis_enterprise.begin_update(
resource_group_name=resource_group.name,
cluster_name="str",
parameters={
"encryption": {
"customerManagedKeyEncryption": {
"keyEncryptionKeyIdentity": {"identityType": "str", "userAssignedIdentityResourceId": "str"},
"keyEncryptionKeyUrl": "str",
}
},
"highAvailability": "str",
"hostName": "str",
"identity": {
"type": "str",
"principalId": "str",
"tenantId": "str",
"userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
},
"minimumTlsVersion": "str",
"privateEndpointConnections": [
{
"id": "str",
"name": "str",
"privateEndpoint": {"id": "str"},
"privateLinkServiceConnectionState": {
"actionsRequired": "str",
"description": "str",
"status": "str",
},
"provisioningState": "str",
"type": "str",
}
],
"provisioningState": "str",
"redisVersion": "str",
"redundancyMode": "str",
"resourceState": "str",
"sku": {"name": "str", "capacity": 0},
"tags": {"str": "str"},
},
api_version="2024-09-01-preview",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_begin_delete(self, resource_group):
response = self.client.redis_enterprise.begin_delete(
resource_group_name=resource_group.name,
cluster_name="str",
api_version="2024-09-01-preview",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_get(self, resource_group):
response = self.client.redis_enterprise.get(
resource_group_name=resource_group.name,
cluster_name="str",
api_version="2024-09-01-preview",
)
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_list_by_resource_group(self, resource_group):
response = self.client.redis_enterprise.list_by_resource_group(
resource_group_name=resource_group.name,
api_version="2024-09-01-preview",
)
result = [r for r in response]
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_list(self, resource_group):
response = self.client.redis_enterprise.list(
api_version="2024-09-01-preview",
)
result = [r for r in response]
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,180 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.redisenterprise.aio import RedisEnterpriseManagementClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
from devtools_testutils.aio import recorded_by_proxy_async
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestRedisEnterpriseManagementRedisEnterpriseOperationsAsync(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(RedisEnterpriseManagementClient, is_async=True)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_begin_create(self, resource_group):
response = await (
await self.client.redis_enterprise.begin_create(
resource_group_name=resource_group.name,
cluster_name="str",
parameters={
"location": "str",
"sku": {"name": "str", "capacity": 0},
"encryption": {
"customerManagedKeyEncryption": {
"keyEncryptionKeyIdentity": {
"identityType": "str",
"userAssignedIdentityResourceId": "str",
},
"keyEncryptionKeyUrl": "str",
}
},
"highAvailability": "str",
"hostName": "str",
"id": "str",
"identity": {
"type": "str",
"principalId": "str",
"tenantId": "str",
"userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
},
"minimumTlsVersion": "str",
"name": "str",
"privateEndpointConnections": [
{
"id": "str",
"name": "str",
"privateEndpoint": {"id": "str"},
"privateLinkServiceConnectionState": {
"actionsRequired": "str",
"description": "str",
"status": "str",
},
"provisioningState": "str",
"type": "str",
}
],
"provisioningState": "str",
"redisVersion": "str",
"redundancyMode": "str",
"resourceState": "str",
"tags": {"str": "str"},
"type": "str",
"zones": ["str"],
},
api_version="2024-09-01-preview",
)
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_begin_update(self, resource_group):
response = await (
await self.client.redis_enterprise.begin_update(
resource_group_name=resource_group.name,
cluster_name="str",
parameters={
"encryption": {
"customerManagedKeyEncryption": {
"keyEncryptionKeyIdentity": {
"identityType": "str",
"userAssignedIdentityResourceId": "str",
},
"keyEncryptionKeyUrl": "str",
}
},
"highAvailability": "str",
"hostName": "str",
"identity": {
"type": "str",
"principalId": "str",
"tenantId": "str",
"userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
},
"minimumTlsVersion": "str",
"privateEndpointConnections": [
{
"id": "str",
"name": "str",
"privateEndpoint": {"id": "str"},
"privateLinkServiceConnectionState": {
"actionsRequired": "str",
"description": "str",
"status": "str",
},
"provisioningState": "str",
"type": "str",
}
],
"provisioningState": "str",
"redisVersion": "str",
"redundancyMode": "str",
"resourceState": "str",
"sku": {"name": "str", "capacity": 0},
"tags": {"str": "str"},
},
api_version="2024-09-01-preview",
)
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_begin_delete(self, resource_group):
response = await (
await self.client.redis_enterprise.begin_delete(
resource_group_name=resource_group.name,
cluster_name="str",
api_version="2024-09-01-preview",
)
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_get(self, resource_group):
response = await self.client.redis_enterprise.get(
resource_group_name=resource_group.name,
cluster_name="str",
api_version="2024-09-01-preview",
)
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_list_by_resource_group(self, resource_group):
response = self.client.redis_enterprise.list_by_resource_group(
resource_group_name=resource_group.name,
api_version="2024-09-01-preview",
)
result = [r async for r in response]
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_list(self, resource_group):
response = self.client.redis_enterprise.list(
api_version="2024-09-01-preview",
)
result = [r async for r in response]
# please add some check logic here by yourself
# ...

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

@ -75,6 +75,7 @@ setup(
},
install_requires=[
"isodate>=0.6.1",
"typing-extensions>=4.6.0",
"azure-common>=1.1",
"azure-mgmt-core>=1.3.2",
],

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

@ -1,50 +1,43 @@
# coding=utf-8
# --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import os
import platform
import pytest
import sys
from dotenv import load_dotenv
from devtools_testutils import test_proxy, add_general_regex_sanitizer
from devtools_testutils import add_header_regex_sanitizer, add_body_key_sanitizer
from devtools_testutils import (
test_proxy,
add_general_regex_sanitizer,
add_body_key_sanitizer,
add_header_regex_sanitizer,
)
load_dotenv()
# aovid record sensitive identity information in recordings
@pytest.fixture(scope="session", autouse=True)
def add_sanitizers(test_proxy):
subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000")
tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000")
client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000")
client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=subscription_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=tenant_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=client_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=client_secret, value="00000000-0000-0000-0000-000000000000")
redisenterprisemanagement_subscription_id = os.environ.get(
"AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000"
)
redisenterprisemanagement_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000")
redisenterprisemanagement_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000")
redisenterprisemanagement_client_secret = os.environ.get(
"AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000"
)
add_general_regex_sanitizer(
regex=redisenterprisemanagement_subscription_id, value="00000000-0000-0000-0000-000000000000"
)
add_general_regex_sanitizer(regex=redisenterprisemanagement_tenant_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=redisenterprisemanagement_client_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(
regex=redisenterprisemanagement_client_secret, value="00000000-0000-0000-0000-000000000000"
)
add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]")
add_header_regex_sanitizer(key="Cookie", value="cookie;")
add_body_key_sanitizer(json_path="$..access_token", value="access_token")
add_body_key_sanitizer(json_path="$..access_token", value="access_token")

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

@ -0,0 +1,28 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.redisenterprise.aio import RedisEnterpriseManagementClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
from devtools_testutils.aio import recorded_by_proxy_async
AZURE_LOCATION = "eastus"
@pytest.mark.live_test_only
class TestRedisEnterpriseManagementOperationsAsync(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(RedisEnterpriseManagementClient, is_async=True)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_list(self, resource_group):
response = self.client.operations.list()
result = [r async for r in response]
assert result

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

@ -0,0 +1,27 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
AZURE_LOCATION = "eastus"
@pytest.mark.live_test_only
class TestRedisEnterpriseManagementOperations(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(RedisEnterpriseManagementClient)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_list(self, resource_group):
response = self.client.operations.list()
result = [r for r in response]
assert result

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

@ -0,0 +1,29 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.redisenterprise.aio import RedisEnterpriseManagementClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
from devtools_testutils.aio import recorded_by_proxy_async
AZURE_LOCATION = "eastus"
@pytest.mark.live_test_only
class TestRedisEnterpriseManagementRedisEnterpriseOperationsAsync(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(RedisEnterpriseManagementClient, is_async=True)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_list_by_resource_group(self, resource_group):
response = self.client.redis_enterprise.list_by_resource_group(
resource_group_name=resource_group.name,
)
result = [r async for r in response]
assert result == []

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

@ -0,0 +1,29 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
AZURE_LOCATION = "eastus"
@pytest.mark.live_test_only
class TestRedisEnterpriseManagementRedisEnterpriseOperations(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(RedisEnterpriseManagementClient)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_list_by_resource_group(self, resource_group):
response = self.client.redis_enterprise.list_by_resource_group(
resource_group_name=resource_group.name,
)
result = [r for r in response]
assert result == []