From bf0892a8a967a26db73d217d1ed55320362ab557 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 5 Aug 2022 05:58:06 +0000 Subject: [PATCH] CodeGen from PR 19596 in Azure/azure-rest-api-specs ARM ID Annotations for Redis (#19596) --- sdk/redis/azure-mgmt-redis/_meta.json | 6 +- .../azure/mgmt/redis/__init__.py | 13 +- .../azure/mgmt/redis/_configuration.py | 25 +- .../azure/mgmt/redis/_metadata.json | 108 - .../mgmt/redis/_redis_management_client.py | 69 +- .../azure/mgmt/redis/_version.py | 2 +- .../azure/mgmt/redis/aio/__init__.py | 13 +- .../azure/mgmt/redis/aio/_configuration.py | 12 +- .../redis/aio/_redis_management_client.py | 47 +- .../mgmt/redis/aio/operations/__init__.py | 7 + .../_async_operation_status_operations.py | 107 + .../operations/_firewall_rules_operations.py | 138 +- .../operations/_linked_server_operations.py | 277 +- .../mgmt/redis/aio/operations/_operations.py | 64 +- .../azure/mgmt/redis/aio/operations/_patch.py | 19 + .../operations/_patch_schedules_operations.py | 138 +- ...private_endpoint_connections_operations.py | 173 +- .../_private_link_resources_operations.py | 64 +- .../redis/aio/operations/_redis_operations.py | 624 ++-- .../azure/mgmt/redis/models/__init__.py | 162 +- .../azure/mgmt/redis/models/_models.py | 2625 ----------------- .../azure/mgmt/redis/models/_models_py3.py | 591 +++- .../azure/mgmt/redis/models/_patch.py | 19 + .../models/_redis_management_client_enums.py | 27 +- .../azure/mgmt/redis/operations/__init__.py | 7 + .../_async_operation_status_operations.py | 147 + .../operations/_firewall_rules_operations.py | 345 ++- .../operations/_linked_server_operations.py | 493 ++-- .../mgmt/redis/operations/_operations.py | 108 +- .../azure/mgmt/redis/operations/_patch.py | 19 + .../operations/_patch_schedules_operations.py | 345 ++- ...private_endpoint_connections_operations.py | 389 +-- .../_private_link_resources_operations.py | 120 +- .../redis/operations/_redis_operations.py | 1283 ++++---- 34 files changed, 3811 insertions(+), 4775 deletions(-) delete mode 100644 sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_metadata.json create mode 100644 sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_async_operation_status_operations.py create mode 100644 sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_patch.py delete mode 100644 sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/_models.py create mode 100644 sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/_patch.py create mode 100644 sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_async_operation_status_operations.py create mode 100644 sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_patch.py diff --git a/sdk/redis/azure-mgmt-redis/_meta.json b/sdk/redis/azure-mgmt-redis/_meta.json index ad62c935fcbd..42c39940fdd6 100644 --- a/sdk/redis/azure-mgmt-redis/_meta.json +++ b/sdk/redis/azure-mgmt-redis/_meta.json @@ -1,11 +1,11 @@ { "autorest": "3.7.2", "use": [ - "@autorest/python@5.12.0", + "@autorest/python@5.16.0", "@autorest/modelerfour@4.19.3" ], - "commit": "b28cdff098a89aab796e38c78b6b71a897fbae47", + "commit": "9d4fb5a237053f5113db902977ec2663628c32b7", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/redis/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "autorest_command": "autorest specification/redis/resource-manager/readme.md --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.16.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/redis/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/__init__.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/__init__.py index b1a853be7116..849487672fa7 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/__init__.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/__init__.py @@ -10,9 +10,14 @@ from ._version import VERSION __version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['RedisManagementClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` 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 -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_configuration.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_configuration.py index a7f2b3c59028..4751d6a393e7 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_configuration.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_configuration.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies @@ -16,12 +16,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential -class RedisManagementClientConfiguration(Configuration): +class RedisManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for RedisManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,18 +27,23 @@ class RedisManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription credentials which uniquely identify the Microsoft + Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: super(RedisManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -48,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-06-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-redis/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_metadata.json b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_metadata.json deleted file mode 100644 index 07593e49a89b..000000000000 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_metadata.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "chosen_version": "2021-06-01", - "total_api_version_list": ["2021-06-01"], - "client": { - "name": "RedisManagementClient", - "filename": "_redis_management_client", - "description": "REST API for Azure Redis Cache Service.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"RedisManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"RedisManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", - "docstring_type": "str", - "required": true - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version=None, # type: Optional[str]", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "operations": "Operations", - "redis": "RedisOperations", - "firewall_rules": "FirewallRulesOperations", - "patch_schedules": "PatchSchedulesOperations", - "linked_server": "LinkedServerOperations", - "private_endpoint_connections": "PrivateEndpointConnectionsOperations", - "private_link_resources": "PrivateLinkResourcesOperations" - } -} \ No newline at end of file diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_redis_management_client.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_redis_management_client.py index 502d57a11570..3536333bdcba 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_redis_management_client.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_redis_management_client.py @@ -7,23 +7,22 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING -from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + from . import models from ._configuration import RedisManagementClientConfiguration -from .operations import FirewallRulesOperations, LinkedServerOperations, Operations, PatchSchedulesOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, RedisOperations +from .operations import AsyncOperationStatusOperations, FirewallRulesOperations, LinkedServerOperations, Operations, PatchSchedulesOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, RedisOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.rest import HttpRequest, HttpResponse -class RedisManagementClient(object): +class RedisManagementClient: # pylint: disable=too-many-instance-attributes """REST API for Azure Redis Cache Service. :ivar operations: Operations operations @@ -41,25 +40,29 @@ class RedisManagementClient(object): azure.mgmt.redis.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.redis.operations.PrivateLinkResourcesOperations + :ivar async_operation_status: AsyncOperationStatusOperations operations + :vartype async_operation_status: azure.mgmt.redis.operations.AsyncOperationStatusOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url="https://management.azure.com", # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: self._config = RedisManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -67,21 +70,37 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.redis = RedisOperations(self._client, self._config, self._serialize, self._deserialize) - self.firewall_rules = FirewallRulesOperations(self._client, self._config, self._serialize, self._deserialize) - self.patch_schedules = PatchSchedulesOperations(self._client, self._config, self._serialize, self._deserialize) - self.linked_server = LinkedServerOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.redis = RedisOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.firewall_rules = FirewallRulesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.patch_schedules = PatchSchedulesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.linked_server = LinkedServerOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.async_operation_status = AsyncOperationStatusOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( self, - request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse + request: HttpRequest, + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_version.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_version.py index e4382a083348..dc6920075e88 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_version.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "13.1.0" +VERSION = "12.0.0b1" diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/__init__.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/__init__.py index cfd091c338d2..2e8b67561921 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/__init__.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._redis_management_client import RedisManagementClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['RedisManagementClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` 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 -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/_configuration.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/_configuration.py index 5109c0c2d4b2..d44a0b47d933 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/_configuration.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class RedisManagementClientConfiguration(Configuration): +class RedisManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for RedisManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,8 +27,12 @@ class RedisManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription credentials which uniquely identify the Microsoft + Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(RedisManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-06-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-redis/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/_redis_management_client.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/_redis_management_client.py index 7b4be3767c4c..e60e20e4e3b7 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/_redis_management_client.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/_redis_management_client.py @@ -7,21 +7,22 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import RedisManagementClientConfiguration -from .operations import FirewallRulesOperations, LinkedServerOperations, Operations, PatchSchedulesOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, RedisOperations +from .operations import AsyncOperationStatusOperations, FirewallRulesOperations, LinkedServerOperations, Operations, PatchSchedulesOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, RedisOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class RedisManagementClient: +class RedisManagementClient: # pylint: disable=too-many-instance-attributes """REST API for Azure Redis Cache Service. :ivar operations: Operations operations @@ -39,13 +40,18 @@ class RedisManagementClient: azure.mgmt.redis.aio.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.redis.aio.operations.PrivateLinkResourcesOperations + :ivar async_operation_status: AsyncOperationStatusOperations operations + :vartype async_operation_status: azure.mgmt.redis.aio.operations.AsyncOperationStatusOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ @@ -64,13 +70,30 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.redis = RedisOperations(self._client, self._config, self._serialize, self._deserialize) - self.firewall_rules = FirewallRulesOperations(self._client, self._config, self._serialize, self._deserialize) - self.patch_schedules = PatchSchedulesOperations(self._client, self._config, self._serialize, self._deserialize) - self.linked_server = LinkedServerOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.redis = RedisOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.firewall_rules = FirewallRulesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.patch_schedules = PatchSchedulesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.linked_server = LinkedServerOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.async_operation_status = AsyncOperationStatusOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/__init__.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/__init__.py index e06d31c968e1..9f20a7d1be9b 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/__init__.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/__init__.py @@ -13,7 +13,11 @@ from ._linked_server_operations import LinkedServerOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._async_operation_status_operations import AsyncOperationStatusOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'RedisOperations', @@ -22,4 +26,7 @@ 'LinkedServerOperations', 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', + 'AsyncOperationStatusOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_async_operation_status_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_async_operation_status_operations.py new file mode 100644 index 000000000000..c02969d584bb --- /dev/null +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_async_operation_status_operations.py @@ -0,0 +1,107 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._async_operation_status_operations import build_get_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AsyncOperationStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.redis.aio.RedisManagementClient`'s + :attr:`async_operation_status` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace_async + async def get( + self, + location: str, + operation_id: str, + **kwargs: Any + ) -> _models.OperationStatus: + """For checking the ongoing status of an operation. + + :param location: The location at which operation was triggered. + :type location: str + :param operation_id: The ID of asynchronous operation. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationStatus, or the result of cls(response) + :rtype: ~azure.mgmt.redis.models.OperationStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatus] + + + request = build_get_request( + location=location, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/asyncOperations/{operationId}"} # type: ignore + diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_firewall_rules_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_firewall_rules_operations.py index 6553c4e328f1..4adaf908bf2e 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_firewall_rules_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_firewall_rules_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -25,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class FirewallRulesOperations: - """FirewallRulesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.redis.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.redis.aio.RedisManagementClient`'s + :attr:`firewall_rules` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -52,7 +50,7 @@ def list( resource_group_name: str, cache_name: str, **kwargs: Any - ) -> AsyncIterable["_models.RedisFirewallRuleListResult"]: + ) -> AsyncIterable[_models.RedisFirewallRuleListResult]: """Gets all firewall rules in the specified redis cache. :param resource_group_name: The name of the resource group. @@ -66,11 +64,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redis.models.RedisFirewallRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisFirewallRuleListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisFirewallRuleListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -78,10 +81,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cache_name=cache_name, + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -89,10 +95,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cache_name=cache_name, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -106,7 +115,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -120,7 +133,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules"} # type: ignore @distributed_trace_async async def create_or_update( @@ -128,9 +141,9 @@ async def create_or_update( resource_group_name: str, cache_name: str, rule_name: str, - parameters: "_models.RedisFirewallRule", + parameters: _models.RedisFirewallRule, **kwargs: Any - ) -> "_models.RedisFirewallRule": + ) -> _models.RedisFirewallRule: """Create or update a redis cache firewall rule. :param resource_group_name: The name of the resource group. @@ -146,13 +159,17 @@ async def create_or_update( :rtype: ~azure.mgmt.redis.models.RedisFirewallRule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisFirewallRule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisFirewallRule] _json = self._serialize.body(parameters, 'RedisFirewallRule') @@ -161,14 +178,21 @@ async def create_or_update( cache_name=cache_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -187,7 +211,7 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}"} # type: ignore @distributed_trace_async @@ -197,7 +221,7 @@ async def get( cache_name: str, rule_name: str, **kwargs: Any - ) -> "_models.RedisFirewallRule": + ) -> _models.RedisFirewallRule: """Gets a single firewall rule in a specified redis cache. :param resource_group_name: The name of the resource group. @@ -211,11 +235,16 @@ async def get( :rtype: ~azure.mgmt.redis.models.RedisFirewallRule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisFirewallRule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisFirewallRule] request = build_get_request( @@ -223,12 +252,19 @@ async def get( cache_name=cache_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -243,11 +279,11 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -267,11 +303,16 @@ async def delete( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -279,12 +320,19 @@ async def delete( cache_name=cache_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -295,5 +343,5 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}"} # type: ignore diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_linked_server_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_linked_server_operations.py index 197ab5a22096..b7c45aa7ae26 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_linked_server_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_linked_server_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -17,52 +16,55 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request -from ...operations._linked_server_operations import build_create_request_initial, build_delete_request, build_get_request, build_list_request +from ...operations._linked_server_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class LinkedServerOperations: - """LinkedServerOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.redis.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.redis.aio.RedisManagementClient`'s + :attr:`linked_server` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_initial( self, resource_group_name: str, name: str, linked_server_name: str, - parameters: "_models.RedisLinkedServerCreateParameters", + parameters: _models.RedisLinkedServerCreateParameters, **kwargs: Any - ) -> "_models.RedisLinkedServerWithProperties": - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisLinkedServerWithProperties"] + ) -> _models.RedisLinkedServerWithProperties: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisLinkedServerWithProperties] _json = self._serialize.body(parameters, 'RedisLinkedServerCreateParameters') @@ -71,14 +73,21 @@ async def _create_initial( name=name, linked_server_name=linked_server_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -96,7 +105,7 @@ async def _create_initial( return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}'} # type: ignore + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}"} # type: ignore @distributed_trace_async @@ -105,9 +114,9 @@ async def begin_create( resource_group_name: str, name: str, linked_server_name: str, - parameters: "_models.RedisLinkedServerCreateParameters", + parameters: _models.RedisLinkedServerCreateParameters, **kwargs: Any - ) -> AsyncLROPoller["_models.RedisLinkedServerWithProperties"]: + ) -> AsyncLROPoller[_models.RedisLinkedServerWithProperties]: """Adds a linked server to the Redis cache (requires Premium SKU). :param resource_group_name: The name of the resource group. @@ -133,36 +142,48 @@ async def begin_create( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redis.models.RedisLinkedServerWithProperties] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisLinkedServerWithProperties"] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisLinkedServerWithProperties] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_initial( + raw_result = await self._create_initial( # type: ignore resource_group_name=resource_group_name, name=name, linked_server_name=linked_server_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('RedisLinkedServerWithProperties', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -171,63 +192,136 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}'} # type: ignore + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}"} # type: ignore - @distributed_trace_async - async def delete( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, name: str, linked_server_name: str, **kwargs: Any ) -> None: - """Deletes the linked server from a redis cache (requires Premium SKU). - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param name: The name of the redis cache. - :type name: str - :param linked_server_name: The name of the linked server that is being added to the Redis - cache. - :type linked_server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] - request = build_delete_request( + request = build_delete_request_initial( resource_group_name=resource_group_name, name=name, linked_server_name=linked_server_name, subscription_id=self._config.subscription_id, - template_url=self.delete.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + name: str, + linked_server_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the linked server from a redis cache (requires Premium SKU). + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param name: The name of the redis cache. + :type name: str + :param linked_server_name: The name of the linked server that is being added to the Redis + cache. + :type linked_server_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + name=name, + linked_server_name=linked_server_name, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}"} # type: ignore @distributed_trace_async async def get( @@ -236,7 +330,7 @@ async def get( name: str, linked_server_name: str, **kwargs: Any - ) -> "_models.RedisLinkedServerWithProperties": + ) -> _models.RedisLinkedServerWithProperties: """Gets the detailed information about a linked server of a redis cache (requires Premium SKU). :param resource_group_name: The name of the resource group. @@ -250,11 +344,16 @@ async def get( :rtype: ~azure.mgmt.redis.models.RedisLinkedServerWithProperties :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisLinkedServerWithProperties"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisLinkedServerWithProperties] request = build_get_request( @@ -262,12 +361,19 @@ async def get( name=name, linked_server_name=linked_server_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -282,7 +388,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}"} # type: ignore @distributed_trace @@ -291,7 +397,7 @@ def list( resource_group_name: str, name: str, **kwargs: Any - ) -> AsyncIterable["_models.RedisLinkedServerWithPropertiesList"]: + ) -> AsyncIterable[_models.RedisLinkedServerWithPropertiesList]: """Gets the list of linked servers associated with this redis cache (requires Premium SKU). :param resource_group_name: The name of the resource group. @@ -305,11 +411,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redis.models.RedisLinkedServerWithPropertiesList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisLinkedServerWithPropertiesList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisLinkedServerWithPropertiesList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -317,10 +428,13 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -328,10 +442,13 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -345,7 +462,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -359,4 +480,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers"} # type: ignore diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_operations.py index 6f259db2b688..f8d47f938eaa 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -25,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.redis.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.redis.aio.RedisManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Lists all of the available REST API operations of the Microsoft.Cache provider. :keyword callable cls: A custom type or function that will be passed the direct response @@ -58,27 +55,38 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redis.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -92,7 +100,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -106,4 +118,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.Cache/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.Cache/operations"} # type: ignore diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_patch.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_patch_schedules_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_patch_schedules_operations.py index d250c819215a..a9c465998864 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_patch_schedules_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_patch_schedules_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -25,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PatchSchedulesOperations: - """PatchSchedulesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.redis.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.redis.aio.RedisManagementClient`'s + :attr:`patch_schedules` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_by_redis_resource( @@ -52,7 +50,7 @@ def list_by_redis_resource( resource_group_name: str, cache_name: str, **kwargs: Any - ) -> AsyncIterable["_models.RedisPatchScheduleListResult"]: + ) -> AsyncIterable[_models.RedisPatchScheduleListResult]: """Gets all patch schedules in the specified redis cache (there is only one). :param resource_group_name: The name of the resource group. @@ -66,11 +64,16 @@ def list_by_redis_resource( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redis.models.RedisPatchScheduleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisPatchScheduleListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisPatchScheduleListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -78,10 +81,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cache_name=cache_name, + api_version=api_version, template_url=self.list_by_redis_resource.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -89,10 +95,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cache_name=cache_name, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -106,7 +115,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -120,7 +133,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_redis_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/patchSchedules'} # type: ignore + list_by_redis_resource.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/patchSchedules"} # type: ignore @distributed_trace_async async def create_or_update( @@ -128,9 +141,9 @@ async def create_or_update( resource_group_name: str, name: str, default: Union[str, "_models.DefaultName"], - parameters: "_models.RedisPatchSchedule", + parameters: _models.RedisPatchSchedule, **kwargs: Any - ) -> "_models.RedisPatchSchedule": + ) -> _models.RedisPatchSchedule: """Create or replace the patching schedule for Redis cache. :param resource_group_name: The name of the resource group. @@ -146,13 +159,17 @@ async def create_or_update( :rtype: ~azure.mgmt.redis.models.RedisPatchSchedule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisPatchSchedule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisPatchSchedule] _json = self._serialize.body(parameters, 'RedisPatchSchedule') @@ -161,14 +178,21 @@ async def create_or_update( name=name, default=default, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -187,11 +211,11 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, name: str, @@ -211,11 +235,16 @@ async def delete( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -223,12 +252,19 @@ async def delete( name=name, default=default, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -239,7 +275,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}"} # type: ignore @distributed_trace_async @@ -249,7 +285,7 @@ async def get( name: str, default: Union[str, "_models.DefaultName"], **kwargs: Any - ) -> "_models.RedisPatchSchedule": + ) -> _models.RedisPatchSchedule: """Gets the patching schedule of a redis cache. :param resource_group_name: The name of the resource group. @@ -263,11 +299,16 @@ async def get( :rtype: ~azure.mgmt.redis.models.RedisPatchSchedule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisPatchSchedule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisPatchSchedule] request = build_get_request( @@ -275,12 +316,19 @@ async def get( name=name, default=default, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -295,5 +343,5 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}"} # type: ignore diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_private_endpoint_connections_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_private_endpoint_connections_operations.py index 29d4b20b6a2a..3b30c530c532 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_private_endpoint_connections_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -17,6 +16,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -27,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.redis.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.redis.aio.RedisManagementClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -54,7 +52,7 @@ def list( resource_group_name: str, cache_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PrivateEndpointConnectionListResult"]: + ) -> AsyncIterable[_models.PrivateEndpointConnectionListResult]: """List all the private endpoint connections associated with the redis cache. :param resource_group_name: The name of the resource group. @@ -68,11 +66,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redis.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -80,10 +83,13 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cache_name=cache_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -91,10 +97,13 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cache_name=cache_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -108,7 +117,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -122,7 +135,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections"} # type: ignore @distributed_trace_async async def get( @@ -131,7 +144,7 @@ async def get( cache_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection associated with the redis cache. :param resource_group_name: The name of the resource group. @@ -146,11 +159,16 @@ async def get( :rtype: ~azure.mgmt.redis.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -158,12 +176,19 @@ async def get( cache_name=cache_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -178,7 +203,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _put_initial( @@ -186,16 +211,20 @@ async def _put_initial( resource_group_name: str, cache_name: str, private_endpoint_connection_name: str, - properties: "_models.PrivateEndpointConnection", + properties: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + ) -> _models.PrivateEndpointConnection: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(properties, 'PrivateEndpointConnection') @@ -204,14 +233,21 @@ async def _put_initial( cache_name=cache_name, subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._put_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -225,7 +261,7 @@ async def _put_initial( return deserialized - _put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async @@ -234,9 +270,9 @@ async def begin_put( resource_group_name: str, cache_name: str, private_endpoint_connection_name: str, - properties: "_models.PrivateEndpointConnection", + properties: _models.PrivateEndpointConnection, **kwargs: Any - ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: """Update the state of specified private endpoint connection associated with the redis cache. :param resource_group_name: The name of the resource group. @@ -261,36 +297,48 @@ async def begin_put( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redis.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._put_initial( + raw_result = await self._put_initial( # type: ignore resource_group_name=resource_group_name, cache_name=cache_name, private_endpoint_connection_name=private_endpoint_connection_name, properties=properties, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -299,13 +347,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -326,11 +373,16 @@ async def delete( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -338,12 +390,19 @@ async def delete( cache_name=cache_name, subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -354,5 +413,5 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_private_link_resources_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_private_link_resources_operations.py index 7c23b2675a57..59971b9cfd63 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_private_link_resources_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_private_link_resources_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -25,26 +24,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.redis.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.redis.aio.RedisManagementClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_by_redis_cache( @@ -52,7 +49,7 @@ def list_by_redis_cache( resource_group_name: str, cache_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PrivateLinkResourceListResult"]: + ) -> AsyncIterable[_models.PrivateLinkResourceListResult]: """Gets the private link resources that need to be created for a redis cache. :param resource_group_name: The name of the resource group. @@ -66,11 +63,16 @@ def list_by_redis_cache( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redis.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourceListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -78,10 +80,13 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cache_name=cache_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_redis_cache.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -89,10 +94,13 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cache_name=cache_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -106,7 +114,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -120,4 +132,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_redis_cache.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateLinkResources'} # type: ignore + list_by_redis_cache.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateLinkResources"} # type: ignore diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_redis_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_redis_operations.py index 8f736c380b35..bdf671a4870d 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_redis_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_redis_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -17,41 +16,40 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request -from ...operations._redis_operations import build_check_name_availability_request, build_create_request_initial, build_delete_request_initial, build_export_data_request_initial, build_force_reboot_request, build_get_request, build_import_data_request_initial, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_keys_request, build_list_upgrade_notifications_request, build_regenerate_key_request, build_update_request +from ...operations._redis_operations import build_check_name_availability_request, build_create_request_initial, build_delete_request_initial, build_export_data_request_initial, build_force_reboot_request, build_get_request, build_import_data_request_initial, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_keys_request, build_list_upgrade_notifications_request, build_regenerate_key_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class RedisOperations: - """RedisOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.redis.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.redis.aio.RedisManagementClient`'s + :attr:`redis` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async - async def check_name_availability( + async def check_name_availability( # pylint: disable=inconsistent-return-statements self, - parameters: "_models.CheckNameAvailabilityParameters", + parameters: _models.CheckNameAvailabilityParameters, **kwargs: Any ) -> None: """Checks that the redis cache name is valid and is not already in use. @@ -64,26 +62,37 @@ async def check_name_availability( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'CheckNameAvailabilityParameters') request = build_check_name_availability_request( subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.check_name_availability.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -94,7 +103,7 @@ async def check_name_availability( if cls: return cls(pipeline_response, None, {}) - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cache/CheckNameAvailability'} # type: ignore + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/CheckNameAvailability"} # type: ignore @distributed_trace @@ -104,7 +113,7 @@ def list_upgrade_notifications( name: str, history: float, **kwargs: Any - ) -> AsyncIterable["_models.NotificationListResponse"]: + ) -> AsyncIterable[_models.NotificationListResponse]: """Gets any upgrade notifications for a Redis cache. :param resource_group_name: The name of the resource group. @@ -120,11 +129,16 @@ def list_upgrade_notifications( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redis.models.NotificationListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NotificationListResponse"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.NotificationListResponse] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -132,11 +146,14 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, + api_version=api_version, history=history, template_url=self.list_upgrade_notifications.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -144,11 +161,14 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, + api_version=api_version, history=history, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -162,7 +182,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -176,22 +200,26 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_upgrade_notifications.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/listUpgradeNotifications'} # type: ignore + list_upgrade_notifications.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/listUpgradeNotifications"} # type: ignore async def _create_initial( self, resource_group_name: str, name: str, - parameters: "_models.RedisCreateParameters", + parameters: _models.RedisCreateParameters, **kwargs: Any - ) -> "_models.RedisResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisResource"] + ) -> _models.RedisResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisResource] _json = self._serialize.body(parameters, 'RedisCreateParameters') @@ -199,14 +227,21 @@ async def _create_initial( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -224,7 +259,7 @@ async def _create_initial( return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}'} # type: ignore + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}"} # type: ignore @distributed_trace_async @@ -232,9 +267,9 @@ async def begin_create( self, resource_group_name: str, name: str, - parameters: "_models.RedisCreateParameters", + parameters: _models.RedisCreateParameters, **kwargs: Any - ) -> AsyncLROPoller["_models.RedisResource"]: + ) -> AsyncLROPoller[_models.RedisResource]: """Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. :param resource_group_name: The name of the resource group. @@ -256,35 +291,47 @@ async def begin_create( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redis.models.RedisResource] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisResource"] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisResource] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_initial( + raw_result = await self._create_initial( # type: ignore resource_group_name=resource_group_name, name=name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('RedisResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -293,94 +340,187 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}'} # type: ignore + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}"} # type: ignore - @distributed_trace_async - async def update( + async def _update_initial( self, resource_group_name: str, name: str, - parameters: "_models.RedisUpdateParameters", + parameters: _models.RedisUpdateParameters, **kwargs: Any - ) -> "_models.RedisResource": - """Update an existing Redis cache. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param name: The name of the Redis cache. - :type name: str - :param parameters: Parameters supplied to the Update Redis operation. - :type parameters: ~azure.mgmt.redis.models.RedisUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RedisResource, or the result of cls(response) - :rtype: ~azure.mgmt.redis.models.RedisResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisResource"] + ) -> _models.RedisResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisResource] _json = self._serialize.body(parameters, 'RedisUpdateParameters') - request = build_update_request( + request = build_update_request_initial( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('RedisResource', pipeline_response) + if response.status_code == 200: + deserialized = self._deserialize('RedisResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('RedisResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}"} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + name: str, + parameters: _models.RedisUpdateParameters, + **kwargs: Any + ) -> AsyncLROPoller[_models.RedisResource]: + """Update an existing Redis cache. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param name: The name of the Redis cache. + :type name: str + :param parameters: Parameters supplied to the Update Redis operation. + :type parameters: ~azure.mgmt.redis.models.RedisUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RedisResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redis.models.RedisResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisResource] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( # type: ignore + resource_group_name=resource_group_name, + name=name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('RedisResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized - async def _delete_initial( + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -390,11 +530,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, name: str, @@ -418,18 +558,25 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, name=name, + api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -439,8 +586,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -449,10 +602,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}"} # type: ignore @distributed_trace_async async def get( @@ -460,7 +612,7 @@ async def get( resource_group_name: str, name: str, **kwargs: Any - ) -> "_models.RedisResource": + ) -> _models.RedisResource: """Gets a Redis cache (resource description). :param resource_group_name: The name of the resource group. @@ -472,23 +624,35 @@ async def get( :rtype: ~azure.mgmt.redis.models.RedisResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisResource] request = build_get_request( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -503,7 +667,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}"} # type: ignore @distributed_trace @@ -511,7 +675,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.RedisListResult"]: + ) -> AsyncIterable[_models.RedisListResult]: """Lists all Redis caches in a resource group. :param resource_group_name: The name of the resource group. @@ -521,31 +685,42 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redis.models.RedisListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -559,7 +734,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -573,13 +752,13 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis"} # type: ignore @distributed_trace def list_by_subscription( self, **kwargs: Any - ) -> AsyncIterable["_models.RedisListResult"]: + ) -> AsyncIterable[_models.RedisListResult]: """Gets all Redis caches in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -587,29 +766,40 @@ def list_by_subscription( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redis.models.RedisListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -623,7 +813,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -637,7 +831,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cache/redis'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/redis"} # type: ignore @distributed_trace_async async def list_keys( @@ -645,7 +839,7 @@ async def list_keys( resource_group_name: str, name: str, **kwargs: Any - ) -> "_models.RedisAccessKeys": + ) -> _models.RedisAccessKeys: """Retrieve a Redis cache's access keys. This operation requires write permission to the cache resource. @@ -658,23 +852,35 @@ async def list_keys( :rtype: ~azure.mgmt.redis.models.RedisAccessKeys :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisAccessKeys"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisAccessKeys] request = build_list_keys_request( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_keys.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -689,7 +895,7 @@ async def list_keys( return deserialized - list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/listKeys'} # type: ignore + list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/listKeys"} # type: ignore @distributed_trace_async @@ -697,9 +903,9 @@ async def regenerate_key( self, resource_group_name: str, name: str, - parameters: "_models.RedisRegenerateKeyParameters", + parameters: _models.RedisRegenerateKeyParameters, **kwargs: Any - ) -> "_models.RedisAccessKeys": + ) -> _models.RedisAccessKeys: """Regenerate Redis cache's access keys. This operation requires write permission to the cache resource. @@ -714,13 +920,17 @@ async def regenerate_key( :rtype: ~azure.mgmt.redis.models.RedisAccessKeys :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisAccessKeys"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisAccessKeys] _json = self._serialize.body(parameters, 'RedisRegenerateKeyParameters') @@ -728,14 +938,21 @@ async def regenerate_key( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.regenerate_key.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -750,7 +967,7 @@ async def regenerate_key( return deserialized - regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/regenerateKey'} # type: ignore + regenerate_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/regenerateKey"} # type: ignore @distributed_trace_async @@ -758,9 +975,9 @@ async def force_reboot( self, resource_group_name: str, name: str, - parameters: "_models.RedisRebootParameters", + parameters: _models.RedisRebootParameters, **kwargs: Any - ) -> "_models.RedisForceRebootResponse": + ) -> _models.RedisForceRebootResponse: """Reboot specified Redis node(s). This operation requires write permission to the cache resource. There can be potential data loss. @@ -775,13 +992,17 @@ async def force_reboot( :rtype: ~azure.mgmt.redis.models.RedisForceRebootResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisForceRebootResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisForceRebootResponse] _json = self._serialize.body(parameters, 'RedisRebootParameters') @@ -789,14 +1010,21 @@ async def force_reboot( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.force_reboot.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -811,23 +1039,27 @@ async def force_reboot( return deserialized - force_reboot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/forceReboot'} # type: ignore + force_reboot.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/forceReboot"} # type: ignore - async def _import_data_initial( + async def _import_data_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, name: str, - parameters: "_models.ImportRDBParameters", + parameters: _models.ImportRDBParameters, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ImportRDBParameters') @@ -835,14 +1067,21 @@ async def _import_data_initial( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._import_data_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -852,15 +1091,15 @@ async def _import_data_initial( if cls: return cls(pipeline_response, None, {}) - _import_data_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/import'} # type: ignore + _import_data_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/import"} # type: ignore @distributed_trace_async - async def begin_import_data( + async def begin_import_data( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, name: str, - parameters: "_models.ImportRDBParameters", + parameters: _models.ImportRDBParameters, **kwargs: Any ) -> AsyncLROPoller[None]: """Import data into Redis cache. @@ -883,21 +1122,28 @@ async def begin_import_data( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._import_data_initial( + raw_result = await self._import_data_initial( # type: ignore resource_group_name=resource_group_name, name=name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -907,8 +1153,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -917,25 +1169,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_import_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/import'} # type: ignore + begin_import_data.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/import"} # type: ignore - async def _export_data_initial( + async def _export_data_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, name: str, - parameters: "_models.ExportRDBParameters", + parameters: _models.ExportRDBParameters, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ExportRDBParameters') @@ -943,14 +1198,21 @@ async def _export_data_initial( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._export_data_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -960,15 +1222,15 @@ async def _export_data_initial( if cls: return cls(pipeline_response, None, {}) - _export_data_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/export'} # type: ignore + _export_data_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/export"} # type: ignore @distributed_trace_async - async def begin_export_data( + async def begin_export_data( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, name: str, - parameters: "_models.ExportRDBParameters", + parameters: _models.ExportRDBParameters, **kwargs: Any ) -> AsyncLROPoller[None]: """Export data from the redis cache to blobs in a container. @@ -991,21 +1253,28 @@ async def begin_export_data( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._export_data_initial( + raw_result = await self._export_data_initial( # type: ignore resource_group_name=resource_group_name, name=name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1015,8 +1284,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1025,7 +1300,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_export_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/export'} # type: ignore + begin_export_data.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/export"} # type: ignore diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/__init__.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/__init__.py index f0e8f2ee0056..f2698157108a 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/__init__.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/__init__.py @@ -6,106 +6,59 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import CheckNameAvailabilityParameters - from ._models_py3 import ErrorAdditionalInfo - from ._models_py3 import ErrorDetail - from ._models_py3 import ErrorResponse - from ._models_py3 import ExportRDBParameters - from ._models_py3 import ImportRDBParameters - from ._models_py3 import ManagedServiceIdentity - from ._models_py3 import NotificationListResponse - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import PrivateEndpoint - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateEndpointConnectionListResult - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkResourceListResult - from ._models_py3 import PrivateLinkServiceConnectionState - from ._models_py3 import ProxyResource - from ._models_py3 import RedisAccessKeys - from ._models_py3 import RedisCommonProperties - from ._models_py3 import RedisCommonPropertiesRedisConfiguration - from ._models_py3 import RedisCreateParameters - from ._models_py3 import RedisCreateProperties - from ._models_py3 import RedisFirewallRule - from ._models_py3 import RedisFirewallRuleCreateParameters - from ._models_py3 import RedisFirewallRuleListResult - from ._models_py3 import RedisForceRebootResponse - from ._models_py3 import RedisInstanceDetails - from ._models_py3 import RedisLinkedServer - from ._models_py3 import RedisLinkedServerCreateParameters - from ._models_py3 import RedisLinkedServerCreateProperties - from ._models_py3 import RedisLinkedServerProperties - from ._models_py3 import RedisLinkedServerWithProperties - from ._models_py3 import RedisLinkedServerWithPropertiesList - from ._models_py3 import RedisListResult - from ._models_py3 import RedisPatchSchedule - from ._models_py3 import RedisPatchScheduleListResult - from ._models_py3 import RedisProperties - from ._models_py3 import RedisRebootParameters - from ._models_py3 import RedisRegenerateKeyParameters - from ._models_py3 import RedisResource - from ._models_py3 import RedisUpdateParameters - from ._models_py3 import RedisUpdateProperties - from ._models_py3 import Resource - from ._models_py3 import ScheduleEntry - from ._models_py3 import Sku - from ._models_py3 import TrackedResource - from ._models_py3 import UpgradeNotification - from ._models_py3 import UserAssignedIdentity -except (SyntaxError, ImportError): - from ._models import CheckNameAvailabilityParameters # type: ignore - from ._models import ErrorAdditionalInfo # type: ignore - from ._models import ErrorDetail # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import ExportRDBParameters # type: ignore - from ._models import ImportRDBParameters # type: ignore - from ._models import ManagedServiceIdentity # type: ignore - from ._models import NotificationListResponse # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import PrivateEndpoint # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateEndpointConnectionListResult # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkResourceListResult # type: ignore - from ._models import PrivateLinkServiceConnectionState # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import RedisAccessKeys # type: ignore - from ._models import RedisCommonProperties # type: ignore - from ._models import RedisCommonPropertiesRedisConfiguration # type: ignore - from ._models import RedisCreateParameters # type: ignore - from ._models import RedisCreateProperties # type: ignore - from ._models import RedisFirewallRule # type: ignore - from ._models import RedisFirewallRuleCreateParameters # type: ignore - from ._models import RedisFirewallRuleListResult # type: ignore - from ._models import RedisForceRebootResponse # type: ignore - from ._models import RedisInstanceDetails # type: ignore - from ._models import RedisLinkedServer # type: ignore - from ._models import RedisLinkedServerCreateParameters # type: ignore - from ._models import RedisLinkedServerCreateProperties # type: ignore - from ._models import RedisLinkedServerProperties # type: ignore - from ._models import RedisLinkedServerWithProperties # type: ignore - from ._models import RedisLinkedServerWithPropertiesList # type: ignore - from ._models import RedisListResult # type: ignore - from ._models import RedisPatchSchedule # type: ignore - from ._models import RedisPatchScheduleListResult # type: ignore - from ._models import RedisProperties # type: ignore - from ._models import RedisRebootParameters # type: ignore - from ._models import RedisRegenerateKeyParameters # type: ignore - from ._models import RedisResource # type: ignore - from ._models import RedisUpdateParameters # type: ignore - from ._models import RedisUpdateProperties # type: ignore - from ._models import Resource # type: ignore - from ._models import ScheduleEntry # type: ignore - from ._models import Sku # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import UpgradeNotification # type: ignore - from ._models import UserAssignedIdentity # type: ignore +from ._models_py3 import CheckNameAvailabilityParameters +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorDetailAutoGenerated +from ._models_py3 import ErrorResponse +from ._models_py3 import ExportRDBParameters +from ._models_py3 import ImportRDBParameters +from ._models_py3 import ManagedServiceIdentity +from ._models_py3 import NotificationListResponse +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import OperationStatus +from ._models_py3 import OperationStatusResult +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import ProxyResource +from ._models_py3 import RedisAccessKeys +from ._models_py3 import RedisCommonProperties +from ._models_py3 import RedisCommonPropertiesRedisConfiguration +from ._models_py3 import RedisCreateParameters +from ._models_py3 import RedisCreateProperties +from ._models_py3 import RedisFirewallRule +from ._models_py3 import RedisFirewallRuleCreateParameters +from ._models_py3 import RedisFirewallRuleListResult +from ._models_py3 import RedisForceRebootResponse +from ._models_py3 import RedisInstanceDetails +from ._models_py3 import RedisLinkedServer +from ._models_py3 import RedisLinkedServerCreateParameters +from ._models_py3 import RedisLinkedServerCreateProperties +from ._models_py3 import RedisLinkedServerProperties +from ._models_py3 import RedisLinkedServerWithProperties +from ._models_py3 import RedisLinkedServerWithPropertiesList +from ._models_py3 import RedisListResult +from ._models_py3 import RedisPatchSchedule +from ._models_py3 import RedisPatchScheduleListResult +from ._models_py3 import RedisProperties +from ._models_py3 import RedisRebootParameters +from ._models_py3 import RedisRegenerateKeyParameters +from ._models_py3 import RedisResource +from ._models_py3 import RedisUpdateParameters +from ._models_py3 import RedisUpdateProperties +from ._models_py3 import Resource +from ._models_py3 import ScheduleEntry +from ._models_py3 import Sku +from ._models_py3 import TrackedResource +from ._models_py3 import UpgradeNotification +from ._models_py3 import UserAssignedIdentity + from ._redis_management_client_enums import ( DayOfWeek, @@ -122,11 +75,14 @@ SkuName, TlsVersion, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'CheckNameAvailabilityParameters', 'ErrorAdditionalInfo', 'ErrorDetail', + 'ErrorDetailAutoGenerated', 'ErrorResponse', 'ExportRDBParameters', 'ImportRDBParameters', @@ -135,6 +91,8 @@ 'Operation', 'OperationDisplay', 'OperationListResult', + 'OperationStatus', + 'OperationStatusResult', 'PrivateEndpoint', 'PrivateEndpointConnection', 'PrivateEndpointConnectionListResult', @@ -187,3 +145,5 @@ 'SkuName', 'TlsVersion', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/_models.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/_models.py deleted file mode 100644 index ef495d334f91..000000000000 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/_models.py +++ /dev/null @@ -1,2625 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class CheckNameAvailabilityParameters(msrest.serialization.Model): - """Parameters body to pass for resource name availability check. - - All required parameters must be populated in order to send to Azure. - - :ivar name: Required. Resource name. - :vartype name: str - :ivar type: Required. Resource type. The only legal value of this property for checking redis - cache name availability is 'Microsoft.Cache/redis'. - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword name: Required. Resource name. - :paramtype name: str - :keyword type: Required. Resource type. The only legal value of this property for checking - redis cache name availability is 'Microsoft.Cache/redis'. - :paramtype type: str - """ - super(CheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - self.type = kwargs['type'] - - -class ErrorAdditionalInfo(msrest.serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: any - """ - - _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(ErrorAdditionalInfo, self).__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(msrest.serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.mgmt.redis.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.redis.models.ErrorAdditionalInfo] - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetail]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(ErrorDetail, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(msrest.serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - - :ivar error: The error object. - :vartype error: ~azure.mgmt.redis.models.ErrorDetail - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.redis.models.ErrorDetail - """ - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class ExportRDBParameters(msrest.serialization.Model): - """Parameters for Redis export operation. - - All required parameters must be populated in order to send to Azure. - - :ivar format: File format. - :vartype format: str - :ivar prefix: Required. Prefix to use for exported files. - :vartype prefix: str - :ivar container: Required. Container name to export to. - :vartype container: str - """ - - _validation = { - 'prefix': {'required': True}, - 'container': {'required': True}, - } - - _attribute_map = { - 'format': {'key': 'format', 'type': 'str'}, - 'prefix': {'key': 'prefix', 'type': 'str'}, - 'container': {'key': 'container', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword format: File format. - :paramtype format: str - :keyword prefix: Required. Prefix to use for exported files. - :paramtype prefix: str - :keyword container: Required. Container name to export to. - :paramtype container: str - """ - super(ExportRDBParameters, self).__init__(**kwargs) - self.format = kwargs.get('format', None) - self.prefix = kwargs['prefix'] - self.container = kwargs['container'] - - -class ImportRDBParameters(msrest.serialization.Model): - """Parameters for Redis import operation. - - All required parameters must be populated in order to send to Azure. - - :ivar format: File format. - :vartype format: str - :ivar files: Required. files to import. - :vartype files: list[str] - """ - - _validation = { - 'files': {'required': True}, - } - - _attribute_map = { - 'format': {'key': 'format', 'type': 'str'}, - 'files': {'key': 'files', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword format: File format. - :paramtype format: str - :keyword files: Required. files to import. - :paramtype files: list[str] - """ - super(ImportRDBParameters, self).__init__(**kwargs) - self.format = kwargs.get('format', None) - self.files = kwargs['files'] - - -class ManagedServiceIdentity(msrest.serialization.Model): - """Managed service identity (system assigned and/or user assigned identities). - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar principal_id: The service principal ID of the system assigned identity. This property - will only be provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :ivar type: Required. Type of managed service identity (where both SystemAssigned and - UserAssigned types are allowed). Possible values include: "None", "SystemAssigned", - "UserAssigned", "SystemAssigned, UserAssigned". - :vartype type: str or ~azure.mgmt.redis.models.ManagedServiceIdentityType - :ivar user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - The dictionary values can be empty objects ({}) in requests. - :vartype user_assigned_identities: dict[str, ~azure.mgmt.redis.models.UserAssignedIdentity] - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentity}'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword type: Required. Type of managed service identity (where both SystemAssigned and - UserAssigned types are allowed). Possible values include: "None", "SystemAssigned", - "UserAssigned", "SystemAssigned, UserAssigned". - :paramtype type: str or ~azure.mgmt.redis.models.ManagedServiceIdentityType - :keyword user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - The dictionary values can be empty objects ({}) in requests. - :paramtype user_assigned_identities: dict[str, ~azure.mgmt.redis.models.UserAssignedIdentity] - """ - super(ManagedServiceIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs['type'] - self.user_assigned_identities = kwargs.get('user_assigned_identities', None) - - -class NotificationListResponse(msrest.serialization.Model): - """The response of listUpgradeNotifications. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of all notifications. - :vartype value: list[~azure.mgmt.redis.models.UpgradeNotification] - :ivar next_link: Link for next set of notifications. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[UpgradeNotification]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword value: List of all notifications. - :paramtype value: list[~azure.mgmt.redis.models.UpgradeNotification] - """ - super(NotificationListResponse, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class Operation(msrest.serialization.Model): - """REST API operation. - - :ivar name: Operation name: {provider}/{resource}/{operation}. - :vartype name: str - :ivar display: The object that describes the operation. - :vartype display: ~azure.mgmt.redis.models.OperationDisplay - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword name: Operation name: {provider}/{resource}/{operation}. - :paramtype name: str - :keyword display: The object that describes the operation. - :paramtype display: ~azure.mgmt.redis.models.OperationDisplay - """ - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - - -class OperationDisplay(msrest.serialization.Model): - """The object that describes the operation. - - :ivar provider: Friendly name of the resource provider. - :vartype provider: str - :ivar operation: Operation type: read, write, delete, listKeys/action, etc. - :vartype operation: str - :ivar resource: Resource type on which the operation is performed. - :vartype resource: str - :ivar description: Friendly name of the operation. - :vartype description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword provider: Friendly name of the resource provider. - :paramtype provider: str - :keyword operation: Operation type: read, write, delete, listKeys/action, etc. - :paramtype operation: str - :keyword resource: Resource type on which the operation is performed. - :paramtype resource: str - :keyword description: Friendly name of the operation. - :paramtype description: str - """ - super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.operation = kwargs.get('operation', None) - self.resource = kwargs.get('resource', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """Result of the request to list REST API operations. It contains a list of operations and a URL nextLink to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of operations supported by the resource provider. - :vartype value: list[~azure.mgmt.redis.models.Operation] - :ivar next_link: URL to get the next set of operation list results if there are any. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword value: List of operations supported by the resource provider. - :paramtype value: list[~azure.mgmt.redis.models.Operation] - """ - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class PrivateEndpoint(msrest.serialization.Model): - """The Private Endpoint resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ARM identifier for Private Endpoint. - :vartype id: str - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(PrivateEndpoint, self).__init__(**kwargs) - self.id = None - - -class Resource(msrest.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}. - :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 - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class PrivateEndpointConnection(Resource): - """The Private Endpoint Connection resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar private_endpoint: The resource of private end point. - :vartype private_endpoint: ~azure.mgmt.redis.models.PrivateEndpoint - :ivar private_link_service_connection_state: A collection of information about the state of the - connection between service consumer and provider. - :vartype private_link_service_connection_state: - ~azure.mgmt.redis.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: The provisioning state of the private endpoint connection resource. - Possible values include: "Succeeded", "Creating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.redis.models.PrivateEndpointConnectionProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword private_endpoint: The resource of private end point. - :paramtype private_endpoint: ~azure.mgmt.redis.models.PrivateEndpoint - :keyword private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :paramtype private_link_service_connection_state: - ~azure.mgmt.redis.models.PrivateLinkServiceConnectionState - """ - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = None - - -class PrivateEndpointConnectionListResult(msrest.serialization.Model): - """List of private endpoint connection associated with the specified storage account. - - :ivar value: Array of private endpoint connections. - :vartype value: list[~azure.mgmt.redis.models.PrivateEndpointConnection] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword value: Array of private endpoint connections. - :paramtype value: list[~azure.mgmt.redis.models.PrivateEndpointConnection] - """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateLinkResource(Resource): - """A private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :ivar required_zone_names: The private link resource Private link DNS zone name. - :vartype required_zone_names: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword required_zone_names: The private link resource Private link DNS zone name. - :paramtype required_zone_names: list[str] - """ - super(PrivateLinkResource, self).__init__(**kwargs) - self.group_id = None - self.required_members = None - self.required_zone_names = kwargs.get('required_zone_names', None) - - -class PrivateLinkResourceListResult(msrest.serialization.Model): - """A list of private link resources. - - :ivar value: Array of private link resources. - :vartype value: list[~azure.mgmt.redis.models.PrivateLinkResource] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword value: Array of private link resources. - :paramtype value: list[~azure.mgmt.redis.models.PrivateLinkResource] - """ - super(PrivateLinkResourceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """A collection of information about the state of the connection between service consumer and provider. - - :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner - of the service. Possible values include: "Pending", "Approved", "Rejected". - :vartype status: str or ~azure.mgmt.redis.models.PrivateEndpointServiceConnectionStatus - :ivar description: The reason for approval/rejection of the connection. - :vartype description: str - :ivar actions_required: A message indicating if changes on the service provider require any - updates on the consumer. - :vartype actions_required: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the - owner of the service. Possible values include: "Pending", "Approved", "Rejected". - :paramtype status: str or ~azure.mgmt.redis.models.PrivateEndpointServiceConnectionStatus - :keyword description: The reason for approval/rejection of the connection. - :paramtype description: str - :keyword actions_required: A message indicating if changes on the service provider require any - updates on the consumer. - :paramtype actions_required: str - """ - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.description = kwargs.get('description', None) - self.actions_required = kwargs.get('actions_required', None) - - -class ProxyResource(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}. - :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 - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(ProxyResource, self).__init__(**kwargs) - - -class RedisAccessKeys(msrest.serialization.Model): - """Redis cache access keys. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar primary_key: The current primary key that clients can use to authenticate with Redis - cache. - :vartype primary_key: str - :ivar secondary_key: The current secondary key that clients can use to authenticate with Redis - cache. - :vartype secondary_key: str - """ - - _validation = { - 'primary_key': {'readonly': True}, - 'secondary_key': {'readonly': True}, - } - - _attribute_map = { - 'primary_key': {'key': 'primaryKey', 'type': 'str'}, - 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(RedisAccessKeys, self).__init__(**kwargs) - self.primary_key = None - self.secondary_key = None - - -class RedisCommonProperties(msrest.serialization.Model): - """Create/Update/Get common properties of the redis cache. - - :ivar redis_configuration: All Redis Settings. Few possible keys: - rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value - etc. - :vartype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration - :ivar redis_version: Redis version. Only major version will be used in PUT/PATCH request with - current valid values: (4, 6). - :vartype redis_version: str - :ivar enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. - :vartype enable_non_ssl_port: bool - :ivar replicas_per_master: The number of replicas to be created per primary. - :vartype replicas_per_master: int - :ivar replicas_per_primary: The number of replicas to be created per primary. - :vartype replicas_per_primary: int - :ivar tenant_settings: A dictionary of tenant settings. - :vartype tenant_settings: dict[str, str] - :ivar shard_count: The number of shards to be created on a Premium Cluster Cache. - :vartype shard_count: int - :ivar minimum_tls_version: Optional: requires clients to use a specified TLS version (or - higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: "1.0", "1.1", "1.2". - :vartype minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion - :ivar public_network_access: Whether or not public endpoint access is allowed for this cache. - Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private - endpoints are the exclusive access method. Default value is 'Enabled'. Possible values include: - "Enabled", "Disabled". Default value: "Enabled". - :vartype public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess - """ - - _attribute_map = { - 'redis_configuration': {'key': 'redisConfiguration', 'type': 'RedisCommonPropertiesRedisConfiguration'}, - 'redis_version': {'key': 'redisVersion', 'type': 'str'}, - 'enable_non_ssl_port': {'key': 'enableNonSslPort', 'type': 'bool'}, - 'replicas_per_master': {'key': 'replicasPerMaster', 'type': 'int'}, - 'replicas_per_primary': {'key': 'replicasPerPrimary', 'type': 'int'}, - 'tenant_settings': {'key': 'tenantSettings', 'type': '{str}'}, - 'shard_count': {'key': 'shardCount', 'type': 'int'}, - 'minimum_tls_version': {'key': 'minimumTlsVersion', 'type': 'str'}, - 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword redis_configuration: All Redis Settings. Few possible keys: - rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value - etc. - :paramtype redis_configuration: - ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration - :keyword redis_version: Redis version. Only major version will be used in PUT/PATCH request - with current valid values: (4, 6). - :paramtype redis_version: str - :keyword enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is - enabled. - :paramtype enable_non_ssl_port: bool - :keyword replicas_per_master: The number of replicas to be created per primary. - :paramtype replicas_per_master: int - :keyword replicas_per_primary: The number of replicas to be created per primary. - :paramtype replicas_per_primary: int - :keyword tenant_settings: A dictionary of tenant settings. - :paramtype tenant_settings: dict[str, str] - :keyword shard_count: The number of shards to be created on a Premium Cluster Cache. - :paramtype shard_count: int - :keyword minimum_tls_version: Optional: requires clients to use a specified TLS version (or - higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: "1.0", "1.1", "1.2". - :paramtype minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion - :keyword public_network_access: Whether or not public endpoint access is allowed for this - cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', - private endpoints are the exclusive access method. Default value is 'Enabled'. Possible values - include: "Enabled", "Disabled". Default value: "Enabled". - :paramtype public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess - """ - super(RedisCommonProperties, self).__init__(**kwargs) - self.redis_configuration = kwargs.get('redis_configuration', None) - self.redis_version = kwargs.get('redis_version', None) - self.enable_non_ssl_port = kwargs.get('enable_non_ssl_port', False) - self.replicas_per_master = kwargs.get('replicas_per_master', None) - self.replicas_per_primary = kwargs.get('replicas_per_primary', None) - self.tenant_settings = kwargs.get('tenant_settings', None) - self.shard_count = kwargs.get('shard_count', None) - self.minimum_tls_version = kwargs.get('minimum_tls_version', None) - self.public_network_access = kwargs.get('public_network_access', "Enabled") - - -class RedisCommonPropertiesRedisConfiguration(msrest.serialization.Model): - """All Redis Settings. Few possible keys: rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value etc. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar additional_properties: Unmatched properties from the message are deserialized to this - collection. - :vartype additional_properties: dict[str, any] - :ivar rdb_backup_enabled: Specifies whether the rdb backup is enabled. - :vartype rdb_backup_enabled: str - :ivar rdb_backup_frequency: Specifies the frequency for creating rdb backup. - :vartype rdb_backup_frequency: str - :ivar rdb_backup_max_snapshot_count: Specifies the maximum number of snapshots for rdb backup. - :vartype rdb_backup_max_snapshot_count: str - :ivar rdb_storage_connection_string: The storage account connection string for storing rdb - file. - :vartype rdb_storage_connection_string: str - :ivar aof_storage_connection_string0: First storage account connection string. - :vartype aof_storage_connection_string0: str - :ivar aof_storage_connection_string1: Second storage account connection string. - :vartype aof_storage_connection_string1: str - :ivar maxfragmentationmemory_reserved: Value in megabytes reserved for fragmentation per shard. - :vartype maxfragmentationmemory_reserved: str - :ivar maxmemory_policy: The eviction strategy used when your data won't fit within its memory - limit. - :vartype maxmemory_policy: str - :ivar maxmemory_reserved: Value in megabytes reserved for non-cache usage per shard e.g. - failover. - :vartype maxmemory_reserved: str - :ivar maxmemory_delta: Value in megabytes reserved for non-cache usage per shard e.g. failover. - :vartype maxmemory_delta: str - :ivar maxclients: The max clients config. - :vartype maxclients: str - :ivar preferred_data_archive_auth_method: Preferred auth method to communicate to storage - account used for data archive, specify SAS or ManagedIdentity, default value is SAS. - :vartype preferred_data_archive_auth_method: str - :ivar preferred_data_persistence_auth_method: Preferred auth method to communicate to storage - account used for data persistence, specify SAS or ManagedIdentity, default value is SAS. - :vartype preferred_data_persistence_auth_method: str - """ - - _validation = { - 'maxclients': {'readonly': True}, - 'preferred_data_archive_auth_method': {'readonly': True}, - 'preferred_data_persistence_auth_method': {'readonly': True}, - } - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'rdb_backup_enabled': {'key': 'rdb-backup-enabled', 'type': 'str'}, - 'rdb_backup_frequency': {'key': 'rdb-backup-frequency', 'type': 'str'}, - 'rdb_backup_max_snapshot_count': {'key': 'rdb-backup-max-snapshot-count', 'type': 'str'}, - 'rdb_storage_connection_string': {'key': 'rdb-storage-connection-string', 'type': 'str'}, - 'aof_storage_connection_string0': {'key': 'aof-storage-connection-string-0', 'type': 'str'}, - 'aof_storage_connection_string1': {'key': 'aof-storage-connection-string-1', 'type': 'str'}, - 'maxfragmentationmemory_reserved': {'key': 'maxfragmentationmemory-reserved', 'type': 'str'}, - 'maxmemory_policy': {'key': 'maxmemory-policy', 'type': 'str'}, - 'maxmemory_reserved': {'key': 'maxmemory-reserved', 'type': 'str'}, - 'maxmemory_delta': {'key': 'maxmemory-delta', 'type': 'str'}, - 'maxclients': {'key': 'maxclients', 'type': 'str'}, - 'preferred_data_archive_auth_method': {'key': 'preferred-data-archive-auth-method', 'type': 'str'}, - 'preferred_data_persistence_auth_method': {'key': 'preferred-data-persistence-auth-method', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword additional_properties: Unmatched properties from the message are deserialized to this - collection. - :paramtype additional_properties: dict[str, any] - :keyword rdb_backup_enabled: Specifies whether the rdb backup is enabled. - :paramtype rdb_backup_enabled: str - :keyword rdb_backup_frequency: Specifies the frequency for creating rdb backup. - :paramtype rdb_backup_frequency: str - :keyword rdb_backup_max_snapshot_count: Specifies the maximum number of snapshots for rdb - backup. - :paramtype rdb_backup_max_snapshot_count: str - :keyword rdb_storage_connection_string: The storage account connection string for storing rdb - file. - :paramtype rdb_storage_connection_string: str - :keyword aof_storage_connection_string0: First storage account connection string. - :paramtype aof_storage_connection_string0: str - :keyword aof_storage_connection_string1: Second storage account connection string. - :paramtype aof_storage_connection_string1: str - :keyword maxfragmentationmemory_reserved: Value in megabytes reserved for fragmentation per - shard. - :paramtype maxfragmentationmemory_reserved: str - :keyword maxmemory_policy: The eviction strategy used when your data won't fit within its - memory limit. - :paramtype maxmemory_policy: str - :keyword maxmemory_reserved: Value in megabytes reserved for non-cache usage per shard e.g. - failover. - :paramtype maxmemory_reserved: str - :keyword maxmemory_delta: Value in megabytes reserved for non-cache usage per shard e.g. - failover. - :paramtype maxmemory_delta: str - """ - super(RedisCommonPropertiesRedisConfiguration, self).__init__(**kwargs) - self.additional_properties = kwargs.get('additional_properties', None) - self.rdb_backup_enabled = kwargs.get('rdb_backup_enabled', None) - self.rdb_backup_frequency = kwargs.get('rdb_backup_frequency', None) - self.rdb_backup_max_snapshot_count = kwargs.get('rdb_backup_max_snapshot_count', None) - self.rdb_storage_connection_string = kwargs.get('rdb_storage_connection_string', None) - self.aof_storage_connection_string0 = kwargs.get('aof_storage_connection_string0', None) - self.aof_storage_connection_string1 = kwargs.get('aof_storage_connection_string1', None) - self.maxfragmentationmemory_reserved = kwargs.get('maxfragmentationmemory_reserved', None) - self.maxmemory_policy = kwargs.get('maxmemory_policy', None) - self.maxmemory_reserved = kwargs.get('maxmemory_reserved', None) - self.maxmemory_delta = kwargs.get('maxmemory_delta', None) - self.maxclients = None - self.preferred_data_archive_auth_method = None - self.preferred_data_persistence_auth_method = None - - -class RedisCreateParameters(msrest.serialization.Model): - """Parameters supplied to the Create Redis operation. - - All required parameters must be populated in order to send to Azure. - - :ivar zones: A list of availability zones denoting where the resource needs to come from. - :vartype zones: list[str] - :ivar location: Required. The geo-location where the resource lives. - :vartype location: str - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] - :ivar identity: The identity of the resource. - :vartype identity: ~azure.mgmt.redis.models.ManagedServiceIdentity - :ivar redis_configuration: All Redis Settings. Few possible keys: - rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value - etc. - :vartype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration - :ivar redis_version: Redis version. Only major version will be used in PUT/PATCH request with - current valid values: (4, 6). - :vartype redis_version: str - :ivar enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. - :vartype enable_non_ssl_port: bool - :ivar replicas_per_master: The number of replicas to be created per primary. - :vartype replicas_per_master: int - :ivar replicas_per_primary: The number of replicas to be created per primary. - :vartype replicas_per_primary: int - :ivar tenant_settings: A dictionary of tenant settings. - :vartype tenant_settings: dict[str, str] - :ivar shard_count: The number of shards to be created on a Premium Cluster Cache. - :vartype shard_count: int - :ivar minimum_tls_version: Optional: requires clients to use a specified TLS version (or - higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: "1.0", "1.1", "1.2". - :vartype minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion - :ivar public_network_access: Whether or not public endpoint access is allowed for this cache. - Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private - endpoints are the exclusive access method. Default value is 'Enabled'. Possible values include: - "Enabled", "Disabled". Default value: "Enabled". - :vartype public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess - :ivar sku: Required. The SKU of the Redis cache to deploy. - :vartype sku: ~azure.mgmt.redis.models.Sku - :ivar subnet_id: The full resource ID of a subnet in a virtual network to deploy the Redis - cache in. Example format: - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. - :vartype subnet_id: str - :ivar static_ip: Static IP address. Optionally, may be specified when deploying a Redis cache - inside an existing Azure Virtual Network; auto assigned by default. - :vartype static_ip: str - """ - - _validation = { - 'location': {'required': True}, - 'sku': {'required': True}, - 'subnet_id': {'pattern': r'^/subscriptions/[^/]*/resourceGroups/[^/]*/providers/Microsoft.(ClassicNetwork|Network)/virtualNetworks/[^/]*/subnets/[^/]*$'}, - 'static_ip': {'pattern': r'^\d+\.\d+\.\d+\.\d+$'}, - } - - _attribute_map = { - 'zones': {'key': 'zones', 'type': '[str]'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - 'redis_configuration': {'key': 'properties.redisConfiguration', 'type': 'RedisCommonPropertiesRedisConfiguration'}, - 'redis_version': {'key': 'properties.redisVersion', 'type': 'str'}, - 'enable_non_ssl_port': {'key': 'properties.enableNonSslPort', 'type': 'bool'}, - 'replicas_per_master': {'key': 'properties.replicasPerMaster', 'type': 'int'}, - 'replicas_per_primary': {'key': 'properties.replicasPerPrimary', 'type': 'int'}, - 'tenant_settings': {'key': 'properties.tenantSettings', 'type': '{str}'}, - 'shard_count': {'key': 'properties.shardCount', 'type': 'int'}, - 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'sku': {'key': 'properties.sku', 'type': 'Sku'}, - 'subnet_id': {'key': 'properties.subnetId', 'type': 'str'}, - 'static_ip': {'key': 'properties.staticIP', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword zones: A list of availability zones denoting where the resource needs to come from. - :paramtype zones: list[str] - :keyword location: Required. The geo-location where the resource lives. - :paramtype location: str - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] - :keyword identity: The identity of the resource. - :paramtype identity: ~azure.mgmt.redis.models.ManagedServiceIdentity - :keyword redis_configuration: All Redis Settings. Few possible keys: - rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value - etc. - :paramtype redis_configuration: - ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration - :keyword redis_version: Redis version. Only major version will be used in PUT/PATCH request - with current valid values: (4, 6). - :paramtype redis_version: str - :keyword enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is - enabled. - :paramtype enable_non_ssl_port: bool - :keyword replicas_per_master: The number of replicas to be created per primary. - :paramtype replicas_per_master: int - :keyword replicas_per_primary: The number of replicas to be created per primary. - :paramtype replicas_per_primary: int - :keyword tenant_settings: A dictionary of tenant settings. - :paramtype tenant_settings: dict[str, str] - :keyword shard_count: The number of shards to be created on a Premium Cluster Cache. - :paramtype shard_count: int - :keyword minimum_tls_version: Optional: requires clients to use a specified TLS version (or - higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: "1.0", "1.1", "1.2". - :paramtype minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion - :keyword public_network_access: Whether or not public endpoint access is allowed for this - cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', - private endpoints are the exclusive access method. Default value is 'Enabled'. Possible values - include: "Enabled", "Disabled". Default value: "Enabled". - :paramtype public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess - :keyword sku: Required. The SKU of the Redis cache to deploy. - :paramtype sku: ~azure.mgmt.redis.models.Sku - :keyword subnet_id: The full resource ID of a subnet in a virtual network to deploy the Redis - cache in. Example format: - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. - :paramtype subnet_id: str - :keyword static_ip: Static IP address. Optionally, may be specified when deploying a Redis - cache inside an existing Azure Virtual Network; auto assigned by default. - :paramtype static_ip: str - """ - super(RedisCreateParameters, self).__init__(**kwargs) - self.zones = kwargs.get('zones', None) - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.redis_configuration = kwargs.get('redis_configuration', None) - self.redis_version = kwargs.get('redis_version', None) - self.enable_non_ssl_port = kwargs.get('enable_non_ssl_port', False) - self.replicas_per_master = kwargs.get('replicas_per_master', None) - self.replicas_per_primary = kwargs.get('replicas_per_primary', None) - self.tenant_settings = kwargs.get('tenant_settings', None) - self.shard_count = kwargs.get('shard_count', None) - self.minimum_tls_version = kwargs.get('minimum_tls_version', None) - self.public_network_access = kwargs.get('public_network_access', "Enabled") - self.sku = kwargs['sku'] - self.subnet_id = kwargs.get('subnet_id', None) - self.static_ip = kwargs.get('static_ip', None) - - -class RedisCreateProperties(RedisCommonProperties): - """Properties supplied to Create Redis operation. - - All required parameters must be populated in order to send to Azure. - - :ivar redis_configuration: All Redis Settings. Few possible keys: - rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value - etc. - :vartype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration - :ivar redis_version: Redis version. Only major version will be used in PUT/PATCH request with - current valid values: (4, 6). - :vartype redis_version: str - :ivar enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. - :vartype enable_non_ssl_port: bool - :ivar replicas_per_master: The number of replicas to be created per primary. - :vartype replicas_per_master: int - :ivar replicas_per_primary: The number of replicas to be created per primary. - :vartype replicas_per_primary: int - :ivar tenant_settings: A dictionary of tenant settings. - :vartype tenant_settings: dict[str, str] - :ivar shard_count: The number of shards to be created on a Premium Cluster Cache. - :vartype shard_count: int - :ivar minimum_tls_version: Optional: requires clients to use a specified TLS version (or - higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: "1.0", "1.1", "1.2". - :vartype minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion - :ivar public_network_access: Whether or not public endpoint access is allowed for this cache. - Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private - endpoints are the exclusive access method. Default value is 'Enabled'. Possible values include: - "Enabled", "Disabled". Default value: "Enabled". - :vartype public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess - :ivar sku: Required. The SKU of the Redis cache to deploy. - :vartype sku: ~azure.mgmt.redis.models.Sku - :ivar subnet_id: The full resource ID of a subnet in a virtual network to deploy the Redis - cache in. Example format: - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. - :vartype subnet_id: str - :ivar static_ip: Static IP address. Optionally, may be specified when deploying a Redis cache - inside an existing Azure Virtual Network; auto assigned by default. - :vartype static_ip: str - """ - - _validation = { - 'sku': {'required': True}, - 'subnet_id': {'pattern': r'^/subscriptions/[^/]*/resourceGroups/[^/]*/providers/Microsoft.(ClassicNetwork|Network)/virtualNetworks/[^/]*/subnets/[^/]*$'}, - 'static_ip': {'pattern': r'^\d+\.\d+\.\d+\.\d+$'}, - } - - _attribute_map = { - 'redis_configuration': {'key': 'redisConfiguration', 'type': 'RedisCommonPropertiesRedisConfiguration'}, - 'redis_version': {'key': 'redisVersion', 'type': 'str'}, - 'enable_non_ssl_port': {'key': 'enableNonSslPort', 'type': 'bool'}, - 'replicas_per_master': {'key': 'replicasPerMaster', 'type': 'int'}, - 'replicas_per_primary': {'key': 'replicasPerPrimary', 'type': 'int'}, - 'tenant_settings': {'key': 'tenantSettings', 'type': '{str}'}, - 'shard_count': {'key': 'shardCount', 'type': 'int'}, - 'minimum_tls_version': {'key': 'minimumTlsVersion', 'type': 'str'}, - 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'subnet_id': {'key': 'subnetId', 'type': 'str'}, - 'static_ip': {'key': 'staticIP', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword redis_configuration: All Redis Settings. Few possible keys: - rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value - etc. - :paramtype redis_configuration: - ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration - :keyword redis_version: Redis version. Only major version will be used in PUT/PATCH request - with current valid values: (4, 6). - :paramtype redis_version: str - :keyword enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is - enabled. - :paramtype enable_non_ssl_port: bool - :keyword replicas_per_master: The number of replicas to be created per primary. - :paramtype replicas_per_master: int - :keyword replicas_per_primary: The number of replicas to be created per primary. - :paramtype replicas_per_primary: int - :keyword tenant_settings: A dictionary of tenant settings. - :paramtype tenant_settings: dict[str, str] - :keyword shard_count: The number of shards to be created on a Premium Cluster Cache. - :paramtype shard_count: int - :keyword minimum_tls_version: Optional: requires clients to use a specified TLS version (or - higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: "1.0", "1.1", "1.2". - :paramtype minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion - :keyword public_network_access: Whether or not public endpoint access is allowed for this - cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', - private endpoints are the exclusive access method. Default value is 'Enabled'. Possible values - include: "Enabled", "Disabled". Default value: "Enabled". - :paramtype public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess - :keyword sku: Required. The SKU of the Redis cache to deploy. - :paramtype sku: ~azure.mgmt.redis.models.Sku - :keyword subnet_id: The full resource ID of a subnet in a virtual network to deploy the Redis - cache in. Example format: - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. - :paramtype subnet_id: str - :keyword static_ip: Static IP address. Optionally, may be specified when deploying a Redis - cache inside an existing Azure Virtual Network; auto assigned by default. - :paramtype static_ip: str - """ - super(RedisCreateProperties, self).__init__(**kwargs) - self.sku = kwargs['sku'] - self.subnet_id = kwargs.get('subnet_id', None) - self.static_ip = kwargs.get('static_ip', None) - - -class RedisFirewallRule(ProxyResource): - """A firewall rule on a redis cache has a name, and describes a contiguous range of IP addresses permitted to connect. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar start_ip: Required. lowest IP address included in the range. - :vartype start_ip: str - :ivar end_ip: Required. highest IP address included in the range. - :vartype end_ip: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'start_ip': {'required': True}, - 'end_ip': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'start_ip': {'key': 'properties.startIP', 'type': 'str'}, - 'end_ip': {'key': 'properties.endIP', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword start_ip: Required. lowest IP address included in the range. - :paramtype start_ip: str - :keyword end_ip: Required. highest IP address included in the range. - :paramtype end_ip: str - """ - super(RedisFirewallRule, self).__init__(**kwargs) - self.start_ip = kwargs['start_ip'] - self.end_ip = kwargs['end_ip'] - - -class RedisFirewallRuleCreateParameters(RedisFirewallRule): - """Parameters required for creating a firewall rule on redis cache. (Note, you can just use the FirewallRule type instead now.). - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar start_ip: Required. lowest IP address included in the range. - :vartype start_ip: str - :ivar end_ip: Required. highest IP address included in the range. - :vartype end_ip: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'start_ip': {'required': True}, - 'end_ip': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'start_ip': {'key': 'properties.startIP', 'type': 'str'}, - 'end_ip': {'key': 'properties.endIP', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword start_ip: Required. lowest IP address included in the range. - :paramtype start_ip: str - :keyword end_ip: Required. highest IP address included in the range. - :paramtype end_ip: str - """ - super(RedisFirewallRuleCreateParameters, self).__init__(**kwargs) - - -class RedisFirewallRuleListResult(msrest.serialization.Model): - """The response of list firewall rules Redis operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Results of the list firewall rules operation. - :vartype value: list[~azure.mgmt.redis.models.RedisFirewallRule] - :ivar next_link: Link for next page of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RedisFirewallRule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword value: Results of the list firewall rules operation. - :paramtype value: list[~azure.mgmt.redis.models.RedisFirewallRule] - """ - super(RedisFirewallRuleListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class RedisForceRebootResponse(msrest.serialization.Model): - """Response to force reboot for Redis cache. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar message: Status message. - :vartype message: str - """ - - _validation = { - 'message': {'readonly': True}, - } - - _attribute_map = { - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(RedisForceRebootResponse, self).__init__(**kwargs) - self.message = None - - -class RedisInstanceDetails(msrest.serialization.Model): - """Details of single instance of redis. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar ssl_port: Redis instance SSL port. - :vartype ssl_port: int - :ivar non_ssl_port: If enableNonSslPort is true, provides Redis instance Non-SSL port. - :vartype non_ssl_port: int - :ivar zone: If the Cache uses availability zones, specifies availability zone where this - instance is located. - :vartype zone: str - :ivar shard_id: If clustering is enabled, the Shard ID of Redis Instance. - :vartype shard_id: int - :ivar is_master: Specifies whether the instance is a primary node. - :vartype is_master: bool - :ivar is_primary: Specifies whether the instance is a primary node. - :vartype is_primary: bool - """ - - _validation = { - 'ssl_port': {'readonly': True}, - 'non_ssl_port': {'readonly': True}, - 'zone': {'readonly': True}, - 'shard_id': {'readonly': True}, - 'is_master': {'readonly': True}, - 'is_primary': {'readonly': True}, - } - - _attribute_map = { - 'ssl_port': {'key': 'sslPort', 'type': 'int'}, - 'non_ssl_port': {'key': 'nonSslPort', 'type': 'int'}, - 'zone': {'key': 'zone', 'type': 'str'}, - 'shard_id': {'key': 'shardId', 'type': 'int'}, - 'is_master': {'key': 'isMaster', 'type': 'bool'}, - 'is_primary': {'key': 'isPrimary', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(RedisInstanceDetails, self).__init__(**kwargs) - self.ssl_port = None - self.non_ssl_port = None - self.zone = None - self.shard_id = None - self.is_master = None - self.is_primary = None - - -class RedisLinkedServer(msrest.serialization.Model): - """Linked server Id. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Linked server Id. - :vartype id: str - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(RedisLinkedServer, self).__init__(**kwargs) - self.id = None - - -class RedisLinkedServerCreateParameters(msrest.serialization.Model): - """Parameter required for creating a linked server to redis cache. - - All required parameters must be populated in order to send to Azure. - - :ivar linked_redis_cache_id: Required. Fully qualified resourceId of the linked redis cache. - :vartype linked_redis_cache_id: str - :ivar linked_redis_cache_location: Required. Location of the linked redis cache. - :vartype linked_redis_cache_location: str - :ivar server_role: Required. Role of the linked server. Possible values include: "Primary", - "Secondary". - :vartype server_role: str or ~azure.mgmt.redis.models.ReplicationRole - """ - - _validation = { - 'linked_redis_cache_id': {'required': True}, - 'linked_redis_cache_location': {'required': True}, - 'server_role': {'required': True}, - } - - _attribute_map = { - 'linked_redis_cache_id': {'key': 'properties.linkedRedisCacheId', 'type': 'str'}, - 'linked_redis_cache_location': {'key': 'properties.linkedRedisCacheLocation', 'type': 'str'}, - 'server_role': {'key': 'properties.serverRole', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword linked_redis_cache_id: Required. Fully qualified resourceId of the linked redis cache. - :paramtype linked_redis_cache_id: str - :keyword linked_redis_cache_location: Required. Location of the linked redis cache. - :paramtype linked_redis_cache_location: str - :keyword server_role: Required. Role of the linked server. Possible values include: "Primary", - "Secondary". - :paramtype server_role: str or ~azure.mgmt.redis.models.ReplicationRole - """ - super(RedisLinkedServerCreateParameters, self).__init__(**kwargs) - self.linked_redis_cache_id = kwargs['linked_redis_cache_id'] - self.linked_redis_cache_location = kwargs['linked_redis_cache_location'] - self.server_role = kwargs['server_role'] - - -class RedisLinkedServerCreateProperties(msrest.serialization.Model): - """Create properties for a linked server. - - All required parameters must be populated in order to send to Azure. - - :ivar linked_redis_cache_id: Required. Fully qualified resourceId of the linked redis cache. - :vartype linked_redis_cache_id: str - :ivar linked_redis_cache_location: Required. Location of the linked redis cache. - :vartype linked_redis_cache_location: str - :ivar server_role: Required. Role of the linked server. Possible values include: "Primary", - "Secondary". - :vartype server_role: str or ~azure.mgmt.redis.models.ReplicationRole - """ - - _validation = { - 'linked_redis_cache_id': {'required': True}, - 'linked_redis_cache_location': {'required': True}, - 'server_role': {'required': True}, - } - - _attribute_map = { - 'linked_redis_cache_id': {'key': 'linkedRedisCacheId', 'type': 'str'}, - 'linked_redis_cache_location': {'key': 'linkedRedisCacheLocation', 'type': 'str'}, - 'server_role': {'key': 'serverRole', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword linked_redis_cache_id: Required. Fully qualified resourceId of the linked redis cache. - :paramtype linked_redis_cache_id: str - :keyword linked_redis_cache_location: Required. Location of the linked redis cache. - :paramtype linked_redis_cache_location: str - :keyword server_role: Required. Role of the linked server. Possible values include: "Primary", - "Secondary". - :paramtype server_role: str or ~azure.mgmt.redis.models.ReplicationRole - """ - super(RedisLinkedServerCreateProperties, self).__init__(**kwargs) - self.linked_redis_cache_id = kwargs['linked_redis_cache_id'] - self.linked_redis_cache_location = kwargs['linked_redis_cache_location'] - self.server_role = kwargs['server_role'] - - -class RedisLinkedServerProperties(RedisLinkedServerCreateProperties): - """Properties of a linked server to be returned in get/put response. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar linked_redis_cache_id: Required. Fully qualified resourceId of the linked redis cache. - :vartype linked_redis_cache_id: str - :ivar linked_redis_cache_location: Required. Location of the linked redis cache. - :vartype linked_redis_cache_location: str - :ivar server_role: Required. Role of the linked server. Possible values include: "Primary", - "Secondary". - :vartype server_role: str or ~azure.mgmt.redis.models.ReplicationRole - :ivar provisioning_state: Terminal state of the link between primary and secondary redis cache. - :vartype provisioning_state: str - """ - - _validation = { - 'linked_redis_cache_id': {'required': True}, - 'linked_redis_cache_location': {'required': True}, - 'server_role': {'required': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'linked_redis_cache_id': {'key': 'linkedRedisCacheId', 'type': 'str'}, - 'linked_redis_cache_location': {'key': 'linkedRedisCacheLocation', 'type': 'str'}, - 'server_role': {'key': 'serverRole', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword linked_redis_cache_id: Required. Fully qualified resourceId of the linked redis cache. - :paramtype linked_redis_cache_id: str - :keyword linked_redis_cache_location: Required. Location of the linked redis cache. - :paramtype linked_redis_cache_location: str - :keyword server_role: Required. Role of the linked server. Possible values include: "Primary", - "Secondary". - :paramtype server_role: str or ~azure.mgmt.redis.models.ReplicationRole - """ - super(RedisLinkedServerProperties, self).__init__(**kwargs) - self.provisioning_state = None - - -class RedisLinkedServerWithProperties(ProxyResource): - """Response to put/get linked server (with properties) for Redis cache. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar linked_redis_cache_id: Fully qualified resourceId of the linked redis cache. - :vartype linked_redis_cache_id: str - :ivar linked_redis_cache_location: Location of the linked redis cache. - :vartype linked_redis_cache_location: str - :ivar server_role: Role of the linked server. Possible values include: "Primary", "Secondary". - :vartype server_role: str or ~azure.mgmt.redis.models.ReplicationRole - :ivar provisioning_state: Terminal state of the link between primary and secondary redis cache. - :vartype provisioning_state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'linked_redis_cache_id': {'key': 'properties.linkedRedisCacheId', 'type': 'str'}, - 'linked_redis_cache_location': {'key': 'properties.linkedRedisCacheLocation', 'type': 'str'}, - 'server_role': {'key': 'properties.serverRole', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword linked_redis_cache_id: Fully qualified resourceId of the linked redis cache. - :paramtype linked_redis_cache_id: str - :keyword linked_redis_cache_location: Location of the linked redis cache. - :paramtype linked_redis_cache_location: str - :keyword server_role: Role of the linked server. Possible values include: "Primary", - "Secondary". - :paramtype server_role: str or ~azure.mgmt.redis.models.ReplicationRole - """ - super(RedisLinkedServerWithProperties, self).__init__(**kwargs) - self.linked_redis_cache_id = kwargs.get('linked_redis_cache_id', None) - self.linked_redis_cache_location = kwargs.get('linked_redis_cache_location', None) - self.server_role = kwargs.get('server_role', None) - self.provisioning_state = None - - -class RedisLinkedServerWithPropertiesList(msrest.serialization.Model): - """List of linked servers (with properties) of a Redis cache. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of linked servers (with properties) of a Redis cache. - :vartype value: list[~azure.mgmt.redis.models.RedisLinkedServerWithProperties] - :ivar next_link: Link for next set. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RedisLinkedServerWithProperties]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword value: List of linked servers (with properties) of a Redis cache. - :paramtype value: list[~azure.mgmt.redis.models.RedisLinkedServerWithProperties] - """ - super(RedisLinkedServerWithPropertiesList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class RedisListResult(msrest.serialization.Model): - """The response of list Redis operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Redis cache instances. - :vartype value: list[~azure.mgmt.redis.models.RedisResource] - :ivar next_link: Link for next page of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RedisResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword value: List of Redis cache instances. - :paramtype value: list[~azure.mgmt.redis.models.RedisResource] - """ - super(RedisListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class RedisPatchSchedule(ProxyResource): - """Response to put/get patch schedules for Redis cache. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar schedule_entries: Required. List of patch schedules for a Redis cache. - :vartype schedule_entries: list[~azure.mgmt.redis.models.ScheduleEntry] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'schedule_entries': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'schedule_entries': {'key': 'properties.scheduleEntries', 'type': '[ScheduleEntry]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword schedule_entries: Required. List of patch schedules for a Redis cache. - :paramtype schedule_entries: list[~azure.mgmt.redis.models.ScheduleEntry] - """ - super(RedisPatchSchedule, self).__init__(**kwargs) - self.schedule_entries = kwargs['schedule_entries'] - - -class RedisPatchScheduleListResult(msrest.serialization.Model): - """The response of list patch schedules Redis operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Results of the list patch schedules operation. - :vartype value: list[~azure.mgmt.redis.models.RedisPatchSchedule] - :ivar next_link: Link for next page of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RedisPatchSchedule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword value: Results of the list patch schedules operation. - :paramtype value: list[~azure.mgmt.redis.models.RedisPatchSchedule] - """ - super(RedisPatchScheduleListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class RedisProperties(RedisCreateProperties): - """Properties of the redis cache. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar redis_configuration: All Redis Settings. Few possible keys: - rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value - etc. - :vartype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration - :ivar redis_version: Redis version. Only major version will be used in PUT/PATCH request with - current valid values: (4, 6). - :vartype redis_version: str - :ivar enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. - :vartype enable_non_ssl_port: bool - :ivar replicas_per_master: The number of replicas to be created per primary. - :vartype replicas_per_master: int - :ivar replicas_per_primary: The number of replicas to be created per primary. - :vartype replicas_per_primary: int - :ivar tenant_settings: A dictionary of tenant settings. - :vartype tenant_settings: dict[str, str] - :ivar shard_count: The number of shards to be created on a Premium Cluster Cache. - :vartype shard_count: int - :ivar minimum_tls_version: Optional: requires clients to use a specified TLS version (or - higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: "1.0", "1.1", "1.2". - :vartype minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion - :ivar public_network_access: Whether or not public endpoint access is allowed for this cache. - Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private - endpoints are the exclusive access method. Default value is 'Enabled'. Possible values include: - "Enabled", "Disabled". Default value: "Enabled". - :vartype public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess - :ivar sku: Required. The SKU of the Redis cache to deploy. - :vartype sku: ~azure.mgmt.redis.models.Sku - :ivar subnet_id: The full resource ID of a subnet in a virtual network to deploy the Redis - cache in. Example format: - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. - :vartype subnet_id: str - :ivar static_ip: Static IP address. Optionally, may be specified when deploying a Redis cache - inside an existing Azure Virtual Network; auto assigned by default. - :vartype static_ip: str - :ivar provisioning_state: Redis instance provisioning status. Possible values include: - "Creating", "Deleting", "Disabled", "Failed", "Linking", "Provisioning", - "RecoveringScaleFailure", "Scaling", "Succeeded", "Unlinking", "Unprovisioning", "Updating". - :vartype provisioning_state: str or ~azure.mgmt.redis.models.ProvisioningState - :ivar host_name: Redis host name. - :vartype host_name: str - :ivar port: Redis non-SSL port. - :vartype port: int - :ivar ssl_port: Redis SSL port. - :vartype ssl_port: int - :ivar access_keys: The keys of the Redis cache - not set if this object is not the response to - Create or Update redis cache. - :vartype access_keys: ~azure.mgmt.redis.models.RedisAccessKeys - :ivar linked_servers: List of the linked servers associated with the cache. - :vartype linked_servers: list[~azure.mgmt.redis.models.RedisLinkedServer] - :ivar instances: List of the Redis instances associated with the cache. - :vartype instances: list[~azure.mgmt.redis.models.RedisInstanceDetails] - :ivar private_endpoint_connections: List of private endpoint connection associated with the - specified redis cache. - :vartype private_endpoint_connections: list[~azure.mgmt.redis.models.PrivateEndpointConnection] - """ - - _validation = { - 'sku': {'required': True}, - 'subnet_id': {'pattern': r'^/subscriptions/[^/]*/resourceGroups/[^/]*/providers/Microsoft.(ClassicNetwork|Network)/virtualNetworks/[^/]*/subnets/[^/]*$'}, - 'static_ip': {'pattern': r'^\d+\.\d+\.\d+\.\d+$'}, - 'provisioning_state': {'readonly': True}, - 'host_name': {'readonly': True}, - 'port': {'readonly': True}, - 'ssl_port': {'readonly': True}, - 'access_keys': {'readonly': True}, - 'linked_servers': {'readonly': True}, - 'instances': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - } - - _attribute_map = { - 'redis_configuration': {'key': 'redisConfiguration', 'type': 'RedisCommonPropertiesRedisConfiguration'}, - 'redis_version': {'key': 'redisVersion', 'type': 'str'}, - 'enable_non_ssl_port': {'key': 'enableNonSslPort', 'type': 'bool'}, - 'replicas_per_master': {'key': 'replicasPerMaster', 'type': 'int'}, - 'replicas_per_primary': {'key': 'replicasPerPrimary', 'type': 'int'}, - 'tenant_settings': {'key': 'tenantSettings', 'type': '{str}'}, - 'shard_count': {'key': 'shardCount', 'type': 'int'}, - 'minimum_tls_version': {'key': 'minimumTlsVersion', 'type': 'str'}, - 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'subnet_id': {'key': 'subnetId', 'type': 'str'}, - 'static_ip': {'key': 'staticIP', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'host_name': {'key': 'hostName', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - 'ssl_port': {'key': 'sslPort', 'type': 'int'}, - 'access_keys': {'key': 'accessKeys', 'type': 'RedisAccessKeys'}, - 'linked_servers': {'key': 'linkedServers', 'type': '[RedisLinkedServer]'}, - 'instances': {'key': 'instances', 'type': '[RedisInstanceDetails]'}, - 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword redis_configuration: All Redis Settings. Few possible keys: - rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value - etc. - :paramtype redis_configuration: - ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration - :keyword redis_version: Redis version. Only major version will be used in PUT/PATCH request - with current valid values: (4, 6). - :paramtype redis_version: str - :keyword enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is - enabled. - :paramtype enable_non_ssl_port: bool - :keyword replicas_per_master: The number of replicas to be created per primary. - :paramtype replicas_per_master: int - :keyword replicas_per_primary: The number of replicas to be created per primary. - :paramtype replicas_per_primary: int - :keyword tenant_settings: A dictionary of tenant settings. - :paramtype tenant_settings: dict[str, str] - :keyword shard_count: The number of shards to be created on a Premium Cluster Cache. - :paramtype shard_count: int - :keyword minimum_tls_version: Optional: requires clients to use a specified TLS version (or - higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: "1.0", "1.1", "1.2". - :paramtype minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion - :keyword public_network_access: Whether or not public endpoint access is allowed for this - cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', - private endpoints are the exclusive access method. Default value is 'Enabled'. Possible values - include: "Enabled", "Disabled". Default value: "Enabled". - :paramtype public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess - :keyword sku: Required. The SKU of the Redis cache to deploy. - :paramtype sku: ~azure.mgmt.redis.models.Sku - :keyword subnet_id: The full resource ID of a subnet in a virtual network to deploy the Redis - cache in. Example format: - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. - :paramtype subnet_id: str - :keyword static_ip: Static IP address. Optionally, may be specified when deploying a Redis - cache inside an existing Azure Virtual Network; auto assigned by default. - :paramtype static_ip: str - """ - super(RedisProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.host_name = None - self.port = None - self.ssl_port = None - self.access_keys = None - self.linked_servers = None - self.instances = None - self.private_endpoint_connections = None - - -class RedisRebootParameters(msrest.serialization.Model): - """Specifies which Redis node(s) to reboot. - - :ivar reboot_type: Which Redis node(s) to reboot. Depending on this value data loss is - possible. Possible values include: "PrimaryNode", "SecondaryNode", "AllNodes". - :vartype reboot_type: str or ~azure.mgmt.redis.models.RebootType - :ivar shard_id: If clustering is enabled, the ID of the shard to be rebooted. - :vartype shard_id: int - :ivar ports: A list of redis instances to reboot, specified by per-instance SSL ports or - non-SSL ports. - :vartype ports: list[int] - """ - - _attribute_map = { - 'reboot_type': {'key': 'rebootType', 'type': 'str'}, - 'shard_id': {'key': 'shardId', 'type': 'int'}, - 'ports': {'key': 'ports', 'type': '[int]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword reboot_type: Which Redis node(s) to reboot. Depending on this value data loss is - possible. Possible values include: "PrimaryNode", "SecondaryNode", "AllNodes". - :paramtype reboot_type: str or ~azure.mgmt.redis.models.RebootType - :keyword shard_id: If clustering is enabled, the ID of the shard to be rebooted. - :paramtype shard_id: int - :keyword ports: A list of redis instances to reboot, specified by per-instance SSL ports or - non-SSL ports. - :paramtype ports: list[int] - """ - super(RedisRebootParameters, self).__init__(**kwargs) - self.reboot_type = kwargs.get('reboot_type', None) - self.shard_id = kwargs.get('shard_id', None) - self.ports = kwargs.get('ports', None) - - -class RedisRegenerateKeyParameters(msrest.serialization.Model): - """Specifies which Redis access keys to reset. - - All required parameters must be populated in order to send to Azure. - - :ivar key_type: Required. The Redis access key to regenerate. Possible values include: - "Primary", "Secondary". - :vartype key_type: str or ~azure.mgmt.redis.models.RedisKeyType - """ - - _validation = { - 'key_type': {'required': True}, - } - - _attribute_map = { - 'key_type': {'key': 'keyType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key_type: Required. The Redis access key to regenerate. Possible values include: - "Primary", "Secondary". - :paramtype key_type: str or ~azure.mgmt.redis.models.RedisKeyType - """ - super(RedisRegenerateKeyParameters, self).__init__(**kwargs) - self.key_type = kwargs['key_type'] - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. - :vartype location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. - :paramtype location: str - """ - super(TrackedResource, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - - -class RedisResource(TrackedResource): - """A single Redis item in List or Get Operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. - :vartype location: str - :ivar zones: A list of availability zones denoting where the resource needs to come from. - :vartype zones: list[str] - :ivar identity: The identity of the resource. - :vartype identity: ~azure.mgmt.redis.models.ManagedServiceIdentity - :ivar redis_configuration: All Redis Settings. Few possible keys: - rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value - etc. - :vartype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration - :ivar redis_version: Redis version. Only major version will be used in PUT/PATCH request with - current valid values: (4, 6). - :vartype redis_version: str - :ivar enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. - :vartype enable_non_ssl_port: bool - :ivar replicas_per_master: The number of replicas to be created per primary. - :vartype replicas_per_master: int - :ivar replicas_per_primary: The number of replicas to be created per primary. - :vartype replicas_per_primary: int - :ivar tenant_settings: A dictionary of tenant settings. - :vartype tenant_settings: dict[str, str] - :ivar shard_count: The number of shards to be created on a Premium Cluster Cache. - :vartype shard_count: int - :ivar minimum_tls_version: Optional: requires clients to use a specified TLS version (or - higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: "1.0", "1.1", "1.2". - :vartype minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion - :ivar public_network_access: Whether or not public endpoint access is allowed for this cache. - Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private - endpoints are the exclusive access method. Default value is 'Enabled'. Possible values include: - "Enabled", "Disabled". Default value: "Enabled". - :vartype public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess - :ivar sku: Required. The SKU of the Redis cache to deploy. - :vartype sku: ~azure.mgmt.redis.models.Sku - :ivar subnet_id: The full resource ID of a subnet in a virtual network to deploy the Redis - cache in. Example format: - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. - :vartype subnet_id: str - :ivar static_ip: Static IP address. Optionally, may be specified when deploying a Redis cache - inside an existing Azure Virtual Network; auto assigned by default. - :vartype static_ip: str - :ivar provisioning_state: Redis instance provisioning status. Possible values include: - "Creating", "Deleting", "Disabled", "Failed", "Linking", "Provisioning", - "RecoveringScaleFailure", "Scaling", "Succeeded", "Unlinking", "Unprovisioning", "Updating". - :vartype provisioning_state: str or ~azure.mgmt.redis.models.ProvisioningState - :ivar host_name: Redis host name. - :vartype host_name: str - :ivar port: Redis non-SSL port. - :vartype port: int - :ivar ssl_port: Redis SSL port. - :vartype ssl_port: int - :ivar access_keys: The keys of the Redis cache - not set if this object is not the response to - Create or Update redis cache. - :vartype access_keys: ~azure.mgmt.redis.models.RedisAccessKeys - :ivar linked_servers: List of the linked servers associated with the cache. - :vartype linked_servers: list[~azure.mgmt.redis.models.RedisLinkedServer] - :ivar instances: List of the Redis instances associated with the cache. - :vartype instances: list[~azure.mgmt.redis.models.RedisInstanceDetails] - :ivar private_endpoint_connections: List of private endpoint connection associated with the - specified redis cache. - :vartype private_endpoint_connections: list[~azure.mgmt.redis.models.PrivateEndpointConnection] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'sku': {'required': True}, - 'subnet_id': {'pattern': r'^/subscriptions/[^/]*/resourceGroups/[^/]*/providers/Microsoft.(ClassicNetwork|Network)/virtualNetworks/[^/]*/subnets/[^/]*$'}, - 'static_ip': {'pattern': r'^\d+\.\d+\.\d+\.\d+$'}, - 'provisioning_state': {'readonly': True}, - 'host_name': {'readonly': True}, - 'port': {'readonly': True}, - 'ssl_port': {'readonly': True}, - 'access_keys': {'readonly': True}, - 'linked_servers': {'readonly': True}, - 'instances': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - 'redis_configuration': {'key': 'properties.redisConfiguration', 'type': 'RedisCommonPropertiesRedisConfiguration'}, - 'redis_version': {'key': 'properties.redisVersion', 'type': 'str'}, - 'enable_non_ssl_port': {'key': 'properties.enableNonSslPort', 'type': 'bool'}, - 'replicas_per_master': {'key': 'properties.replicasPerMaster', 'type': 'int'}, - 'replicas_per_primary': {'key': 'properties.replicasPerPrimary', 'type': 'int'}, - 'tenant_settings': {'key': 'properties.tenantSettings', 'type': '{str}'}, - 'shard_count': {'key': 'properties.shardCount', 'type': 'int'}, - 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'sku': {'key': 'properties.sku', 'type': 'Sku'}, - 'subnet_id': {'key': 'properties.subnetId', 'type': 'str'}, - 'static_ip': {'key': 'properties.staticIP', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'host_name': {'key': 'properties.hostName', 'type': 'str'}, - 'port': {'key': 'properties.port', 'type': 'int'}, - 'ssl_port': {'key': 'properties.sslPort', 'type': 'int'}, - 'access_keys': {'key': 'properties.accessKeys', 'type': 'RedisAccessKeys'}, - 'linked_servers': {'key': 'properties.linkedServers', 'type': '[RedisLinkedServer]'}, - 'instances': {'key': 'properties.instances', 'type': '[RedisInstanceDetails]'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. - :paramtype location: str - :keyword zones: A list of availability zones denoting where the resource needs to come from. - :paramtype zones: list[str] - :keyword identity: The identity of the resource. - :paramtype identity: ~azure.mgmt.redis.models.ManagedServiceIdentity - :keyword redis_configuration: All Redis Settings. Few possible keys: - rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value - etc. - :paramtype redis_configuration: - ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration - :keyword redis_version: Redis version. Only major version will be used in PUT/PATCH request - with current valid values: (4, 6). - :paramtype redis_version: str - :keyword enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is - enabled. - :paramtype enable_non_ssl_port: bool - :keyword replicas_per_master: The number of replicas to be created per primary. - :paramtype replicas_per_master: int - :keyword replicas_per_primary: The number of replicas to be created per primary. - :paramtype replicas_per_primary: int - :keyword tenant_settings: A dictionary of tenant settings. - :paramtype tenant_settings: dict[str, str] - :keyword shard_count: The number of shards to be created on a Premium Cluster Cache. - :paramtype shard_count: int - :keyword minimum_tls_version: Optional: requires clients to use a specified TLS version (or - higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: "1.0", "1.1", "1.2". - :paramtype minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion - :keyword public_network_access: Whether or not public endpoint access is allowed for this - cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', - private endpoints are the exclusive access method. Default value is 'Enabled'. Possible values - include: "Enabled", "Disabled". Default value: "Enabled". - :paramtype public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess - :keyword sku: Required. The SKU of the Redis cache to deploy. - :paramtype sku: ~azure.mgmt.redis.models.Sku - :keyword subnet_id: The full resource ID of a subnet in a virtual network to deploy the Redis - cache in. Example format: - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. - :paramtype subnet_id: str - :keyword static_ip: Static IP address. Optionally, may be specified when deploying a Redis - cache inside an existing Azure Virtual Network; auto assigned by default. - :paramtype static_ip: str - """ - super(RedisResource, self).__init__(**kwargs) - self.zones = kwargs.get('zones', None) - self.identity = kwargs.get('identity', None) - self.redis_configuration = kwargs.get('redis_configuration', None) - self.redis_version = kwargs.get('redis_version', None) - self.enable_non_ssl_port = kwargs.get('enable_non_ssl_port', False) - self.replicas_per_master = kwargs.get('replicas_per_master', None) - self.replicas_per_primary = kwargs.get('replicas_per_primary', None) - self.tenant_settings = kwargs.get('tenant_settings', None) - self.shard_count = kwargs.get('shard_count', None) - self.minimum_tls_version = kwargs.get('minimum_tls_version', None) - self.public_network_access = kwargs.get('public_network_access', "Enabled") - self.sku = kwargs['sku'] - self.subnet_id = kwargs.get('subnet_id', None) - self.static_ip = kwargs.get('static_ip', None) - self.provisioning_state = None - self.host_name = None - self.port = None - self.ssl_port = None - self.access_keys = None - self.linked_servers = None - self.instances = None - self.private_endpoint_connections = None - - -class RedisUpdateParameters(msrest.serialization.Model): - """Parameters supplied to the Update Redis operation. - - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] - :ivar identity: The identity of the resource. - :vartype identity: ~azure.mgmt.redis.models.ManagedServiceIdentity - :ivar redis_configuration: All Redis Settings. Few possible keys: - rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value - etc. - :vartype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration - :ivar redis_version: Redis version. Only major version will be used in PUT/PATCH request with - current valid values: (4, 6). - :vartype redis_version: str - :ivar enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. - :vartype enable_non_ssl_port: bool - :ivar replicas_per_master: The number of replicas to be created per primary. - :vartype replicas_per_master: int - :ivar replicas_per_primary: The number of replicas to be created per primary. - :vartype replicas_per_primary: int - :ivar tenant_settings: A dictionary of tenant settings. - :vartype tenant_settings: dict[str, str] - :ivar shard_count: The number of shards to be created on a Premium Cluster Cache. - :vartype shard_count: int - :ivar minimum_tls_version: Optional: requires clients to use a specified TLS version (or - higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: "1.0", "1.1", "1.2". - :vartype minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion - :ivar public_network_access: Whether or not public endpoint access is allowed for this cache. - Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private - endpoints are the exclusive access method. Default value is 'Enabled'. Possible values include: - "Enabled", "Disabled". Default value: "Enabled". - :vartype public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess - :ivar sku: The SKU of the Redis cache to deploy. - :vartype sku: ~azure.mgmt.redis.models.Sku - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - 'redis_configuration': {'key': 'properties.redisConfiguration', 'type': 'RedisCommonPropertiesRedisConfiguration'}, - 'redis_version': {'key': 'properties.redisVersion', 'type': 'str'}, - 'enable_non_ssl_port': {'key': 'properties.enableNonSslPort', 'type': 'bool'}, - 'replicas_per_master': {'key': 'properties.replicasPerMaster', 'type': 'int'}, - 'replicas_per_primary': {'key': 'properties.replicasPerPrimary', 'type': 'int'}, - 'tenant_settings': {'key': 'properties.tenantSettings', 'type': '{str}'}, - 'shard_count': {'key': 'properties.shardCount', 'type': 'int'}, - 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'sku': {'key': 'properties.sku', 'type': 'Sku'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] - :keyword identity: The identity of the resource. - :paramtype identity: ~azure.mgmt.redis.models.ManagedServiceIdentity - :keyword redis_configuration: All Redis Settings. Few possible keys: - rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value - etc. - :paramtype redis_configuration: - ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration - :keyword redis_version: Redis version. Only major version will be used in PUT/PATCH request - with current valid values: (4, 6). - :paramtype redis_version: str - :keyword enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is - enabled. - :paramtype enable_non_ssl_port: bool - :keyword replicas_per_master: The number of replicas to be created per primary. - :paramtype replicas_per_master: int - :keyword replicas_per_primary: The number of replicas to be created per primary. - :paramtype replicas_per_primary: int - :keyword tenant_settings: A dictionary of tenant settings. - :paramtype tenant_settings: dict[str, str] - :keyword shard_count: The number of shards to be created on a Premium Cluster Cache. - :paramtype shard_count: int - :keyword minimum_tls_version: Optional: requires clients to use a specified TLS version (or - higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: "1.0", "1.1", "1.2". - :paramtype minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion - :keyword public_network_access: Whether or not public endpoint access is allowed for this - cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', - private endpoints are the exclusive access method. Default value is 'Enabled'. Possible values - include: "Enabled", "Disabled". Default value: "Enabled". - :paramtype public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess - :keyword sku: The SKU of the Redis cache to deploy. - :paramtype sku: ~azure.mgmt.redis.models.Sku - """ - super(RedisUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.redis_configuration = kwargs.get('redis_configuration', None) - self.redis_version = kwargs.get('redis_version', None) - self.enable_non_ssl_port = kwargs.get('enable_non_ssl_port', False) - self.replicas_per_master = kwargs.get('replicas_per_master', None) - self.replicas_per_primary = kwargs.get('replicas_per_primary', None) - self.tenant_settings = kwargs.get('tenant_settings', None) - self.shard_count = kwargs.get('shard_count', None) - self.minimum_tls_version = kwargs.get('minimum_tls_version', None) - self.public_network_access = kwargs.get('public_network_access', "Enabled") - self.sku = kwargs.get('sku', None) - - -class RedisUpdateProperties(RedisCommonProperties): - """Patchable properties of the redis cache. - - :ivar redis_configuration: All Redis Settings. Few possible keys: - rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value - etc. - :vartype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration - :ivar redis_version: Redis version. Only major version will be used in PUT/PATCH request with - current valid values: (4, 6). - :vartype redis_version: str - :ivar enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. - :vartype enable_non_ssl_port: bool - :ivar replicas_per_master: The number of replicas to be created per primary. - :vartype replicas_per_master: int - :ivar replicas_per_primary: The number of replicas to be created per primary. - :vartype replicas_per_primary: int - :ivar tenant_settings: A dictionary of tenant settings. - :vartype tenant_settings: dict[str, str] - :ivar shard_count: The number of shards to be created on a Premium Cluster Cache. - :vartype shard_count: int - :ivar minimum_tls_version: Optional: requires clients to use a specified TLS version (or - higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: "1.0", "1.1", "1.2". - :vartype minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion - :ivar public_network_access: Whether or not public endpoint access is allowed for this cache. - Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private - endpoints are the exclusive access method. Default value is 'Enabled'. Possible values include: - "Enabled", "Disabled". Default value: "Enabled". - :vartype public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess - :ivar sku: The SKU of the Redis cache to deploy. - :vartype sku: ~azure.mgmt.redis.models.Sku - """ - - _attribute_map = { - 'redis_configuration': {'key': 'redisConfiguration', 'type': 'RedisCommonPropertiesRedisConfiguration'}, - 'redis_version': {'key': 'redisVersion', 'type': 'str'}, - 'enable_non_ssl_port': {'key': 'enableNonSslPort', 'type': 'bool'}, - 'replicas_per_master': {'key': 'replicasPerMaster', 'type': 'int'}, - 'replicas_per_primary': {'key': 'replicasPerPrimary', 'type': 'int'}, - 'tenant_settings': {'key': 'tenantSettings', 'type': '{str}'}, - 'shard_count': {'key': 'shardCount', 'type': 'int'}, - 'minimum_tls_version': {'key': 'minimumTlsVersion', 'type': 'str'}, - 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword redis_configuration: All Redis Settings. Few possible keys: - rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value - etc. - :paramtype redis_configuration: - ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration - :keyword redis_version: Redis version. Only major version will be used in PUT/PATCH request - with current valid values: (4, 6). - :paramtype redis_version: str - :keyword enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is - enabled. - :paramtype enable_non_ssl_port: bool - :keyword replicas_per_master: The number of replicas to be created per primary. - :paramtype replicas_per_master: int - :keyword replicas_per_primary: The number of replicas to be created per primary. - :paramtype replicas_per_primary: int - :keyword tenant_settings: A dictionary of tenant settings. - :paramtype tenant_settings: dict[str, str] - :keyword shard_count: The number of shards to be created on a Premium Cluster Cache. - :paramtype shard_count: int - :keyword minimum_tls_version: Optional: requires clients to use a specified TLS version (or - higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: "1.0", "1.1", "1.2". - :paramtype minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion - :keyword public_network_access: Whether or not public endpoint access is allowed for this - cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', - private endpoints are the exclusive access method. Default value is 'Enabled'. Possible values - include: "Enabled", "Disabled". Default value: "Enabled". - :paramtype public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess - :keyword sku: The SKU of the Redis cache to deploy. - :paramtype sku: ~azure.mgmt.redis.models.Sku - """ - super(RedisUpdateProperties, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) - - -class ScheduleEntry(msrest.serialization.Model): - """Patch schedule entry for a Premium Redis Cache. - - All required parameters must be populated in order to send to Azure. - - :ivar day_of_week: Required. Day of the week when a cache can be patched. Possible values - include: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday", - "Everyday", "Weekend". - :vartype day_of_week: str or ~azure.mgmt.redis.models.DayOfWeek - :ivar start_hour_utc: Required. Start hour after which cache patching can start. - :vartype start_hour_utc: int - :ivar maintenance_window: ISO8601 timespan specifying how much time cache patching can take. - :vartype maintenance_window: ~datetime.timedelta - """ - - _validation = { - 'day_of_week': {'required': True}, - 'start_hour_utc': {'required': True}, - } - - _attribute_map = { - 'day_of_week': {'key': 'dayOfWeek', 'type': 'str'}, - 'start_hour_utc': {'key': 'startHourUtc', 'type': 'int'}, - 'maintenance_window': {'key': 'maintenanceWindow', 'type': 'duration'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword day_of_week: Required. Day of the week when a cache can be patched. Possible values - include: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday", - "Everyday", "Weekend". - :paramtype day_of_week: str or ~azure.mgmt.redis.models.DayOfWeek - :keyword start_hour_utc: Required. Start hour after which cache patching can start. - :paramtype start_hour_utc: int - :keyword maintenance_window: ISO8601 timespan specifying how much time cache patching can take. - :paramtype maintenance_window: ~datetime.timedelta - """ - super(ScheduleEntry, self).__init__(**kwargs) - self.day_of_week = kwargs['day_of_week'] - self.start_hour_utc = kwargs['start_hour_utc'] - self.maintenance_window = kwargs.get('maintenance_window', None) - - -class Sku(msrest.serialization.Model): - """SKU parameters supplied to the create Redis operation. - - All required parameters must be populated in order to send to Azure. - - :ivar name: Required. The type of Redis cache to deploy. Valid values: (Basic, Standard, - Premium). Possible values include: "Basic", "Standard", "Premium". - :vartype name: str or ~azure.mgmt.redis.models.SkuName - :ivar family: Required. The SKU family to use. Valid values: (C, P). (C = Basic/Standard, P = - Premium). Possible values include: "C", "P". - :vartype family: str or ~azure.mgmt.redis.models.SkuFamily - :ivar capacity: Required. The size of the Redis cache to deploy. Valid values: for C - (Basic/Standard) family (0, 1, 2, 3, 4, 5, 6), for P (Premium) family (1, 2, 3, 4). - :vartype capacity: int - """ - - _validation = { - 'name': {'required': True}, - 'family': {'required': True}, - 'capacity': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'family': {'key': 'family', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword name: Required. The type of Redis cache to deploy. Valid values: (Basic, Standard, - Premium). Possible values include: "Basic", "Standard", "Premium". - :paramtype name: str or ~azure.mgmt.redis.models.SkuName - :keyword family: Required. The SKU family to use. Valid values: (C, P). (C = Basic/Standard, P - = Premium). Possible values include: "C", "P". - :paramtype family: str or ~azure.mgmt.redis.models.SkuFamily - :keyword capacity: Required. The size of the Redis cache to deploy. Valid values: for C - (Basic/Standard) family (0, 1, 2, 3, 4, 5, 6), for P (Premium) family (1, 2, 3, 4). - :paramtype capacity: int - """ - super(Sku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.family = kwargs['family'] - self.capacity = kwargs['capacity'] - - -class UpgradeNotification(msrest.serialization.Model): - """Properties of upgrade notification. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of upgrade notification. - :vartype name: str - :ivar timestamp: Timestamp when upgrade notification occurred. - :vartype timestamp: ~datetime.datetime - :ivar upsell_notification: Details about this upgrade notification. - :vartype upsell_notification: dict[str, str] - """ - - _validation = { - 'name': {'readonly': True}, - 'timestamp': {'readonly': True}, - 'upsell_notification': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'upsell_notification': {'key': 'upsellNotification', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(UpgradeNotification, self).__init__(**kwargs) - self.name = None - self.timestamp = None - self.upsell_notification = None - - -class UserAssignedIdentity(msrest.serialization.Model): - """User assigned identity properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of the assigned identity. - :vartype principal_id: str - :ivar client_id: The client ID of the assigned identity. - :vartype client_id: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(UserAssignedIdentity, self).__init__(**kwargs) - self.principal_id = None - self.client_id = None diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/_models_py3.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/_models_py3.py index 3c7e80b9d40a..3e458b2339e7 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/_models_py3.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/_models_py3.py @@ -7,12 +7,14 @@ # -------------------------------------------------------------------------- import datetime -from typing import Any, Dict, List, Optional, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._redis_management_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class CheckNameAvailabilityParameters(msrest.serialization.Model): @@ -135,6 +137,53 @@ def __init__( self.additional_info = None +class ErrorDetailAutoGenerated(msrest.serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.redis.models.ErrorDetailAutoGenerated] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.redis.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetailAutoGenerated]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ErrorDetailAutoGenerated, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + class ErrorResponse(msrest.serialization.Model): """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). @@ -149,7 +198,7 @@ class ErrorResponse(msrest.serialization.Model): def __init__( self, *, - error: Optional["ErrorDetail"] = None, + error: Optional["_models.ErrorDetail"] = None, **kwargs ): """ @@ -171,6 +220,9 @@ class ExportRDBParameters(msrest.serialization.Model): :vartype prefix: str :ivar container: Required. Container name to export to. :vartype container: str + :ivar preferred_data_archive_auth_method: Preferred auth method to communicate to storage + account used for data archive, specify SAS or ManagedIdentity, default value is SAS. + :vartype preferred_data_archive_auth_method: str """ _validation = { @@ -182,6 +234,7 @@ class ExportRDBParameters(msrest.serialization.Model): 'format': {'key': 'format', 'type': 'str'}, 'prefix': {'key': 'prefix', 'type': 'str'}, 'container': {'key': 'container', 'type': 'str'}, + 'preferred_data_archive_auth_method': {'key': 'preferred-data-archive-auth-method', 'type': 'str'}, } def __init__( @@ -190,6 +243,7 @@ def __init__( prefix: str, container: str, format: Optional[str] = None, + preferred_data_archive_auth_method: Optional[str] = None, **kwargs ): """ @@ -199,11 +253,15 @@ def __init__( :paramtype prefix: str :keyword container: Required. Container name to export to. :paramtype container: str + :keyword preferred_data_archive_auth_method: Preferred auth method to communicate to storage + account used for data archive, specify SAS or ManagedIdentity, default value is SAS. + :paramtype preferred_data_archive_auth_method: str """ super(ExportRDBParameters, self).__init__(**kwargs) self.format = format self.prefix = prefix self.container = container + self.preferred_data_archive_auth_method = preferred_data_archive_auth_method class ImportRDBParameters(msrest.serialization.Model): @@ -215,6 +273,9 @@ class ImportRDBParameters(msrest.serialization.Model): :vartype format: str :ivar files: Required. files to import. :vartype files: list[str] + :ivar preferred_data_archive_auth_method: Preferred auth method to communicate to storage + account used for data archive, specify SAS or ManagedIdentity, default value is SAS. + :vartype preferred_data_archive_auth_method: str """ _validation = { @@ -224,6 +285,7 @@ class ImportRDBParameters(msrest.serialization.Model): _attribute_map = { 'format': {'key': 'format', 'type': 'str'}, 'files': {'key': 'files', 'type': '[str]'}, + 'preferred_data_archive_auth_method': {'key': 'preferred-data-archive-auth-method', 'type': 'str'}, } def __init__( @@ -231,6 +293,7 @@ def __init__( *, files: List[str], format: Optional[str] = None, + preferred_data_archive_auth_method: Optional[str] = None, **kwargs ): """ @@ -238,10 +301,14 @@ def __init__( :paramtype format: str :keyword files: Required. files to import. :paramtype files: list[str] + :keyword preferred_data_archive_auth_method: Preferred auth method to communicate to storage + account used for data archive, specify SAS or ManagedIdentity, default value is SAS. + :paramtype preferred_data_archive_auth_method: str """ super(ImportRDBParameters, self).__init__(**kwargs) self.format = format self.files = files + self.preferred_data_archive_auth_method = preferred_data_archive_auth_method class ManagedServiceIdentity(msrest.serialization.Model): @@ -258,8 +325,8 @@ class ManagedServiceIdentity(msrest.serialization.Model): provided for a system assigned identity. :vartype tenant_id: str :ivar type: Required. Type of managed service identity (where both SystemAssigned and - UserAssigned types are allowed). Possible values include: "None", "SystemAssigned", - "UserAssigned", "SystemAssigned, UserAssigned". + UserAssigned types are allowed). Known values are: "None", "SystemAssigned", "UserAssigned", + "SystemAssigned, UserAssigned". :vartype type: str or ~azure.mgmt.redis.models.ManagedServiceIdentityType :ivar user_assigned_identities: The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: @@ -284,14 +351,14 @@ class ManagedServiceIdentity(msrest.serialization.Model): def __init__( self, *, - type: Union[str, "ManagedServiceIdentityType"], - user_assigned_identities: Optional[Dict[str, "UserAssignedIdentity"]] = None, + type: Union[str, "_models.ManagedServiceIdentityType"], + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, **kwargs ): """ :keyword type: Required. Type of managed service identity (where both SystemAssigned and - UserAssigned types are allowed). Possible values include: "None", "SystemAssigned", - "UserAssigned", "SystemAssigned, UserAssigned". + UserAssigned types are allowed). Known values are: "None", "SystemAssigned", "UserAssigned", + "SystemAssigned, UserAssigned". :paramtype type: str or ~azure.mgmt.redis.models.ManagedServiceIdentityType :keyword user_assigned_identities: The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: @@ -329,7 +396,7 @@ class NotificationListResponse(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["UpgradeNotification"]] = None, + value: Optional[List["_models.UpgradeNotification"]] = None, **kwargs ): """ @@ -359,7 +426,7 @@ def __init__( self, *, name: Optional[str] = None, - display: Optional["OperationDisplay"] = None, + display: Optional["_models.OperationDisplay"] = None, **kwargs ): """ @@ -442,7 +509,7 @@ class OperationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Operation"]] = None, + value: Optional[List["_models.Operation"]] = None, **kwargs ): """ @@ -454,6 +521,167 @@ def __init__( self.next_link = None +class OperationStatusResult(msrest.serialization.Model): + """The current status of an async operation. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified ID for the async operation. + :vartype id: str + :ivar name: Name of the async operation. + :vartype name: str + :ivar status: Required. Operation status. + :vartype status: str + :ivar percent_complete: Percent of the operation that is complete. + :vartype percent_complete: float + :ivar start_time: The start time of the operation. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time of the operation. + :vartype end_time: ~datetime.datetime + :ivar operations: The operations list. + :vartype operations: list[~azure.mgmt.redis.models.OperationStatusResult] + :ivar error: If present, details of the operation error. + :vartype error: ~azure.mgmt.redis.models.ErrorDetailAutoGenerated + """ + + _validation = { + 'status': {'required': True}, + 'percent_complete': {'maximum': 100, 'minimum': 0}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'percent_complete': {'key': 'percentComplete', 'type': 'float'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'operations': {'key': 'operations', 'type': '[OperationStatusResult]'}, + 'error': {'key': 'error', 'type': 'ErrorDetailAutoGenerated'}, + } + + def __init__( + self, + *, + status: str, + id: Optional[str] = None, + name: Optional[str] = None, + percent_complete: Optional[float] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + operations: Optional[List["_models.OperationStatusResult"]] = None, + error: Optional["_models.ErrorDetailAutoGenerated"] = None, + **kwargs + ): + """ + :keyword id: Fully qualified ID for the async operation. + :paramtype id: str + :keyword name: Name of the async operation. + :paramtype name: str + :keyword status: Required. Operation status. + :paramtype status: str + :keyword percent_complete: Percent of the operation that is complete. + :paramtype percent_complete: float + :keyword start_time: The start time of the operation. + :paramtype start_time: ~datetime.datetime + :keyword end_time: The end time of the operation. + :paramtype end_time: ~datetime.datetime + :keyword operations: The operations list. + :paramtype operations: list[~azure.mgmt.redis.models.OperationStatusResult] + :keyword error: If present, details of the operation error. + :paramtype error: ~azure.mgmt.redis.models.ErrorDetailAutoGenerated + """ + super(OperationStatusResult, self).__init__(**kwargs) + self.id = id + self.name = name + self.status = status + self.percent_complete = percent_complete + self.start_time = start_time + self.end_time = end_time + self.operations = operations + self.error = error + + +class OperationStatus(OperationStatusResult): + """Asynchronous operation status. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified ID for the async operation. + :vartype id: str + :ivar name: Name of the async operation. + :vartype name: str + :ivar status: Required. Operation status. + :vartype status: str + :ivar percent_complete: Percent of the operation that is complete. + :vartype percent_complete: float + :ivar start_time: The start time of the operation. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time of the operation. + :vartype end_time: ~datetime.datetime + :ivar operations: The operations list. + :vartype operations: list[~azure.mgmt.redis.models.OperationStatusResult] + :ivar error: If present, details of the operation error. + :vartype error: ~azure.mgmt.redis.models.ErrorDetailAutoGenerated + :ivar properties: Additional properties from RP, only when operation is successful. + :vartype properties: dict[str, any] + """ + + _validation = { + 'status': {'required': True}, + 'percent_complete': {'maximum': 100, 'minimum': 0}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'percent_complete': {'key': 'percentComplete', 'type': 'float'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'operations': {'key': 'operations', 'type': '[OperationStatusResult]'}, + 'error': {'key': 'error', 'type': 'ErrorDetailAutoGenerated'}, + 'properties': {'key': 'properties', 'type': '{object}'}, + } + + def __init__( + self, + *, + status: str, + id: Optional[str] = None, + name: Optional[str] = None, + percent_complete: Optional[float] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + operations: Optional[List["_models.OperationStatusResult"]] = None, + error: Optional["_models.ErrorDetailAutoGenerated"] = None, + properties: Optional[Dict[str, Any]] = None, + **kwargs + ): + """ + :keyword id: Fully qualified ID for the async operation. + :paramtype id: str + :keyword name: Name of the async operation. + :paramtype name: str + :keyword status: Required. Operation status. + :paramtype status: str + :keyword percent_complete: Percent of the operation that is complete. + :paramtype percent_complete: float + :keyword start_time: The start time of the operation. + :paramtype start_time: ~datetime.datetime + :keyword end_time: The end time of the operation. + :paramtype end_time: ~datetime.datetime + :keyword operations: The operations list. + :paramtype operations: list[~azure.mgmt.redis.models.OperationStatusResult] + :keyword error: If present, details of the operation error. + :paramtype error: ~azure.mgmt.redis.models.ErrorDetailAutoGenerated + :keyword properties: Additional properties from RP, only when operation is successful. + :paramtype properties: dict[str, any] + """ + super(OperationStatus, self).__init__(id=id, name=name, status=status, percent_complete=percent_complete, start_time=start_time, end_time=end_time, operations=operations, error=error, **kwargs) + self.properties = properties + + class PrivateEndpoint(msrest.serialization.Model): """The Private Endpoint resource. @@ -540,7 +768,7 @@ class PrivateEndpointConnection(Resource): :vartype private_link_service_connection_state: ~azure.mgmt.redis.models.PrivateLinkServiceConnectionState :ivar provisioning_state: The provisioning state of the private endpoint connection resource. - Possible values include: "Succeeded", "Creating", "Deleting", "Failed". + Known values are: "Succeeded", "Creating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.redis.models.PrivateEndpointConnectionProvisioningState """ @@ -564,8 +792,8 @@ class PrivateEndpointConnection(Resource): def __init__( self, *, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ @@ -596,7 +824,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateEndpointConnection"]] = None, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs ): """ @@ -675,7 +903,7 @@ class PrivateLinkResourceListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateLinkResource"]] = None, + value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs ): """ @@ -690,7 +918,7 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): """A collection of information about the state of the connection between service consumer and provider. :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner - of the service. Possible values include: "Pending", "Approved", "Rejected". + of the service. Known values are: "Pending", "Approved", "Rejected". :vartype status: str or ~azure.mgmt.redis.models.PrivateEndpointServiceConnectionStatus :ivar description: The reason for approval/rejection of the connection. :vartype description: str @@ -708,14 +936,14 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, description: Optional[str] = None, actions_required: Optional[str] = None, **kwargs ): """ :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the - owner of the service. Possible values include: "Pending", "Approved", "Rejected". + owner of the service. Known values are: "Pending", "Approved", "Rejected". :paramtype status: str or ~azure.mgmt.redis.models.PrivateEndpointServiceConnectionStatus :keyword description: The reason for approval/rejection of the connection. :paramtype description: str @@ -806,8 +1034,9 @@ class RedisCommonProperties(msrest.serialization.Model): rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value etc. :vartype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration - :ivar redis_version: Redis version. Only major version will be used in PUT/PATCH request with - current valid values: (4, 6). + :ivar redis_version: Redis version. This should be in the form 'major[.minor]' (only 'major' is + required) or the value 'latest' which refers to the latest stable Redis version that is + available. Supported versions: 4.0, 6.0 (latest). Default value is 'latest'. :vartype redis_version: str :ivar enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. :vartype enable_non_ssl_port: bool @@ -820,11 +1049,11 @@ class RedisCommonProperties(msrest.serialization.Model): :ivar shard_count: The number of shards to be created on a Premium Cluster Cache. :vartype shard_count: int :ivar minimum_tls_version: Optional: requires clients to use a specified TLS version (or - higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: "1.0", "1.1", "1.2". + higher) to connect (e,g, '1.0', '1.1', '1.2'). Known values are: "1.0", "1.1", "1.2". :vartype minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion :ivar public_network_access: Whether or not public endpoint access is allowed for this cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private - endpoints are the exclusive access method. Default value is 'Enabled'. Possible values include: + endpoints are the exclusive access method. Default value is 'Enabled'. Known values are: "Enabled", "Disabled". Default value: "Enabled". :vartype public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess """ @@ -844,15 +1073,15 @@ class RedisCommonProperties(msrest.serialization.Model): def __init__( self, *, - redis_configuration: Optional["RedisCommonPropertiesRedisConfiguration"] = None, + redis_configuration: Optional["_models.RedisCommonPropertiesRedisConfiguration"] = None, redis_version: Optional[str] = None, enable_non_ssl_port: Optional[bool] = False, replicas_per_master: Optional[int] = None, replicas_per_primary: Optional[int] = None, tenant_settings: Optional[Dict[str, str]] = None, shard_count: Optional[int] = None, - minimum_tls_version: Optional[Union[str, "TlsVersion"]] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = "Enabled", + minimum_tls_version: Optional[Union[str, "_models.TlsVersion"]] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = "Enabled", **kwargs ): """ @@ -861,8 +1090,9 @@ def __init__( etc. :paramtype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration - :keyword redis_version: Redis version. Only major version will be used in PUT/PATCH request - with current valid values: (4, 6). + :keyword redis_version: Redis version. This should be in the form 'major[.minor]' (only 'major' + is required) or the value 'latest' which refers to the latest stable Redis version that is + available. Supported versions: 4.0, 6.0 (latest). Default value is 'latest'. :paramtype redis_version: str :keyword enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. @@ -876,12 +1106,12 @@ def __init__( :keyword shard_count: The number of shards to be created on a Premium Cluster Cache. :paramtype shard_count: int :keyword minimum_tls_version: Optional: requires clients to use a specified TLS version (or - higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: "1.0", "1.1", "1.2". + higher) to connect (e,g, '1.0', '1.1', '1.2'). Known values are: "1.0", "1.1", "1.2". :paramtype minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion :keyword public_network_access: Whether or not public endpoint access is allowed for this cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', - private endpoints are the exclusive access method. Default value is 'Enabled'. Possible values - include: "Enabled", "Disabled". Default value: "Enabled". + private endpoints are the exclusive access method. Default value is 'Enabled'. Known values + are: "Enabled", "Disabled". Default value: "Enabled". :paramtype public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess """ super(RedisCommonProperties, self).__init__(**kwargs) @@ -913,6 +1143,8 @@ class RedisCommonPropertiesRedisConfiguration(msrest.serialization.Model): :ivar rdb_storage_connection_string: The storage account connection string for storing rdb file. :vartype rdb_storage_connection_string: str + :ivar aof_backup_enabled: Specifies whether the aof backup is enabled. + :vartype aof_backup_enabled: str :ivar aof_storage_connection_string0: First storage account connection string. :vartype aof_storage_connection_string0: str :ivar aof_storage_connection_string1: Second storage account connection string. @@ -935,12 +1167,17 @@ class RedisCommonPropertiesRedisConfiguration(msrest.serialization.Model): :ivar preferred_data_persistence_auth_method: Preferred auth method to communicate to storage account used for data persistence, specify SAS or ManagedIdentity, default value is SAS. :vartype preferred_data_persistence_auth_method: str + :ivar zonal_configuration: Zonal Configuration. + :vartype zonal_configuration: str + :ivar authnotrequired: Specifies whether the authentication is disabled. Setting this property + is highly discouraged from security point of view. + :vartype authnotrequired: str """ _validation = { 'maxclients': {'readonly': True}, 'preferred_data_archive_auth_method': {'readonly': True}, - 'preferred_data_persistence_auth_method': {'readonly': True}, + 'zonal_configuration': {'readonly': True}, } _attribute_map = { @@ -949,6 +1186,7 @@ class RedisCommonPropertiesRedisConfiguration(msrest.serialization.Model): 'rdb_backup_frequency': {'key': 'rdb-backup-frequency', 'type': 'str'}, 'rdb_backup_max_snapshot_count': {'key': 'rdb-backup-max-snapshot-count', 'type': 'str'}, 'rdb_storage_connection_string': {'key': 'rdb-storage-connection-string', 'type': 'str'}, + 'aof_backup_enabled': {'key': 'aof-backup-enabled', 'type': 'str'}, 'aof_storage_connection_string0': {'key': 'aof-storage-connection-string-0', 'type': 'str'}, 'aof_storage_connection_string1': {'key': 'aof-storage-connection-string-1', 'type': 'str'}, 'maxfragmentationmemory_reserved': {'key': 'maxfragmentationmemory-reserved', 'type': 'str'}, @@ -958,6 +1196,8 @@ class RedisCommonPropertiesRedisConfiguration(msrest.serialization.Model): 'maxclients': {'key': 'maxclients', 'type': 'str'}, 'preferred_data_archive_auth_method': {'key': 'preferred-data-archive-auth-method', 'type': 'str'}, 'preferred_data_persistence_auth_method': {'key': 'preferred-data-persistence-auth-method', 'type': 'str'}, + 'zonal_configuration': {'key': 'zonal-configuration', 'type': 'str'}, + 'authnotrequired': {'key': 'authnotrequired', 'type': 'str'}, } def __init__( @@ -968,12 +1208,15 @@ def __init__( rdb_backup_frequency: Optional[str] = None, rdb_backup_max_snapshot_count: Optional[str] = None, rdb_storage_connection_string: Optional[str] = None, + aof_backup_enabled: Optional[str] = None, aof_storage_connection_string0: Optional[str] = None, aof_storage_connection_string1: Optional[str] = None, maxfragmentationmemory_reserved: Optional[str] = None, maxmemory_policy: Optional[str] = None, maxmemory_reserved: Optional[str] = None, maxmemory_delta: Optional[str] = None, + preferred_data_persistence_auth_method: Optional[str] = None, + authnotrequired: Optional[str] = None, **kwargs ): """ @@ -990,6 +1233,8 @@ def __init__( :keyword rdb_storage_connection_string: The storage account connection string for storing rdb file. :paramtype rdb_storage_connection_string: str + :keyword aof_backup_enabled: Specifies whether the aof backup is enabled. + :paramtype aof_backup_enabled: str :keyword aof_storage_connection_string0: First storage account connection string. :paramtype aof_storage_connection_string0: str :keyword aof_storage_connection_string1: Second storage account connection string. @@ -1006,6 +1251,13 @@ def __init__( :keyword maxmemory_delta: Value in megabytes reserved for non-cache usage per shard e.g. failover. :paramtype maxmemory_delta: str + :keyword preferred_data_persistence_auth_method: Preferred auth method to communicate to + storage account used for data persistence, specify SAS or ManagedIdentity, default value is + SAS. + :paramtype preferred_data_persistence_auth_method: str + :keyword authnotrequired: Specifies whether the authentication is disabled. Setting this + property is highly discouraged from security point of view. + :paramtype authnotrequired: str """ super(RedisCommonPropertiesRedisConfiguration, self).__init__(**kwargs) self.additional_properties = additional_properties @@ -1013,6 +1265,7 @@ def __init__( self.rdb_backup_frequency = rdb_backup_frequency self.rdb_backup_max_snapshot_count = rdb_backup_max_snapshot_count self.rdb_storage_connection_string = rdb_storage_connection_string + self.aof_backup_enabled = aof_backup_enabled self.aof_storage_connection_string0 = aof_storage_connection_string0 self.aof_storage_connection_string1 = aof_storage_connection_string1 self.maxfragmentationmemory_reserved = maxfragmentationmemory_reserved @@ -1021,7 +1274,9 @@ def __init__( self.maxmemory_delta = maxmemory_delta self.maxclients = None self.preferred_data_archive_auth_method = None - self.preferred_data_persistence_auth_method = None + self.preferred_data_persistence_auth_method = preferred_data_persistence_auth_method + self.zonal_configuration = None + self.authnotrequired = authnotrequired class RedisCreateParameters(msrest.serialization.Model): @@ -1041,8 +1296,9 @@ class RedisCreateParameters(msrest.serialization.Model): rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value etc. :vartype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration - :ivar redis_version: Redis version. Only major version will be used in PUT/PATCH request with - current valid values: (4, 6). + :ivar redis_version: Redis version. This should be in the form 'major[.minor]' (only 'major' is + required) or the value 'latest' which refers to the latest stable Redis version that is + available. Supported versions: 4.0, 6.0 (latest). Default value is 'latest'. :vartype redis_version: str :ivar enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. :vartype enable_non_ssl_port: bool @@ -1055,11 +1311,11 @@ class RedisCreateParameters(msrest.serialization.Model): :ivar shard_count: The number of shards to be created on a Premium Cluster Cache. :vartype shard_count: int :ivar minimum_tls_version: Optional: requires clients to use a specified TLS version (or - higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: "1.0", "1.1", "1.2". + higher) to connect (e,g, '1.0', '1.1', '1.2'). Known values are: "1.0", "1.1", "1.2". :vartype minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion :ivar public_network_access: Whether or not public endpoint access is allowed for this cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private - endpoints are the exclusive access method. Default value is 'Enabled'. Possible values include: + endpoints are the exclusive access method. Default value is 'Enabled'. Known values are: "Enabled", "Disabled". Default value: "Enabled". :vartype public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess :ivar sku: Required. The SKU of the Redis cache to deploy. @@ -1103,19 +1359,19 @@ def __init__( self, *, location: str, - sku: "Sku", + sku: "_models.Sku", zones: Optional[List[str]] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - redis_configuration: Optional["RedisCommonPropertiesRedisConfiguration"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + redis_configuration: Optional["_models.RedisCommonPropertiesRedisConfiguration"] = None, redis_version: Optional[str] = None, enable_non_ssl_port: Optional[bool] = False, replicas_per_master: Optional[int] = None, replicas_per_primary: Optional[int] = None, tenant_settings: Optional[Dict[str, str]] = None, shard_count: Optional[int] = None, - minimum_tls_version: Optional[Union[str, "TlsVersion"]] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = "Enabled", + minimum_tls_version: Optional[Union[str, "_models.TlsVersion"]] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = "Enabled", subnet_id: Optional[str] = None, static_ip: Optional[str] = None, **kwargs @@ -1134,8 +1390,9 @@ def __init__( etc. :paramtype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration - :keyword redis_version: Redis version. Only major version will be used in PUT/PATCH request - with current valid values: (4, 6). + :keyword redis_version: Redis version. This should be in the form 'major[.minor]' (only 'major' + is required) or the value 'latest' which refers to the latest stable Redis version that is + available. Supported versions: 4.0, 6.0 (latest). Default value is 'latest'. :paramtype redis_version: str :keyword enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. @@ -1149,12 +1406,12 @@ def __init__( :keyword shard_count: The number of shards to be created on a Premium Cluster Cache. :paramtype shard_count: int :keyword minimum_tls_version: Optional: requires clients to use a specified TLS version (or - higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: "1.0", "1.1", "1.2". + higher) to connect (e,g, '1.0', '1.1', '1.2'). Known values are: "1.0", "1.1", "1.2". :paramtype minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion :keyword public_network_access: Whether or not public endpoint access is allowed for this cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', - private endpoints are the exclusive access method. Default value is 'Enabled'. Possible values - include: "Enabled", "Disabled". Default value: "Enabled". + private endpoints are the exclusive access method. Default value is 'Enabled'. Known values + are: "Enabled", "Disabled". Default value: "Enabled". :paramtype public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess :keyword sku: Required. The SKU of the Redis cache to deploy. :paramtype sku: ~azure.mgmt.redis.models.Sku @@ -1194,8 +1451,9 @@ class RedisCreateProperties(RedisCommonProperties): rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value etc. :vartype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration - :ivar redis_version: Redis version. Only major version will be used in PUT/PATCH request with - current valid values: (4, 6). + :ivar redis_version: Redis version. This should be in the form 'major[.minor]' (only 'major' is + required) or the value 'latest' which refers to the latest stable Redis version that is + available. Supported versions: 4.0, 6.0 (latest). Default value is 'latest'. :vartype redis_version: str :ivar enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. :vartype enable_non_ssl_port: bool @@ -1208,11 +1466,11 @@ class RedisCreateProperties(RedisCommonProperties): :ivar shard_count: The number of shards to be created on a Premium Cluster Cache. :vartype shard_count: int :ivar minimum_tls_version: Optional: requires clients to use a specified TLS version (or - higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: "1.0", "1.1", "1.2". + higher) to connect (e,g, '1.0', '1.1', '1.2'). Known values are: "1.0", "1.1", "1.2". :vartype minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion :ivar public_network_access: Whether or not public endpoint access is allowed for this cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private - endpoints are the exclusive access method. Default value is 'Enabled'. Possible values include: + endpoints are the exclusive access method. Default value is 'Enabled'. Known values are: "Enabled", "Disabled". Default value: "Enabled". :vartype public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess :ivar sku: Required. The SKU of the Redis cache to deploy. @@ -1250,16 +1508,16 @@ class RedisCreateProperties(RedisCommonProperties): def __init__( self, *, - sku: "Sku", - redis_configuration: Optional["RedisCommonPropertiesRedisConfiguration"] = None, + sku: "_models.Sku", + redis_configuration: Optional["_models.RedisCommonPropertiesRedisConfiguration"] = None, redis_version: Optional[str] = None, enable_non_ssl_port: Optional[bool] = False, replicas_per_master: Optional[int] = None, replicas_per_primary: Optional[int] = None, tenant_settings: Optional[Dict[str, str]] = None, shard_count: Optional[int] = None, - minimum_tls_version: Optional[Union[str, "TlsVersion"]] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = "Enabled", + minimum_tls_version: Optional[Union[str, "_models.TlsVersion"]] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = "Enabled", subnet_id: Optional[str] = None, static_ip: Optional[str] = None, **kwargs @@ -1270,8 +1528,9 @@ def __init__( etc. :paramtype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration - :keyword redis_version: Redis version. Only major version will be used in PUT/PATCH request - with current valid values: (4, 6). + :keyword redis_version: Redis version. This should be in the form 'major[.minor]' (only 'major' + is required) or the value 'latest' which refers to the latest stable Redis version that is + available. Supported versions: 4.0, 6.0 (latest). Default value is 'latest'. :paramtype redis_version: str :keyword enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. @@ -1285,12 +1544,12 @@ def __init__( :keyword shard_count: The number of shards to be created on a Premium Cluster Cache. :paramtype shard_count: int :keyword minimum_tls_version: Optional: requires clients to use a specified TLS version (or - higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: "1.0", "1.1", "1.2". + higher) to connect (e,g, '1.0', '1.1', '1.2'). Known values are: "1.0", "1.1", "1.2". :paramtype minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion :keyword public_network_access: Whether or not public endpoint access is allowed for this cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', - private endpoints are the exclusive access method. Default value is 'Enabled'. Possible values - include: "Enabled", "Disabled". Default value: "Enabled". + private endpoints are the exclusive access method. Default value is 'Enabled'. Known values + are: "Enabled", "Disabled". Default value: "Enabled". :paramtype public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess :keyword sku: Required. The SKU of the Redis cache to deploy. :paramtype sku: ~azure.mgmt.redis.models.Sku @@ -1439,7 +1698,7 @@ class RedisFirewallRuleListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["RedisFirewallRule"]] = None, + value: Optional[List["_models.RedisFirewallRule"]] = None, **kwargs ): """ @@ -1567,7 +1826,7 @@ class RedisLinkedServerCreateParameters(msrest.serialization.Model): :vartype linked_redis_cache_id: str :ivar linked_redis_cache_location: Required. Location of the linked redis cache. :vartype linked_redis_cache_location: str - :ivar server_role: Required. Role of the linked server. Possible values include: "Primary", + :ivar server_role: Required. Role of the linked server. Known values are: "Primary", "Secondary". :vartype server_role: str or ~azure.mgmt.redis.models.ReplicationRole """ @@ -1589,7 +1848,7 @@ def __init__( *, linked_redis_cache_id: str, linked_redis_cache_location: str, - server_role: Union[str, "ReplicationRole"], + server_role: Union[str, "_models.ReplicationRole"], **kwargs ): """ @@ -1597,7 +1856,7 @@ def __init__( :paramtype linked_redis_cache_id: str :keyword linked_redis_cache_location: Required. Location of the linked redis cache. :paramtype linked_redis_cache_location: str - :keyword server_role: Required. Role of the linked server. Possible values include: "Primary", + :keyword server_role: Required. Role of the linked server. Known values are: "Primary", "Secondary". :paramtype server_role: str or ~azure.mgmt.redis.models.ReplicationRole """ @@ -1616,7 +1875,7 @@ class RedisLinkedServerCreateProperties(msrest.serialization.Model): :vartype linked_redis_cache_id: str :ivar linked_redis_cache_location: Required. Location of the linked redis cache. :vartype linked_redis_cache_location: str - :ivar server_role: Required. Role of the linked server. Possible values include: "Primary", + :ivar server_role: Required. Role of the linked server. Known values are: "Primary", "Secondary". :vartype server_role: str or ~azure.mgmt.redis.models.ReplicationRole """ @@ -1638,7 +1897,7 @@ def __init__( *, linked_redis_cache_id: str, linked_redis_cache_location: str, - server_role: Union[str, "ReplicationRole"], + server_role: Union[str, "_models.ReplicationRole"], **kwargs ): """ @@ -1646,7 +1905,7 @@ def __init__( :paramtype linked_redis_cache_id: str :keyword linked_redis_cache_location: Required. Location of the linked redis cache. :paramtype linked_redis_cache_location: str - :keyword server_role: Required. Role of the linked server. Possible values include: "Primary", + :keyword server_role: Required. Role of the linked server. Known values are: "Primary", "Secondary". :paramtype server_role: str or ~azure.mgmt.redis.models.ReplicationRole """ @@ -1667,7 +1926,7 @@ class RedisLinkedServerProperties(RedisLinkedServerCreateProperties): :vartype linked_redis_cache_id: str :ivar linked_redis_cache_location: Required. Location of the linked redis cache. :vartype linked_redis_cache_location: str - :ivar server_role: Required. Role of the linked server. Possible values include: "Primary", + :ivar server_role: Required. Role of the linked server. Known values are: "Primary", "Secondary". :vartype server_role: str or ~azure.mgmt.redis.models.ReplicationRole :ivar provisioning_state: Terminal state of the link between primary and secondary redis cache. @@ -1693,7 +1952,7 @@ def __init__( *, linked_redis_cache_id: str, linked_redis_cache_location: str, - server_role: Union[str, "ReplicationRole"], + server_role: Union[str, "_models.ReplicationRole"], **kwargs ): """ @@ -1701,7 +1960,7 @@ def __init__( :paramtype linked_redis_cache_id: str :keyword linked_redis_cache_location: Required. Location of the linked redis cache. :paramtype linked_redis_cache_location: str - :keyword server_role: Required. Role of the linked server. Possible values include: "Primary", + :keyword server_role: Required. Role of the linked server. Known values are: "Primary", "Secondary". :paramtype server_role: str or ~azure.mgmt.redis.models.ReplicationRole """ @@ -1726,7 +1985,7 @@ class RedisLinkedServerWithProperties(ProxyResource): :vartype linked_redis_cache_id: str :ivar linked_redis_cache_location: Location of the linked redis cache. :vartype linked_redis_cache_location: str - :ivar server_role: Role of the linked server. Possible values include: "Primary", "Secondary". + :ivar server_role: Role of the linked server. Known values are: "Primary", "Secondary". :vartype server_role: str or ~azure.mgmt.redis.models.ReplicationRole :ivar provisioning_state: Terminal state of the link between primary and secondary redis cache. :vartype provisioning_state: str @@ -1754,7 +2013,7 @@ def __init__( *, linked_redis_cache_id: Optional[str] = None, linked_redis_cache_location: Optional[str] = None, - server_role: Optional[Union[str, "ReplicationRole"]] = None, + server_role: Optional[Union[str, "_models.ReplicationRole"]] = None, **kwargs ): """ @@ -1762,8 +2021,7 @@ def __init__( :paramtype linked_redis_cache_id: str :keyword linked_redis_cache_location: Location of the linked redis cache. :paramtype linked_redis_cache_location: str - :keyword server_role: Role of the linked server. Possible values include: "Primary", - "Secondary". + :keyword server_role: Role of the linked server. Known values are: "Primary", "Secondary". :paramtype server_role: str or ~azure.mgmt.redis.models.ReplicationRole """ super(RedisLinkedServerWithProperties, self).__init__(**kwargs) @@ -1796,7 +2054,7 @@ class RedisLinkedServerWithPropertiesList(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["RedisLinkedServerWithProperties"]] = None, + value: Optional[List["_models.RedisLinkedServerWithProperties"]] = None, **kwargs ): """ @@ -1831,7 +2089,7 @@ class RedisListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["RedisResource"]] = None, + value: Optional[List["_models.RedisResource"]] = None, **kwargs ): """ @@ -1858,6 +2116,8 @@ class RedisPatchSchedule(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar location: The geo-location where the resource lives. + :vartype location: str :ivar schedule_entries: Required. List of patch schedules for a Redis cache. :vartype schedule_entries: list[~azure.mgmt.redis.models.ScheduleEntry] """ @@ -1866,6 +2126,7 @@ class RedisPatchSchedule(ProxyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'location': {'readonly': True}, 'schedule_entries': {'required': True}, } @@ -1873,13 +2134,14 @@ class RedisPatchSchedule(ProxyResource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, 'schedule_entries': {'key': 'properties.scheduleEntries', 'type': '[ScheduleEntry]'}, } def __init__( self, *, - schedule_entries: List["ScheduleEntry"], + schedule_entries: List["_models.ScheduleEntry"], **kwargs ): """ @@ -1887,6 +2149,7 @@ def __init__( :paramtype schedule_entries: list[~azure.mgmt.redis.models.ScheduleEntry] """ super(RedisPatchSchedule, self).__init__(**kwargs) + self.location = None self.schedule_entries = schedule_entries @@ -1913,7 +2176,7 @@ class RedisPatchScheduleListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["RedisPatchSchedule"]] = None, + value: Optional[List["_models.RedisPatchSchedule"]] = None, **kwargs ): """ @@ -1936,8 +2199,9 @@ class RedisProperties(RedisCreateProperties): rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value etc. :vartype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration - :ivar redis_version: Redis version. Only major version will be used in PUT/PATCH request with - current valid values: (4, 6). + :ivar redis_version: Redis version. This should be in the form 'major[.minor]' (only 'major' is + required) or the value 'latest' which refers to the latest stable Redis version that is + available. Supported versions: 4.0, 6.0 (latest). Default value is 'latest'. :vartype redis_version: str :ivar enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. :vartype enable_non_ssl_port: bool @@ -1950,11 +2214,11 @@ class RedisProperties(RedisCreateProperties): :ivar shard_count: The number of shards to be created on a Premium Cluster Cache. :vartype shard_count: int :ivar minimum_tls_version: Optional: requires clients to use a specified TLS version (or - higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: "1.0", "1.1", "1.2". + higher) to connect (e,g, '1.0', '1.1', '1.2'). Known values are: "1.0", "1.1", "1.2". :vartype minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion :ivar public_network_access: Whether or not public endpoint access is allowed for this cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private - endpoints are the exclusive access method. Default value is 'Enabled'. Possible values include: + endpoints are the exclusive access method. Default value is 'Enabled'. Known values are: "Enabled", "Disabled". Default value: "Enabled". :vartype public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess :ivar sku: Required. The SKU of the Redis cache to deploy. @@ -1966,9 +2230,9 @@ class RedisProperties(RedisCreateProperties): :ivar static_ip: Static IP address. Optionally, may be specified when deploying a Redis cache inside an existing Azure Virtual Network; auto assigned by default. :vartype static_ip: str - :ivar provisioning_state: Redis instance provisioning status. Possible values include: - "Creating", "Deleting", "Disabled", "Failed", "Linking", "Provisioning", - "RecoveringScaleFailure", "Scaling", "Succeeded", "Unlinking", "Unprovisioning", "Updating". + :ivar provisioning_state: Redis instance provisioning status. Known values are: "Creating", + "Deleting", "Disabled", "Failed", "Linking", "Provisioning", "RecoveringScaleFailure", + "Scaling", "Succeeded", "Unlinking", "Unprovisioning", "Updating". :vartype provisioning_state: str or ~azure.mgmt.redis.models.ProvisioningState :ivar host_name: Redis host name. :vartype host_name: str @@ -2028,16 +2292,16 @@ class RedisProperties(RedisCreateProperties): def __init__( self, *, - sku: "Sku", - redis_configuration: Optional["RedisCommonPropertiesRedisConfiguration"] = None, + sku: "_models.Sku", + redis_configuration: Optional["_models.RedisCommonPropertiesRedisConfiguration"] = None, redis_version: Optional[str] = None, enable_non_ssl_port: Optional[bool] = False, replicas_per_master: Optional[int] = None, replicas_per_primary: Optional[int] = None, tenant_settings: Optional[Dict[str, str]] = None, shard_count: Optional[int] = None, - minimum_tls_version: Optional[Union[str, "TlsVersion"]] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = "Enabled", + minimum_tls_version: Optional[Union[str, "_models.TlsVersion"]] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = "Enabled", subnet_id: Optional[str] = None, static_ip: Optional[str] = None, **kwargs @@ -2048,8 +2312,9 @@ def __init__( etc. :paramtype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration - :keyword redis_version: Redis version. Only major version will be used in PUT/PATCH request - with current valid values: (4, 6). + :keyword redis_version: Redis version. This should be in the form 'major[.minor]' (only 'major' + is required) or the value 'latest' which refers to the latest stable Redis version that is + available. Supported versions: 4.0, 6.0 (latest). Default value is 'latest'. :paramtype redis_version: str :keyword enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. @@ -2063,12 +2328,12 @@ def __init__( :keyword shard_count: The number of shards to be created on a Premium Cluster Cache. :paramtype shard_count: int :keyword minimum_tls_version: Optional: requires clients to use a specified TLS version (or - higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: "1.0", "1.1", "1.2". + higher) to connect (e,g, '1.0', '1.1', '1.2'). Known values are: "1.0", "1.1", "1.2". :paramtype minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion :keyword public_network_access: Whether or not public endpoint access is allowed for this cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', - private endpoints are the exclusive access method. Default value is 'Enabled'. Possible values - include: "Enabled", "Disabled". Default value: "Enabled". + private endpoints are the exclusive access method. Default value is 'Enabled'. Known values + are: "Enabled", "Disabled". Default value: "Enabled". :paramtype public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess :keyword sku: Required. The SKU of the Redis cache to deploy. :paramtype sku: ~azure.mgmt.redis.models.Sku @@ -2095,7 +2360,7 @@ class RedisRebootParameters(msrest.serialization.Model): """Specifies which Redis node(s) to reboot. :ivar reboot_type: Which Redis node(s) to reboot. Depending on this value data loss is - possible. Possible values include: "PrimaryNode", "SecondaryNode", "AllNodes". + possible. Known values are: "PrimaryNode", "SecondaryNode", "AllNodes". :vartype reboot_type: str or ~azure.mgmt.redis.models.RebootType :ivar shard_id: If clustering is enabled, the ID of the shard to be rebooted. :vartype shard_id: int @@ -2113,14 +2378,14 @@ class RedisRebootParameters(msrest.serialization.Model): def __init__( self, *, - reboot_type: Optional[Union[str, "RebootType"]] = None, + reboot_type: Optional[Union[str, "_models.RebootType"]] = None, shard_id: Optional[int] = None, ports: Optional[List[int]] = None, **kwargs ): """ :keyword reboot_type: Which Redis node(s) to reboot. Depending on this value data loss is - possible. Possible values include: "PrimaryNode", "SecondaryNode", "AllNodes". + possible. Known values are: "PrimaryNode", "SecondaryNode", "AllNodes". :paramtype reboot_type: str or ~azure.mgmt.redis.models.RebootType :keyword shard_id: If clustering is enabled, the ID of the shard to be rebooted. :paramtype shard_id: int @@ -2139,8 +2404,8 @@ class RedisRegenerateKeyParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar key_type: Required. The Redis access key to regenerate. Possible values include: - "Primary", "Secondary". + :ivar key_type: Required. The Redis access key to regenerate. Known values are: "Primary", + "Secondary". :vartype key_type: str or ~azure.mgmt.redis.models.RedisKeyType """ @@ -2155,12 +2420,12 @@ class RedisRegenerateKeyParameters(msrest.serialization.Model): def __init__( self, *, - key_type: Union[str, "RedisKeyType"], + key_type: Union[str, "_models.RedisKeyType"], **kwargs ): """ - :keyword key_type: Required. The Redis access key to regenerate. Possible values include: - "Primary", "Secondary". + :keyword key_type: Required. The Redis access key to regenerate. Known values are: "Primary", + "Secondary". :paramtype key_type: str or ~azure.mgmt.redis.models.RedisKeyType """ super(RedisRegenerateKeyParameters, self).__init__(**kwargs) @@ -2248,8 +2513,9 @@ class RedisResource(TrackedResource): rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value etc. :vartype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration - :ivar redis_version: Redis version. Only major version will be used in PUT/PATCH request with - current valid values: (4, 6). + :ivar redis_version: Redis version. This should be in the form 'major[.minor]' (only 'major' is + required) or the value 'latest' which refers to the latest stable Redis version that is + available. Supported versions: 4.0, 6.0 (latest). Default value is 'latest'. :vartype redis_version: str :ivar enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. :vartype enable_non_ssl_port: bool @@ -2262,11 +2528,11 @@ class RedisResource(TrackedResource): :ivar shard_count: The number of shards to be created on a Premium Cluster Cache. :vartype shard_count: int :ivar minimum_tls_version: Optional: requires clients to use a specified TLS version (or - higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: "1.0", "1.1", "1.2". + higher) to connect (e,g, '1.0', '1.1', '1.2'). Known values are: "1.0", "1.1", "1.2". :vartype minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion :ivar public_network_access: Whether or not public endpoint access is allowed for this cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private - endpoints are the exclusive access method. Default value is 'Enabled'. Possible values include: + endpoints are the exclusive access method. Default value is 'Enabled'. Known values are: "Enabled", "Disabled". Default value: "Enabled". :vartype public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess :ivar sku: Required. The SKU of the Redis cache to deploy. @@ -2278,9 +2544,9 @@ class RedisResource(TrackedResource): :ivar static_ip: Static IP address. Optionally, may be specified when deploying a Redis cache inside an existing Azure Virtual Network; auto assigned by default. :vartype static_ip: str - :ivar provisioning_state: Redis instance provisioning status. Possible values include: - "Creating", "Deleting", "Disabled", "Failed", "Linking", "Provisioning", - "RecoveringScaleFailure", "Scaling", "Succeeded", "Unlinking", "Unprovisioning", "Updating". + :ivar provisioning_state: Redis instance provisioning status. Known values are: "Creating", + "Deleting", "Disabled", "Failed", "Linking", "Provisioning", "RecoveringScaleFailure", + "Scaling", "Succeeded", "Unlinking", "Unprovisioning", "Updating". :vartype provisioning_state: str or ~azure.mgmt.redis.models.ProvisioningState :ivar host_name: Redis host name. :vartype host_name: str @@ -2352,19 +2618,19 @@ def __init__( self, *, location: str, - sku: "Sku", + sku: "_models.Sku", tags: Optional[Dict[str, str]] = None, zones: Optional[List[str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - redis_configuration: Optional["RedisCommonPropertiesRedisConfiguration"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + redis_configuration: Optional["_models.RedisCommonPropertiesRedisConfiguration"] = None, redis_version: Optional[str] = None, enable_non_ssl_port: Optional[bool] = False, replicas_per_master: Optional[int] = None, replicas_per_primary: Optional[int] = None, tenant_settings: Optional[Dict[str, str]] = None, shard_count: Optional[int] = None, - minimum_tls_version: Optional[Union[str, "TlsVersion"]] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = "Enabled", + minimum_tls_version: Optional[Union[str, "_models.TlsVersion"]] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = "Enabled", subnet_id: Optional[str] = None, static_ip: Optional[str] = None, **kwargs @@ -2383,8 +2649,9 @@ def __init__( etc. :paramtype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration - :keyword redis_version: Redis version. Only major version will be used in PUT/PATCH request - with current valid values: (4, 6). + :keyword redis_version: Redis version. This should be in the form 'major[.minor]' (only 'major' + is required) or the value 'latest' which refers to the latest stable Redis version that is + available. Supported versions: 4.0, 6.0 (latest). Default value is 'latest'. :paramtype redis_version: str :keyword enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. @@ -2398,12 +2665,12 @@ def __init__( :keyword shard_count: The number of shards to be created on a Premium Cluster Cache. :paramtype shard_count: int :keyword minimum_tls_version: Optional: requires clients to use a specified TLS version (or - higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: "1.0", "1.1", "1.2". + higher) to connect (e,g, '1.0', '1.1', '1.2'). Known values are: "1.0", "1.1", "1.2". :paramtype minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion :keyword public_network_access: Whether or not public endpoint access is allowed for this cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', - private endpoints are the exclusive access method. Default value is 'Enabled'. Possible values - include: "Enabled", "Disabled". Default value: "Enabled". + private endpoints are the exclusive access method. Default value is 'Enabled'. Known values + are: "Enabled", "Disabled". Default value: "Enabled". :paramtype public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess :keyword sku: Required. The SKU of the Redis cache to deploy. :paramtype sku: ~azure.mgmt.redis.models.Sku @@ -2451,8 +2718,9 @@ class RedisUpdateParameters(msrest.serialization.Model): rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value etc. :vartype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration - :ivar redis_version: Redis version. Only major version will be used in PUT/PATCH request with - current valid values: (4, 6). + :ivar redis_version: Redis version. This should be in the form 'major[.minor]' (only 'major' is + required) or the value 'latest' which refers to the latest stable Redis version that is + available. Supported versions: 4.0, 6.0 (latest). Default value is 'latest'. :vartype redis_version: str :ivar enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. :vartype enable_non_ssl_port: bool @@ -2465,11 +2733,11 @@ class RedisUpdateParameters(msrest.serialization.Model): :ivar shard_count: The number of shards to be created on a Premium Cluster Cache. :vartype shard_count: int :ivar minimum_tls_version: Optional: requires clients to use a specified TLS version (or - higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: "1.0", "1.1", "1.2". + higher) to connect (e,g, '1.0', '1.1', '1.2'). Known values are: "1.0", "1.1", "1.2". :vartype minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion :ivar public_network_access: Whether or not public endpoint access is allowed for this cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private - endpoints are the exclusive access method. Default value is 'Enabled'. Possible values include: + endpoints are the exclusive access method. Default value is 'Enabled'. Known values are: "Enabled", "Disabled". Default value: "Enabled". :vartype public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess :ivar sku: The SKU of the Redis cache to deploy. @@ -2495,17 +2763,17 @@ def __init__( self, *, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - redis_configuration: Optional["RedisCommonPropertiesRedisConfiguration"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + redis_configuration: Optional["_models.RedisCommonPropertiesRedisConfiguration"] = None, redis_version: Optional[str] = None, enable_non_ssl_port: Optional[bool] = False, replicas_per_master: Optional[int] = None, replicas_per_primary: Optional[int] = None, tenant_settings: Optional[Dict[str, str]] = None, shard_count: Optional[int] = None, - minimum_tls_version: Optional[Union[str, "TlsVersion"]] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = "Enabled", - sku: Optional["Sku"] = None, + minimum_tls_version: Optional[Union[str, "_models.TlsVersion"]] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = "Enabled", + sku: Optional["_models.Sku"] = None, **kwargs ): """ @@ -2518,8 +2786,9 @@ def __init__( etc. :paramtype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration - :keyword redis_version: Redis version. Only major version will be used in PUT/PATCH request - with current valid values: (4, 6). + :keyword redis_version: Redis version. This should be in the form 'major[.minor]' (only 'major' + is required) or the value 'latest' which refers to the latest stable Redis version that is + available. Supported versions: 4.0, 6.0 (latest). Default value is 'latest'. :paramtype redis_version: str :keyword enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. @@ -2533,12 +2802,12 @@ def __init__( :keyword shard_count: The number of shards to be created on a Premium Cluster Cache. :paramtype shard_count: int :keyword minimum_tls_version: Optional: requires clients to use a specified TLS version (or - higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: "1.0", "1.1", "1.2". + higher) to connect (e,g, '1.0', '1.1', '1.2'). Known values are: "1.0", "1.1", "1.2". :paramtype minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion :keyword public_network_access: Whether or not public endpoint access is allowed for this cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', - private endpoints are the exclusive access method. Default value is 'Enabled'. Possible values - include: "Enabled", "Disabled". Default value: "Enabled". + private endpoints are the exclusive access method. Default value is 'Enabled'. Known values + are: "Enabled", "Disabled". Default value: "Enabled". :paramtype public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess :keyword sku: The SKU of the Redis cache to deploy. :paramtype sku: ~azure.mgmt.redis.models.Sku @@ -2565,8 +2834,9 @@ class RedisUpdateProperties(RedisCommonProperties): rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value etc. :vartype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration - :ivar redis_version: Redis version. Only major version will be used in PUT/PATCH request with - current valid values: (4, 6). + :ivar redis_version: Redis version. This should be in the form 'major[.minor]' (only 'major' is + required) or the value 'latest' which refers to the latest stable Redis version that is + available. Supported versions: 4.0, 6.0 (latest). Default value is 'latest'. :vartype redis_version: str :ivar enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. :vartype enable_non_ssl_port: bool @@ -2579,11 +2849,11 @@ class RedisUpdateProperties(RedisCommonProperties): :ivar shard_count: The number of shards to be created on a Premium Cluster Cache. :vartype shard_count: int :ivar minimum_tls_version: Optional: requires clients to use a specified TLS version (or - higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: "1.0", "1.1", "1.2". + higher) to connect (e,g, '1.0', '1.1', '1.2'). Known values are: "1.0", "1.1", "1.2". :vartype minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion :ivar public_network_access: Whether or not public endpoint access is allowed for this cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private - endpoints are the exclusive access method. Default value is 'Enabled'. Possible values include: + endpoints are the exclusive access method. Default value is 'Enabled'. Known values are: "Enabled", "Disabled". Default value: "Enabled". :vartype public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess :ivar sku: The SKU of the Redis cache to deploy. @@ -2606,16 +2876,16 @@ class RedisUpdateProperties(RedisCommonProperties): def __init__( self, *, - redis_configuration: Optional["RedisCommonPropertiesRedisConfiguration"] = None, + redis_configuration: Optional["_models.RedisCommonPropertiesRedisConfiguration"] = None, redis_version: Optional[str] = None, enable_non_ssl_port: Optional[bool] = False, replicas_per_master: Optional[int] = None, replicas_per_primary: Optional[int] = None, tenant_settings: Optional[Dict[str, str]] = None, shard_count: Optional[int] = None, - minimum_tls_version: Optional[Union[str, "TlsVersion"]] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = "Enabled", - sku: Optional["Sku"] = None, + minimum_tls_version: Optional[Union[str, "_models.TlsVersion"]] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = "Enabled", + sku: Optional["_models.Sku"] = None, **kwargs ): """ @@ -2624,8 +2894,9 @@ def __init__( etc. :paramtype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration - :keyword redis_version: Redis version. Only major version will be used in PUT/PATCH request - with current valid values: (4, 6). + :keyword redis_version: Redis version. This should be in the form 'major[.minor]' (only 'major' + is required) or the value 'latest' which refers to the latest stable Redis version that is + available. Supported versions: 4.0, 6.0 (latest). Default value is 'latest'. :paramtype redis_version: str :keyword enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. @@ -2639,12 +2910,12 @@ def __init__( :keyword shard_count: The number of shards to be created on a Premium Cluster Cache. :paramtype shard_count: int :keyword minimum_tls_version: Optional: requires clients to use a specified TLS version (or - higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: "1.0", "1.1", "1.2". + higher) to connect (e,g, '1.0', '1.1', '1.2'). Known values are: "1.0", "1.1", "1.2". :paramtype minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion :keyword public_network_access: Whether or not public endpoint access is allowed for this cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', - private endpoints are the exclusive access method. Default value is 'Enabled'. Possible values - include: "Enabled", "Disabled". Default value: "Enabled". + private endpoints are the exclusive access method. Default value is 'Enabled'. Known values + are: "Enabled", "Disabled". Default value: "Enabled". :paramtype public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess :keyword sku: The SKU of the Redis cache to deploy. :paramtype sku: ~azure.mgmt.redis.models.Sku @@ -2658,9 +2929,9 @@ class ScheduleEntry(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar day_of_week: Required. Day of the week when a cache can be patched. Possible values - include: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday", - "Everyday", "Weekend". + :ivar day_of_week: Required. Day of the week when a cache can be patched. Known values are: + "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Everyday", + "Weekend". :vartype day_of_week: str or ~azure.mgmt.redis.models.DayOfWeek :ivar start_hour_utc: Required. Start hour after which cache patching can start. :vartype start_hour_utc: int @@ -2682,15 +2953,15 @@ class ScheduleEntry(msrest.serialization.Model): def __init__( self, *, - day_of_week: Union[str, "DayOfWeek"], + day_of_week: Union[str, "_models.DayOfWeek"], start_hour_utc: int, maintenance_window: Optional[datetime.timedelta] = None, **kwargs ): """ - :keyword day_of_week: Required. Day of the week when a cache can be patched. Possible values - include: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday", - "Everyday", "Weekend". + :keyword day_of_week: Required. Day of the week when a cache can be patched. Known values are: + "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Everyday", + "Weekend". :paramtype day_of_week: str or ~azure.mgmt.redis.models.DayOfWeek :keyword start_hour_utc: Required. Start hour after which cache patching can start. :paramtype start_hour_utc: int @@ -2709,10 +2980,10 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar name: Required. The type of Redis cache to deploy. Valid values: (Basic, Standard, - Premium). Possible values include: "Basic", "Standard", "Premium". + Premium). Known values are: "Basic", "Standard", "Premium". :vartype name: str or ~azure.mgmt.redis.models.SkuName :ivar family: Required. The SKU family to use. Valid values: (C, P). (C = Basic/Standard, P = - Premium). Possible values include: "C", "P". + Premium). Known values are: "C", "P". :vartype family: str or ~azure.mgmt.redis.models.SkuFamily :ivar capacity: Required. The size of the Redis cache to deploy. Valid values: for C (Basic/Standard) family (0, 1, 2, 3, 4, 5, 6), for P (Premium) family (1, 2, 3, 4). @@ -2734,17 +3005,17 @@ class Sku(msrest.serialization.Model): def __init__( self, *, - name: Union[str, "SkuName"], - family: Union[str, "SkuFamily"], + name: Union[str, "_models.SkuName"], + family: Union[str, "_models.SkuFamily"], capacity: int, **kwargs ): """ :keyword name: Required. The type of Redis cache to deploy. Valid values: (Basic, Standard, - Premium). Possible values include: "Basic", "Standard", "Premium". + Premium). Known values are: "Basic", "Standard", "Premium". :paramtype name: str or ~azure.mgmt.redis.models.SkuName :keyword family: Required. The SKU family to use. Valid values: (C, P). (C = Basic/Standard, P - = Premium). Possible values include: "C", "P". + = Premium). Known values are: "C", "P". :paramtype family: str or ~azure.mgmt.redis.models.SkuFamily :keyword capacity: Required. The size of the Redis cache to deploy. Valid values: for C (Basic/Standard) family (0, 1, 2, 3, 4, 5, 6), for P (Premium) family (1, 2, 3, 4). diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/_patch.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/_redis_management_client_enums.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/_redis_management_client_enums.py index 79fae6618d1c..0e3d6ab451bb 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/_redis_management_client_enums.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/_redis_management_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class DayOfWeek(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DayOfWeek(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Day of the week when a cache can be patched. """ @@ -25,11 +24,11 @@ class DayOfWeek(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): EVERYDAY = "Everyday" WEEKEND = "Weekend" -class DefaultName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DefaultName(str, Enum, metaclass=CaseInsensitiveEnumMeta): DEFAULT = "default" -class ManagedServiceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). """ @@ -39,7 +38,7 @@ class ManagedServiceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, En USER_ASSIGNED = "UserAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" -class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state. """ @@ -48,7 +47,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private endpoint connection status. """ @@ -56,7 +55,7 @@ class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumM APPROVED = "Approved" REJECTED = "Rejected" -class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Redis instance provisioning status. """ @@ -73,7 +72,7 @@ class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): UNPROVISIONING = "Unprovisioning" UPDATING = "Updating" -class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Whether or not public endpoint access is allowed for this cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled' @@ -82,7 +81,7 @@ class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ENABLED = "Enabled" DISABLED = "Disabled" -class RebootType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class RebootType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Which Redis node(s) to reboot. Depending on this value data loss is possible. """ @@ -90,28 +89,28 @@ class RebootType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SECONDARY_NODE = "SecondaryNode" ALL_NODES = "AllNodes" -class RedisKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class RedisKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The Redis access key to regenerate. """ PRIMARY = "Primary" SECONDARY = "Secondary" -class ReplicationRole(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ReplicationRole(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Role of the linked server. """ PRIMARY = "Primary" SECONDARY = "Secondary" -class SkuFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SkuFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The SKU family to use. Valid values: (C, P). (C = Basic/Standard, P = Premium). """ C = "C" P = "P" -class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of Redis cache to deploy. Valid values: (Basic, Standard, Premium) """ @@ -119,7 +118,7 @@ class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): STANDARD = "Standard" PREMIUM = "Premium" -class TlsVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class TlsVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Optional: requires clients to use a specified TLS version (or higher) to connect (e,g, '1.0', '1.1', '1.2') """ diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/__init__.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/__init__.py index e06d31c968e1..9f20a7d1be9b 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/__init__.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/__init__.py @@ -13,7 +13,11 @@ from ._linked_server_operations import LinkedServerOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._async_operation_status_operations import AsyncOperationStatusOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'RedisOperations', @@ -22,4 +26,7 @@ 'LinkedServerOperations', 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', + 'AsyncOperationStatusOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_async_operation_status_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_async_operation_status_operations.py new file mode 100644 index 000000000000..6616f1944f6d --- /dev/null +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_async_operation_status_operations.py @@ -0,0 +1,147 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + operation_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/asyncOperations/{operationId}") # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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 AsyncOperationStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.redis.RedisManagementClient`'s + :attr:`async_operation_status` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def get( + self, + location: str, + operation_id: str, + **kwargs: Any + ) -> _models.OperationStatus: + """For checking the ongoing status of an operation. + + :param location: The location at which operation was triggered. + :type location: str + :param operation_id: The ID of asynchronous operation. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationStatus, or the result of cls(response) + :rtype: ~azure.mgmt.redis.models.OperationStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatus] + + + request = build_get_request( + location=location, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/asyncOperations/{operationId}"} # type: ignore + diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_firewall_rules_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_firewall_rules_operations.py index 8c26e464fe14..b0f75e9982e1 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_firewall_rules_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_firewall_rules_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,72 +16,73 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off def build_list_request( - subscription_id, # type: str - resource_group_name, # type: str - cache_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-06-01" - accept = "application/json" + subscription_id: str, + resource_group_name: str, + cache_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) def build_create_or_update_request( - resource_group_name, # type: str - cache_name, # type: str - rule_name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-06-01" - accept = "application/json" + resource_group_name: str, + cache_name: str, + rule_name: str, + subscription_id: str, + *, + json: Optional[_models.RedisFirewallRule] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str'), @@ -88,39 +90,42 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, **kwargs ) def build_get_request( - resource_group_name, # type: str - cache_name, # type: str - rule_name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-06-01" - accept = "application/json" + resource_group_name: str, + cache_name: str, + rule_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str'), @@ -128,37 +133,38 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) def build_delete_request( - resource_group_name, # type: str - cache_name, # type: str - rule_name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-06-01" - accept = "application/json" + resource_group_name: str, + cache_name: str, + rule_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str'), @@ -166,55 +172,49 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -# fmt: on -class FirewallRulesOperations(object): - """FirewallRulesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class FirewallRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.redis.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.redis.RedisManagementClient`'s + :attr:`firewall_rules` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, - resource_group_name, # type: str - cache_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RedisFirewallRuleListResult"] + resource_group_name: str, + cache_name: str, + **kwargs: Any + ) -> Iterable[_models.RedisFirewallRuleListResult]: """Gets all firewall rules in the specified redis cache. :param resource_group_name: The name of the resource group. @@ -227,11 +227,16 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redis.models.RedisFirewallRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisFirewallRuleListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisFirewallRuleListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -239,10 +244,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cache_name=cache_name, + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -250,10 +258,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cache_name=cache_name, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -267,7 +278,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -281,18 +296,17 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules"} # type: ignore @distributed_trace def create_or_update( self, - resource_group_name, # type: str - cache_name, # type: str - rule_name, # type: str - parameters, # type: "_models.RedisFirewallRule" - **kwargs # type: Any - ): - # type: (...) -> "_models.RedisFirewallRule" + resource_group_name: str, + cache_name: str, + rule_name: str, + parameters: _models.RedisFirewallRule, + **kwargs: Any + ) -> _models.RedisFirewallRule: """Create or update a redis cache firewall rule. :param resource_group_name: The name of the resource group. @@ -308,13 +322,17 @@ def create_or_update( :rtype: ~azure.mgmt.redis.models.RedisFirewallRule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisFirewallRule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisFirewallRule] _json = self._serialize.body(parameters, 'RedisFirewallRule') @@ -323,14 +341,21 @@ def create_or_update( cache_name=cache_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -349,18 +374,17 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}"} # type: ignore @distributed_trace def get( self, - resource_group_name, # type: str - cache_name, # type: str - rule_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RedisFirewallRule" + resource_group_name: str, + cache_name: str, + rule_name: str, + **kwargs: Any + ) -> _models.RedisFirewallRule: """Gets a single firewall rule in a specified redis cache. :param resource_group_name: The name of the resource group. @@ -374,11 +398,16 @@ def get( :rtype: ~azure.mgmt.redis.models.RedisFirewallRule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisFirewallRule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisFirewallRule] request = build_get_request( @@ -386,12 +415,19 @@ def get( cache_name=cache_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -406,18 +442,17 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cache_name, # type: str - rule_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cache_name: str, + rule_name: str, + **kwargs: Any + ) -> None: """Deletes a single firewall rule in a specified redis cache. :param resource_group_name: The name of the resource group. @@ -431,11 +466,16 @@ def delete( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -443,12 +483,19 @@ def delete( cache_name=cache_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -459,5 +506,5 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}"} # type: ignore diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_linked_server_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_linked_server_operations.py index 8dfcf6e59425..3f73ee18322b 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_linked_server_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_linked_server_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,37 +17,37 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off def build_create_request_initial( - resource_group_name, # type: str - name, # type: str - linked_server_name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-06-01" - accept = "application/json" + resource_group_name: str, + name: str, + linked_server_name: str, + subscription_id: str, + *, + json: Optional[_models.RedisLinkedServerCreateParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "name": _SERIALIZER.url("name", name, 'str'), @@ -54,39 +55,42 @@ def build_create_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, **kwargs ) -def build_delete_request( - resource_group_name, # type: str - name, # type: str - linked_server_name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-06-01" - accept = "application/json" +def build_delete_request_initial( + resource_group_name: str, + name: str, + linked_server_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "name": _SERIALIZER.url("name", name, 'str'), @@ -94,37 +98,38 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) def build_get_request( - resource_group_name, # type: str - name, # type: str - linked_server_name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-06-01" - accept = "application/json" + resource_group_name: str, + name: str, + linked_server_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "name": _SERIALIZER.url("name", name, 'str'), @@ -132,99 +137,98 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) def build_list_request( - resource_group_name, # type: str - name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-06-01" - accept = "application/json" + resource_group_name: str, + name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "name": _SERIALIZER.url("name", name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -# fmt: on -class LinkedServerOperations(object): - """LinkedServerOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class LinkedServerOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.redis.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.redis.RedisManagementClient`'s + :attr:`linked_server` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_initial( self, - resource_group_name, # type: str - name, # type: str - linked_server_name, # type: str - parameters, # type: "_models.RedisLinkedServerCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.RedisLinkedServerWithProperties" - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisLinkedServerWithProperties"] + resource_group_name: str, + name: str, + linked_server_name: str, + parameters: _models.RedisLinkedServerCreateParameters, + **kwargs: Any + ) -> _models.RedisLinkedServerWithProperties: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisLinkedServerWithProperties] _json = self._serialize.body(parameters, 'RedisLinkedServerCreateParameters') @@ -233,14 +237,21 @@ def _create_initial( name=name, linked_server_name=linked_server_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -258,19 +269,18 @@ def _create_initial( return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}'} # type: ignore + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}"} # type: ignore @distributed_trace def begin_create( self, - resource_group_name, # type: str - name, # type: str - linked_server_name, # type: str - parameters, # type: "_models.RedisLinkedServerCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.RedisLinkedServerWithProperties"] + resource_group_name: str, + name: str, + linked_server_name: str, + parameters: _models.RedisLinkedServerCreateParameters, + **kwargs: Any + ) -> LROPoller[_models.RedisLinkedServerWithProperties]: """Adds a linked server to the Redis cache (requires Premium SKU). :param resource_group_name: The name of the resource group. @@ -295,36 +305,48 @@ def begin_create( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.redis.models.RedisLinkedServerWithProperties] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisLinkedServerWithProperties"] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisLinkedServerWithProperties] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_initial( + raw_result = self._create_initial( # type: ignore resource_group_name=resource_group_name, name=name, linked_server_name=linked_server_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('RedisLinkedServerWithProperties', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -333,74 +355,145 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}'} # type: ignore + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}"} # type: ignore - @distributed_trace - def delete( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - name, # type: str - linked_server_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - """Deletes the linked server from a redis cache (requires Premium SKU). - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param name: The name of the redis cache. - :type name: str - :param linked_server_name: The name of the linked server that is being added to the Redis - cache. - :type linked_server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] + resource_group_name: str, + name: str, + linked_server_name: str, + **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] - request = build_delete_request( + request = build_delete_request_initial( resource_group_name=resource_group_name, name=name, linked_server_name=linked_server_name, subscription_id=self._config.subscription_id, - template_url=self.delete.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + name: str, + linked_server_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the linked server from a redis cache (requires Premium SKU). + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param name: The name of the redis cache. + :type name: str + :param linked_server_name: The name of the linked server that is being added to the Redis + cache. + :type linked_server_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + name=name, + linked_server_name=linked_server_name, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}"} # type: ignore @distributed_trace def get( self, - resource_group_name, # type: str - name, # type: str - linked_server_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RedisLinkedServerWithProperties" + resource_group_name: str, + name: str, + linked_server_name: str, + **kwargs: Any + ) -> _models.RedisLinkedServerWithProperties: """Gets the detailed information about a linked server of a redis cache (requires Premium SKU). :param resource_group_name: The name of the resource group. @@ -414,11 +507,16 @@ def get( :rtype: ~azure.mgmt.redis.models.RedisLinkedServerWithProperties :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisLinkedServerWithProperties"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisLinkedServerWithProperties] request = build_get_request( @@ -426,12 +524,19 @@ def get( name=name, linked_server_name=linked_server_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -446,17 +551,16 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}"} # type: ignore @distributed_trace def list( self, - resource_group_name, # type: str - name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RedisLinkedServerWithPropertiesList"] + resource_group_name: str, + name: str, + **kwargs: Any + ) -> Iterable[_models.RedisLinkedServerWithPropertiesList]: """Gets the list of linked servers associated with this redis cache (requires Premium SKU). :param resource_group_name: The name of the resource group. @@ -470,11 +574,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.redis.models.RedisLinkedServerWithPropertiesList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisLinkedServerWithPropertiesList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisLinkedServerWithPropertiesList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -482,10 +591,13 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -493,10 +605,13 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -510,7 +625,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -524,4 +643,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers"} # type: ignore diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_operations.py index 215ceed25cac..604ff794e3f7 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,76 +16,68 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off def build_list_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-06-01" - accept = "application/json" + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Cache/operations') + _url = kwargs.pop("template_url", "/providers/Microsoft.Cache/operations") # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -# fmt: on -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.redis.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.redis.RedisManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable[_models.OperationListResult]: """Lists all of the available REST API operations of the Microsoft.Cache provider. :keyword callable cls: A custom type or function that will be passed the direct response @@ -92,27 +85,38 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redis.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -126,7 +130,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -140,4 +148,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.Cache/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.Cache/operations"} # type: ignore diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_patch.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_patch_schedules_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_patch_schedules_operations.py index b821ff1ee40f..c51ade7b0bae 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_patch_schedules_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_patch_schedules_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,72 +16,73 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off def build_list_by_redis_resource_request( - subscription_id, # type: str - resource_group_name, # type: str - cache_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-06-01" - accept = "application/json" + subscription_id: str, + resource_group_name: str, + cache_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/patchSchedules') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/patchSchedules") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) def build_create_or_update_request( - resource_group_name, # type: str - name, # type: str - default, # type: Union[str, "_models.DefaultName"] - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-06-01" - accept = "application/json" + resource_group_name: str, + name: str, + default: Union[str, "_models.DefaultName"], + subscription_id: str, + *, + json: Optional[_models.RedisPatchSchedule] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "name": _SERIALIZER.url("name", name, 'str'), @@ -88,39 +90,42 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, **kwargs ) def build_delete_request( - resource_group_name, # type: str - name, # type: str - default, # type: Union[str, "_models.DefaultName"] - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-06-01" - accept = "application/json" + resource_group_name: str, + name: str, + default: Union[str, "_models.DefaultName"], + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "name": _SERIALIZER.url("name", name, 'str'), @@ -128,37 +133,38 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) def build_get_request( - resource_group_name, # type: str - name, # type: str - default, # type: Union[str, "_models.DefaultName"] - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-06-01" - accept = "application/json" + resource_group_name: str, + name: str, + default: Union[str, "_models.DefaultName"], + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "name": _SERIALIZER.url("name", name, 'str'), @@ -166,55 +172,49 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -# fmt: on -class PatchSchedulesOperations(object): - """PatchSchedulesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PatchSchedulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.redis.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.redis.RedisManagementClient`'s + :attr:`patch_schedules` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_by_redis_resource( self, - resource_group_name, # type: str - cache_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RedisPatchScheduleListResult"] + resource_group_name: str, + cache_name: str, + **kwargs: Any + ) -> Iterable[_models.RedisPatchScheduleListResult]: """Gets all patch schedules in the specified redis cache (there is only one). :param resource_group_name: The name of the resource group. @@ -227,11 +227,16 @@ def list_by_redis_resource( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redis.models.RedisPatchScheduleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisPatchScheduleListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisPatchScheduleListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -239,10 +244,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cache_name=cache_name, + api_version=api_version, template_url=self.list_by_redis_resource.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -250,10 +258,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cache_name=cache_name, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -267,7 +278,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -281,18 +296,17 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_redis_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/patchSchedules'} # type: ignore + list_by_redis_resource.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/patchSchedules"} # type: ignore @distributed_trace def create_or_update( self, - resource_group_name, # type: str - name, # type: str - default, # type: Union[str, "_models.DefaultName"] - parameters, # type: "_models.RedisPatchSchedule" - **kwargs # type: Any - ): - # type: (...) -> "_models.RedisPatchSchedule" + resource_group_name: str, + name: str, + default: Union[str, "_models.DefaultName"], + parameters: _models.RedisPatchSchedule, + **kwargs: Any + ) -> _models.RedisPatchSchedule: """Create or replace the patching schedule for Redis cache. :param resource_group_name: The name of the resource group. @@ -308,13 +322,17 @@ def create_or_update( :rtype: ~azure.mgmt.redis.models.RedisPatchSchedule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisPatchSchedule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisPatchSchedule] _json = self._serialize.body(parameters, 'RedisPatchSchedule') @@ -323,14 +341,21 @@ def create_or_update( name=name, default=default, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -349,18 +374,17 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - name, # type: str - default, # type: Union[str, "_models.DefaultName"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + name: str, + default: Union[str, "_models.DefaultName"], + **kwargs: Any + ) -> None: """Deletes the patching schedule of a redis cache. :param resource_group_name: The name of the resource group. @@ -374,11 +398,16 @@ def delete( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -386,12 +415,19 @@ def delete( name=name, default=default, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -402,18 +438,17 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}"} # type: ignore @distributed_trace def get( self, - resource_group_name, # type: str - name, # type: str - default, # type: Union[str, "_models.DefaultName"] - **kwargs # type: Any - ): - # type: (...) -> "_models.RedisPatchSchedule" + resource_group_name: str, + name: str, + default: Union[str, "_models.DefaultName"], + **kwargs: Any + ) -> _models.RedisPatchSchedule: """Gets the patching schedule of a redis cache. :param resource_group_name: The name of the resource group. @@ -427,11 +462,16 @@ def get( :rtype: ~azure.mgmt.redis.models.RedisPatchSchedule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisPatchSchedule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisPatchSchedule] request = build_get_request( @@ -439,12 +479,19 @@ def get( name=name, default=default, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -459,5 +506,5 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}"} # type: ignore diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_private_endpoint_connections_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_private_endpoint_connections_operations.py index c6bedb4dc06d..77bd442bacd2 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_private_endpoint_connections_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_private_endpoint_connections_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,71 +17,70 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off def build_list_request( - resource_group_name, # type: str - cache_name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-06-01" - accept = "application/json" + resource_group_name: str, + cache_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) def build_get_request( - resource_group_name, # type: str - cache_name, # type: str - private_endpoint_connection_name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-06-01" - accept = "application/json" + resource_group_name: str, + cache_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str'), @@ -88,39 +88,42 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) def build_put_request_initial( - resource_group_name, # type: str - cache_name, # type: str - subscription_id, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-06-01" - accept = "application/json" + resource_group_name: str, + cache_name: str, + subscription_id: str, + private_endpoint_connection_name: str, + *, + json: Optional[_models.PrivateEndpointConnection] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str'), @@ -128,39 +131,42 @@ def build_put_request_initial( "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, **kwargs ) def build_delete_request( - resource_group_name, # type: str - cache_name, # type: str - subscription_id, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-06-01" - accept = "application/json" + resource_group_name: str, + cache_name: str, + subscription_id: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str'), @@ -168,55 +174,49 @@ def build_delete_request( "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -# fmt: on -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.redis.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.redis.RedisManagementClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, - resource_group_name, # type: str - cache_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResult"] + resource_group_name: str, + cache_name: str, + **kwargs: Any + ) -> Iterable[_models.PrivateEndpointConnectionListResult]: """List all the private endpoint connections associated with the redis cache. :param resource_group_name: The name of the resource group. @@ -230,11 +230,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.redis.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -242,10 +247,13 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cache_name=cache_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -253,10 +261,13 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cache_name=cache_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -270,7 +281,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -284,17 +299,16 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections"} # type: ignore @distributed_trace def get( self, - resource_group_name, # type: str - cache_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + cache_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection associated with the redis cache. :param resource_group_name: The name of the resource group. @@ -309,11 +323,16 @@ def get( :rtype: ~azure.mgmt.redis.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -321,12 +340,19 @@ def get( cache_name=cache_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -341,25 +367,28 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _put_initial( self, - resource_group_name, # type: str - cache_name, # type: str - private_endpoint_connection_name, # type: str - properties, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + resource_group_name: str, + cache_name: str, + private_endpoint_connection_name: str, + properties: _models.PrivateEndpointConnection, + **kwargs: Any + ) -> _models.PrivateEndpointConnection: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(properties, 'PrivateEndpointConnection') @@ -368,14 +397,21 @@ def _put_initial( cache_name=cache_name, subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._put_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -389,19 +425,18 @@ def _put_initial( return deserialized - _put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace def begin_put( self, - resource_group_name, # type: str - cache_name, # type: str - private_endpoint_connection_name, # type: str - properties, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + resource_group_name: str, + cache_name: str, + private_endpoint_connection_name: str, + properties: _models.PrivateEndpointConnection, + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: """Update the state of specified private endpoint connection associated with the redis cache. :param resource_group_name: The name of the resource group. @@ -426,36 +461,48 @@ def begin_put( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.redis.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._put_initial( + raw_result = self._put_initial( # type: ignore resource_group_name=resource_group_name, cache_name=cache_name, private_endpoint_connection_name=private_endpoint_connection_name, properties=properties, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -464,20 +511,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cache_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cache_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: """Deletes the specified private endpoint connection associated with the redis cache. :param resource_group_name: The name of the resource group. @@ -492,11 +537,16 @@ def delete( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -504,12 +554,19 @@ def delete( cache_name=cache_name, subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -520,5 +577,5 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_private_link_resources_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_private_link_resources_operations.py index 8c430f672619..90f7bf6dcff7 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_private_link_resources_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_private_link_resources_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,88 +16,80 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off def build_list_by_redis_cache_request( - resource_group_name, # type: str - cache_name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-06-01" - accept = "application/json" + resource_group_name: str, + cache_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateLinkResources') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -# fmt: on -class PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.redis.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.redis.RedisManagementClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_by_redis_cache( self, - resource_group_name, # type: str - cache_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateLinkResourceListResult"] + resource_group_name: str, + cache_name: str, + **kwargs: Any + ) -> Iterable[_models.PrivateLinkResourceListResult]: """Gets the private link resources that need to be created for a redis cache. :param resource_group_name: The name of the resource group. @@ -109,11 +102,16 @@ def list_by_redis_cache( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redis.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourceListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -121,10 +119,13 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cache_name=cache_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_redis_cache.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -132,10 +133,13 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cache_name=cache_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -149,7 +153,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -163,4 +171,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_redis_cache.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateLinkResources'} # type: ignore + list_by_redis_cache.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateLinkResources"} # type: ignore diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_redis_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_redis_operations.py index f040ad148a15..cb8295b41525 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_redis_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_redis_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,541 +17,573 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off def build_check_name_availability_request( - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-06-01" - accept = "application/json" + subscription_id: str, + *, + json: Optional[_models.CheckNameAvailabilityParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Cache/CheckNameAvailability') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/CheckNameAvailability") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, **kwargs ) def build_list_upgrade_notifications_request( - resource_group_name, # type: str - name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - history = kwargs.pop('history') # type: float - - api_version = "2021-06-01" - accept = "application/json" + resource_group_name: str, + name: str, + subscription_id: str, + *, + history: float, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/listUpgradeNotifications') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/listUpgradeNotifications") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "name": _SERIALIZER.url("name", name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - query_parameters['history'] = _SERIALIZER.query("history", history, 'float') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['history'] = _SERIALIZER.query("history", history, 'float') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) def build_create_request_initial( - resource_group_name, # type: str - name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-06-01" - accept = "application/json" + resource_group_name: str, + name: str, + subscription_id: str, + *, + json: Optional[_models.RedisCreateParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "name": _SERIALIZER.url("name", name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, **kwargs ) -def build_update_request( - resource_group_name, # type: str - name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - content_type = kwargs.pop('content_type', None) # type: Optional[str] +def build_update_request_initial( + resource_group_name: str, + name: str, + subscription_id: str, + *, + json: Optional[_models.RedisUpdateParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2021-06-01" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "name": _SERIALIZER.url("name", name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, **kwargs ) def build_delete_request_initial( - resource_group_name, # type: str - name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-06-01" - accept = "application/json" + resource_group_name: str, + name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "name": _SERIALIZER.url("name", name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) def build_get_request( - resource_group_name, # type: str - name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-06-01" - accept = "application/json" + resource_group_name: str, + name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "name": _SERIALIZER.url("name", name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) def build_list_by_resource_group_request( - resource_group_name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-06-01" - accept = "application/json" + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) def build_list_by_subscription_request( - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-06-01" - accept = "application/json" + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Cache/redis') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/redis") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) def build_list_keys_request( - resource_group_name, # type: str - name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-06-01" - accept = "application/json" + resource_group_name: str, + name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/listKeys') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/listKeys") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "name": _SERIALIZER.url("name", name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) def build_regenerate_key_request( - resource_group_name, # type: str - name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-06-01" - accept = "application/json" + resource_group_name: str, + name: str, + subscription_id: str, + *, + json: Optional[_models.RedisRegenerateKeyParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/regenerateKey') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/regenerateKey") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "name": _SERIALIZER.url("name", name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, **kwargs ) def build_force_reboot_request( - resource_group_name, # type: str - name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-06-01" - accept = "application/json" + resource_group_name: str, + name: str, + subscription_id: str, + *, + json: Optional[_models.RedisRebootParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/forceReboot') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/forceReboot") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "name": _SERIALIZER.url("name", name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, **kwargs ) def build_import_data_request_initial( - resource_group_name, # type: str - name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-06-01" - accept = "application/json" + resource_group_name: str, + name: str, + subscription_id: str, + *, + json: Optional[_models.ImportRDBParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/import') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/import") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "name": _SERIALIZER.url("name", name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, **kwargs ) def build_export_data_request_initial( - resource_group_name, # type: str - name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-06-01" - accept = "application/json" + resource_group_name: str, + name: str, + subscription_id: str, + *, + json: Optional[_models.ExportRDBParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/export') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/export") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "name": _SERIALIZER.url("name", name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, **kwargs ) -# fmt: on -class RedisOperations(object): - """RedisOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class RedisOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.redis.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.redis.RedisManagementClient`'s + :attr:`redis` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace - def check_name_availability( + def check_name_availability( # pylint: disable=inconsistent-return-statements self, - parameters, # type: "_models.CheckNameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> None + parameters: _models.CheckNameAvailabilityParameters, + **kwargs: Any + ) -> None: """Checks that the redis cache name is valid and is not already in use. :param parameters: Parameters supplied to the CheckNameAvailability Redis operation. The only @@ -561,26 +594,37 @@ def check_name_availability( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'CheckNameAvailabilityParameters') request = build_check_name_availability_request( subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.check_name_availability.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -591,18 +635,17 @@ def check_name_availability( if cls: return cls(pipeline_response, None, {}) - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cache/CheckNameAvailability'} # type: ignore + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/CheckNameAvailability"} # type: ignore @distributed_trace def list_upgrade_notifications( self, - resource_group_name, # type: str - name, # type: str - history, # type: float - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.NotificationListResponse"] + resource_group_name: str, + name: str, + history: float, + **kwargs: Any + ) -> Iterable[_models.NotificationListResponse]: """Gets any upgrade notifications for a Redis cache. :param resource_group_name: The name of the resource group. @@ -617,11 +660,16 @@ def list_upgrade_notifications( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redis.models.NotificationListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NotificationListResponse"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.NotificationListResponse] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -629,11 +677,14 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, + api_version=api_version, history=history, template_url=self.list_upgrade_notifications.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -641,11 +692,14 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, + api_version=api_version, history=history, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -659,7 +713,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -673,23 +731,26 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_upgrade_notifications.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/listUpgradeNotifications'} # type: ignore + list_upgrade_notifications.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/listUpgradeNotifications"} # type: ignore def _create_initial( self, - resource_group_name, # type: str - name, # type: str - parameters, # type: "_models.RedisCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.RedisResource" - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisResource"] + resource_group_name: str, + name: str, + parameters: _models.RedisCreateParameters, + **kwargs: Any + ) -> _models.RedisResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisResource] _json = self._serialize.body(parameters, 'RedisCreateParameters') @@ -697,14 +758,21 @@ def _create_initial( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -722,18 +790,17 @@ def _create_initial( return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}'} # type: ignore + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}"} # type: ignore @distributed_trace def begin_create( self, - resource_group_name, # type: str - name, # type: str - parameters, # type: "_models.RedisCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.RedisResource"] + resource_group_name: str, + name: str, + parameters: _models.RedisCreateParameters, + **kwargs: Any + ) -> LROPoller[_models.RedisResource]: """Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. :param resource_group_name: The name of the resource group. @@ -755,35 +822,47 @@ def begin_create( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.redis.models.RedisResource] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisResource"] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisResource] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_initial( + raw_result = self._create_initial( # type: ignore resource_group_name=resource_group_name, name=name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('RedisResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -792,96 +871,187 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}'} # type: ignore + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}"} # type: ignore - @distributed_trace - def update( + def _update_initial( self, - resource_group_name, # type: str - name, # type: str - parameters, # type: "_models.RedisUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.RedisResource" - """Update an existing Redis cache. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param name: The name of the Redis cache. - :type name: str - :param parameters: Parameters supplied to the Update Redis operation. - :type parameters: ~azure.mgmt.redis.models.RedisUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RedisResource, or the result of cls(response) - :rtype: ~azure.mgmt.redis.models.RedisResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisResource"] + resource_group_name: str, + name: str, + parameters: _models.RedisUpdateParameters, + **kwargs: Any + ) -> _models.RedisResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisResource] _json = self._serialize.body(parameters, 'RedisUpdateParameters') - request = build_update_request( + request = build_update_request_initial( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('RedisResource', pipeline_response) + if response.status_code == 200: + deserialized = self._deserialize('RedisResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('RedisResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}"} # type: ignore - def _delete_initial( + @distributed_trace + def begin_update( self, - resource_group_name, # type: str - name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + resource_group_name: str, + name: str, + parameters: _models.RedisUpdateParameters, + **kwargs: Any + ) -> LROPoller[_models.RedisResource]: + """Update an existing Redis cache. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param name: The name of the Redis cache. + :type name: str + :param parameters: Parameters supplied to the Update Redis operation. + :type parameters: ~azure.mgmt.redis.models.RedisUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RedisResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.redis.models.RedisResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisResource] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( # type: ignore + resource_group_name=resource_group_name, + name=name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('RedisResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -891,17 +1061,16 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a Redis cache. :param resource_group_name: The name of the resource group. @@ -920,18 +1089,25 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, name=name, + api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -941,8 +1117,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -951,19 +1133,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}"} # type: ignore @distributed_trace def get( self, - resource_group_name, # type: str - name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RedisResource" + resource_group_name: str, + name: str, + **kwargs: Any + ) -> _models.RedisResource: """Gets a Redis cache (resource description). :param resource_group_name: The name of the resource group. @@ -975,23 +1155,35 @@ def get( :rtype: ~azure.mgmt.redis.models.RedisResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisResource] request = build_get_request( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1006,16 +1198,15 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}"} # type: ignore @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RedisListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable[_models.RedisListResult]: """Lists all Redis caches in a resource group. :param resource_group_name: The name of the resource group. @@ -1025,31 +1216,42 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redis.models.RedisListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1063,7 +1265,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1077,14 +1283,13 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis"} # type: ignore @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RedisListResult"] + **kwargs: Any + ) -> Iterable[_models.RedisListResult]: """Gets all Redis caches in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1092,29 +1297,40 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redis.models.RedisListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1128,7 +1344,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1142,16 +1362,15 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cache/redis'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/redis"} # type: ignore @distributed_trace def list_keys( self, - resource_group_name, # type: str - name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RedisAccessKeys" + resource_group_name: str, + name: str, + **kwargs: Any + ) -> _models.RedisAccessKeys: """Retrieve a Redis cache's access keys. This operation requires write permission to the cache resource. @@ -1164,23 +1383,35 @@ def list_keys( :rtype: ~azure.mgmt.redis.models.RedisAccessKeys :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisAccessKeys"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisAccessKeys] request = build_list_keys_request( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_keys.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1195,18 +1426,17 @@ def list_keys( return deserialized - list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/listKeys'} # type: ignore + list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/listKeys"} # type: ignore @distributed_trace def regenerate_key( self, - resource_group_name, # type: str - name, # type: str - parameters, # type: "_models.RedisRegenerateKeyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.RedisAccessKeys" + resource_group_name: str, + name: str, + parameters: _models.RedisRegenerateKeyParameters, + **kwargs: Any + ) -> _models.RedisAccessKeys: """Regenerate Redis cache's access keys. This operation requires write permission to the cache resource. @@ -1221,13 +1451,17 @@ def regenerate_key( :rtype: ~azure.mgmt.redis.models.RedisAccessKeys :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisAccessKeys"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisAccessKeys] _json = self._serialize.body(parameters, 'RedisRegenerateKeyParameters') @@ -1235,14 +1469,21 @@ def regenerate_key( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.regenerate_key.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1257,18 +1498,17 @@ def regenerate_key( return deserialized - regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/regenerateKey'} # type: ignore + regenerate_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/regenerateKey"} # type: ignore @distributed_trace def force_reboot( self, - resource_group_name, # type: str - name, # type: str - parameters, # type: "_models.RedisRebootParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.RedisForceRebootResponse" + resource_group_name: str, + name: str, + parameters: _models.RedisRebootParameters, + **kwargs: Any + ) -> _models.RedisForceRebootResponse: """Reboot specified Redis node(s). This operation requires write permission to the cache resource. There can be potential data loss. @@ -1283,13 +1523,17 @@ def force_reboot( :rtype: ~azure.mgmt.redis.models.RedisForceRebootResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisForceRebootResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RedisForceRebootResponse] _json = self._serialize.body(parameters, 'RedisRebootParameters') @@ -1297,14 +1541,21 @@ def force_reboot( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.force_reboot.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1319,24 +1570,27 @@ def force_reboot( return deserialized - force_reboot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/forceReboot'} # type: ignore + force_reboot.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/forceReboot"} # type: ignore - def _import_data_initial( + def _import_data_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - name, # type: str - parameters, # type: "_models.ImportRDBParameters" - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + resource_group_name: str, + name: str, + parameters: _models.ImportRDBParameters, + **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ImportRDBParameters') @@ -1344,14 +1598,21 @@ def _import_data_initial( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._import_data_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -1361,18 +1622,17 @@ def _import_data_initial( if cls: return cls(pipeline_response, None, {}) - _import_data_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/import'} # type: ignore + _import_data_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/import"} # type: ignore @distributed_trace - def begin_import_data( + def begin_import_data( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - name, # type: str - parameters, # type: "_models.ImportRDBParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + name: str, + parameters: _models.ImportRDBParameters, + **kwargs: Any + ) -> LROPoller[None]: """Import data into Redis cache. :param resource_group_name: The name of the resource group. @@ -1393,21 +1653,28 @@ def begin_import_data( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._import_data_initial( + raw_result = self._import_data_initial( # type: ignore resource_group_name=resource_group_name, name=name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1417,8 +1684,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1427,26 +1700,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_import_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/import'} # type: ignore + begin_import_data.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/import"} # type: ignore - def _export_data_initial( + def _export_data_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - name, # type: str - parameters, # type: "_models.ExportRDBParameters" - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + resource_group_name: str, + name: str, + parameters: _models.ExportRDBParameters, + **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ExportRDBParameters') @@ -1454,14 +1729,21 @@ def _export_data_initial( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._export_data_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -1471,18 +1753,17 @@ def _export_data_initial( if cls: return cls(pipeline_response, None, {}) - _export_data_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/export'} # type: ignore + _export_data_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/export"} # type: ignore @distributed_trace - def begin_export_data( + def begin_export_data( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - name, # type: str - parameters, # type: "_models.ExportRDBParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + name: str, + parameters: _models.ExportRDBParameters, + **kwargs: Any + ) -> LROPoller[None]: """Export data from the redis cache to blobs in a container. :param resource_group_name: The name of the resource group. @@ -1503,21 +1784,28 @@ def begin_export_data( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._export_data_initial( + raw_result = self._export_data_initial( # type: ignore resource_group_name=resource_group_name, name=name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1527,8 +1815,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1537,7 +1831,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_export_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/export'} # type: ignore + begin_export_data.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/export"} # type: ignore