diff --git a/sdk/redis/azure-mgmt-redis/_meta.json b/sdk/redis/azure-mgmt-redis/_meta.json index a4149df0f50b..2d2ee948ebc2 100644 --- a/sdk/redis/azure-mgmt-redis/_meta.json +++ b/sdk/redis/azure-mgmt-redis/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.2", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.1", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "55558c4b2a1ee05064b1ce6733edf72a0345cfb8", + "commit": "09129c532c50c153cf46329d277b4a7efc9d120f", "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.8.1 --use=@autorest/modelerfour@4.19.2 --version=3.4.2", + "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", "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 734d5fe4fc7d..b1a853be7116 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/__init__.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['RedisManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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() 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 32e004fa5373..a7f2b3c59028 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_configuration.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,15 +40,15 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None + super(RedisManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(RedisManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-12-01" + self.api_version = "2021-06-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-redis/{}'.format(VERSION)) self._configure(**kwargs) @@ -68,4 +68,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **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 index a69073f4123f..07593e49a89b 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_metadata.json +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_metadata.json @@ -1,17 +1,17 @@ { - "chosen_version": "2020-12-01", - "total_api_version_list": ["2020-12-01"], + "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.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "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\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"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\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "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": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "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", diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_patch.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ 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 8b90cd607d69..502d57a11570 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 @@ -6,28 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import RedisManagementClientConfiguration +from .operations import 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.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import RedisManagementClientConfiguration -from .operations import Operations -from .operations import RedisOperations -from .operations import FirewallRulesOperations -from .operations import PatchSchedulesOperations -from .operations import LinkedServerOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from . import models - + from azure.core.rest import HttpRequest, HttpResponse class RedisManagementClient(object): """REST API for Azure Redis Cache Service. @@ -43,67 +37,71 @@ class RedisManagementClient(object): :ivar linked_server: LinkedServerOperations operations :vartype linked_server: azure.mgmt.redis.operations.LinkedServerOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.redis.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.redis.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.redis.operations.PrivateLinkResourcesOperations :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 - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: 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=None, # type: Optional[str] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = RedisManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = RedisManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._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) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request, # type: HttpRequest + **kwargs # type: Any + ): + # type: (...) -> HttpResponse """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_vendor.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) 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 fa8e008c199f..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.0.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 cbb9a1787722..cfd091c338d2 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 @@ -8,3 +8,8 @@ from ._redis_management_client import RedisManagementClient __all__ = ['RedisManagementClient'] + +# `._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() 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 41a2102df1c1..5109c0c2d4b2 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 @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,15 +37,15 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(RedisManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(RedisManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-12-01" + self.api_version = "2021-06-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-redis/{}'.format(VERSION)) self._configure(**kwargs) @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/_patch.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file 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 e91b1aa697d2..7b4be3767c4c 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 @@ -6,28 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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 + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import RedisManagementClientConfiguration -from .operations import Operations -from .operations import RedisOperations -from .operations import FirewallRulesOperations -from .operations import PatchSchedulesOperations -from .operations import LinkedServerOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .. import models - - -class RedisManagementClient(object): +class RedisManagementClient: """REST API for Azure Redis Cache Service. :ivar operations: Operations operations @@ -41,65 +35,69 @@ class RedisManagementClient(object): :ivar linked_server: LinkedServerOperations operations :vartype linked_server: azure.mgmt.redis.aio.operations.LinkedServerOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.redis.aio.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.redis.aio.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.redis.aio.operations.PrivateLinkResourcesOperations :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 - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = RedisManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = RedisManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._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) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() 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 acb54d9c07fe..6553c4e328f1 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 @@ -5,17 +5,22 @@ # 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 azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._firewall_rules_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -54,8 +60,10 @@ def list( :param cache_name: The name of the Redis cache. :type cache_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RedisFirewallRuleListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redis.models.RedisFirewallRuleListResult] + :return: An iterator like instance of either RedisFirewallRuleListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redis.models.RedisFirewallRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisFirewallRuleListResult"] @@ -63,36 +71,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cache_name=cache_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cache_name=cache_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RedisFirewallRuleListResult', pipeline_response) + deserialized = self._deserialize("RedisFirewallRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -105,17 +110,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules'} # type: ignore + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -144,39 +151,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RedisFirewallRule') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + cache_name=cache_name, + rule_name=rule_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RedisFirewallRule') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -189,8 +186,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -216,34 +216,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + cache_name=cache_name, + rule_name=rule_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RedisFirewallRule', pipeline_response) @@ -252,8 +242,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -279,37 +272,28 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + cache_name=cache_name, + rule_name=rule_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) 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 857bf38972aa..197ab5a22096 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 @@ -5,19 +5,24 @@ # 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 azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._linked_server_operations import build_create_request_initial, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,40 +61,29 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'linkedServerName': self._serialize.url("linked_server_name", linked_server_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'RedisLinkedServerCreateParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + name=name, + linked_server_name=linked_server_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RedisLinkedServerCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('RedisLinkedServerWithProperties', pipeline_response) @@ -101,8 +95,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -124,15 +121,20 @@ async def begin_create( :type parameters: ~azure.mgmt.redis.models.RedisLinkedServerCreateParameters :keyword callable cls: A custom type or function that will be passed the direct response :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. + :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 RedisLinkedServerWithProperties or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redis.models.RedisLinkedServerWithProperties] - :raises ~azure.core.exceptions.HttpResponseError: + :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 RedisLinkedServerWithProperties or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redis.models.RedisLinkedServerWithProperties] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,28 +147,21 @@ async def begin_create( name=name, linked_server_name=linked_server_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', 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 - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'linkedServerName': self._serialize.url("linked_server_name", linked_server_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -178,8 +173,10 @@ def get_long_running_output(pipeline_response): ) else: 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 + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -206,34 +203,24 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'linkedServerName': self._serialize.url("linked_server_name", linked_server_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + 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'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -241,6 +228,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -266,34 +255,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'linkedServerName': self._serialize.url("linked_server_name", linked_server_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + name=name, + linked_server_name=linked_server_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RedisLinkedServerWithProperties', pipeline_response) @@ -302,8 +281,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -317,8 +299,10 @@ def list( :param name: The name of the redis cache. :type name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RedisLinkedServerWithPropertiesList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redis.models.RedisLinkedServerWithPropertiesList] + :return: An iterator like instance of either RedisLinkedServerWithPropertiesList or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redis.models.RedisLinkedServerWithPropertiesList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisLinkedServerWithPropertiesList"] @@ -326,36 +310,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RedisLinkedServerWithPropertiesList', pipeline_response) + deserialized = self._deserialize("RedisLinkedServerWithPropertiesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -368,12 +349,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/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 7097ccd3f7fd..6f259db2b688 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 @@ -5,17 +5,22 @@ # 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 azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -57,30 +63,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,12 +96,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/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 0eded57a77cd..d250c819215a 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 @@ -5,17 +5,22 @@ # 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 azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._patch_schedules_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_redis_resource_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_redis_resource( self, resource_group_name: str, @@ -54,8 +60,10 @@ def list_by_redis_resource( :param cache_name: The name of the Redis cache. :type cache_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RedisPatchScheduleListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redis.models.RedisPatchScheduleListResult] + :return: An iterator like instance of either RedisPatchScheduleListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redis.models.RedisPatchScheduleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisPatchScheduleListResult"] @@ -63,36 +71,33 @@ def list_by_redis_resource( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_redis_resource.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_redis_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cache_name=cache_name, + template_url=self.list_by_redis_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_redis_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cache_name=cache_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RedisPatchScheduleListResult', pipeline_response) + deserialized = self._deserialize("RedisPatchScheduleListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -105,17 +110,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_redis_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/patchSchedules'} # type: ignore + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -144,39 +151,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'default': self._serialize.url("default", default, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RedisPatchSchedule') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + name=name, + default=default, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RedisPatchSchedule') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -189,8 +186,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -216,34 +216,24 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'default': self._serialize.url("default", default, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + name=name, + default=default, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -251,6 +241,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -276,34 +268,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'default': self._serialize.url("default", default, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + name=name, + default=default, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RedisPatchSchedule', pipeline_response) @@ -312,4 +294,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + 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 84a9c4fae04c..29d4b20b6a2a 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 @@ -5,19 +5,24 @@ # 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 azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_endpoint_connections_operations import build_delete_request, build_get_request, build_list_request, build_put_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -56,8 +62,10 @@ def list( :param cache_name: The name of the Redis cache. :type cache_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redis.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redis.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -65,36 +73,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + cache_name=cache_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + cache_name=cache_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,17 +112,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -144,34 +151,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + cache_name=cache_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -180,8 +177,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + async def _put_initial( self, resource_group_name: str, @@ -195,40 +194,29 @@ async def _put_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._put_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(properties, 'PrivateEndpointConnection') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_put_request_initial( + resource_group_name=resource_group_name, + cache_name=cache_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self._put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -236,8 +224,11 @@ async def _put_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_put( self, resource_group_name: str, @@ -259,15 +250,19 @@ async def begin_put( :type properties: ~azure.mgmt.redis.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :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. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redis.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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"] lro_delay = kwargs.pop( 'polling_interval', @@ -280,28 +275,21 @@ async def begin_put( cache_name=cache_name, private_endpoint_connection_name=private_endpoint_connection_name, properties=properties, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', 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 - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -313,8 +301,10 @@ def get_long_running_output(pipeline_response): ) else: 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 + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -341,37 +331,28 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + cache_name=cache_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) 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 e857dbb94328..7c23b2675a57 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 @@ -5,17 +5,22 @@ # 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 azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_link_resources_operations import build_list_by_redis_cache_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_redis_cache( self, resource_group_name: str, @@ -54,8 +60,10 @@ def list_by_redis_cache( :param cache_name: The name of the Redis cache. :type cache_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redis.models.PrivateLinkResourceListResult] + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redis.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] @@ -63,36 +71,33 @@ def list_by_redis_cache( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_redis_cache.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_redis_cache_request( + resource_group_name=resource_group_name, + cache_name=cache_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_redis_cache.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_redis_cache_request( + resource_group_name=resource_group_name, + cache_name=cache_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -105,12 +110,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/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 87449b63c22c..8f736c380b35 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 @@ -5,19 +5,24 @@ # 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 azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._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 T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_name_availability( self, parameters: "_models.CheckNameAvailabilityParameters", @@ -63,36 +69,26 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'CheckNameAvailabilityParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -100,6 +96,8 @@ async def check_name_availability( check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cache/CheckNameAvailability'} # type: ignore + + @distributed_trace def list_upgrade_notifications( self, resource_group_name: str, @@ -116,8 +114,10 @@ def list_upgrade_notifications( :param history: how many minutes in past to look for upgrade notifications. :type history: float :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NotificationListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redis.models.NotificationListResponse] + :return: An iterator like instance of either NotificationListResponse or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redis.models.NotificationListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NotificationListResponse"] @@ -125,37 +125,35 @@ def list_upgrade_notifications( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_upgrade_notifications.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['history'] = self._serialize.query("history", history, 'float') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_upgrade_notifications_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + history=history, + template_url=self.list_upgrade_notifications.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_upgrade_notifications_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + history=history, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('NotificationListResponse', pipeline_response) + deserialized = self._deserialize("NotificationListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -168,12 +166,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -191,39 +190,28 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'RedisCreateParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RedisCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('RedisResource', pipeline_response) @@ -235,8 +223,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -254,15 +245,19 @@ async def begin_create( :type parameters: ~azure.mgmt.redis.models.RedisCreateParameters :keyword callable cls: A custom type or function that will be passed the direct response :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. + :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) + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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"] lro_delay = kwargs.pop( 'polling_interval', @@ -274,27 +269,21 @@ async def begin_create( resource_group_name=resource_group_name, name=name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', 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 - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -306,8 +295,10 @@ def get_long_running_output(pipeline_response): ) else: 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 + @distributed_trace_async async def update( self, resource_group_name: str, @@ -333,38 +324,28 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RedisUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RedisUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RedisResource', pipeline_response) @@ -373,8 +354,10 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -386,40 +369,31 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -434,15 +408,17 @@ async def begin_delete( :type 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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -456,21 +432,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -482,8 +451,10 @@ def get_long_running_output(pipeline_response): ) else: 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 + @distributed_trace_async async def get( self, resource_group_name: str, @@ -506,33 +477,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RedisResource', pipeline_response) @@ -541,8 +502,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + 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: str, @@ -562,35 +526,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RedisListResult', pipeline_response) + deserialized = self._deserialize("RedisListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -603,17 +563,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis'} # type: ignore + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -630,34 +592,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RedisListResult', pipeline_response) + deserialized = self._deserialize("RedisListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -670,17 +627,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cache/redis'} # type: ignore + @distributed_trace_async async def list_keys( self, resource_group_name: str, @@ -704,33 +663,23 @@ async def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RedisAccessKeys', pipeline_response) @@ -739,8 +688,11 @@ async def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/listKeys'} # type: ignore + + @distributed_trace_async async def regenerate_key( self, resource_group_name: str, @@ -767,38 +719,28 @@ async def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'RedisRegenerateKeyParameters') + + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RedisRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RedisAccessKeys', pipeline_response) @@ -807,8 +749,11 @@ async def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/regenerateKey'} # type: ignore + + @distributed_trace_async async def force_reboot( self, resource_group_name: str, @@ -835,38 +780,28 @@ async def force_reboot( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.force_reboot.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'RedisRebootParameters') + + request = build_force_reboot_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.force_reboot.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RedisRebootParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RedisForceRebootResponse', pipeline_response) @@ -875,8 +810,10 @@ async def force_reboot( return cls(pipeline_response, deserialized, {}) return deserialized + force_reboot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/forceReboot'} # type: ignore + async def _import_data_initial( self, resource_group_name: str, @@ -889,45 +826,36 @@ async def _import_data_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._import_data_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ImportRDBParameters') + + request = build_import_data_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._import_data_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ImportRDBParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _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( self, resource_group_name: str, @@ -945,15 +873,18 @@ async def begin_import_data( :type parameters: ~azure.mgmt.redis.models.ImportRDBParameters :keyword callable cls: A custom type or function that will be passed the direct response :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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[None] lro_delay = kwargs.pop( 'polling_interval', @@ -965,24 +896,18 @@ async def begin_import_data( resource_group_name=resource_group_name, name=name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -994,6 +919,7 @@ def get_long_running_output(pipeline_response): ) else: 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 async def _export_data_initial( @@ -1008,45 +934,36 @@ async def _export_data_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._export_data_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ExportRDBParameters') + + request = build_export_data_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_data_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ExportRDBParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _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( self, resource_group_name: str, @@ -1064,15 +981,18 @@ async def begin_export_data( :type parameters: ~azure.mgmt.redis.models.ExportRDBParameters :keyword callable cls: A custom type or function that will be passed the direct response :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1084,24 +1004,18 @@ async def begin_export_data( resource_group_name=resource_group_name, name=name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1113,4 +1027,5 @@ def get_long_running_output(pipeline_response): ) else: 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 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 6e9b784a8c55..f0e8f2ee0056 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 @@ -13,6 +13,7 @@ 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 @@ -26,6 +27,7 @@ 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 @@ -53,6 +55,7 @@ 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 @@ -60,6 +63,7 @@ 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 @@ -73,6 +77,7 @@ 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 @@ -100,10 +105,12 @@ 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 ._redis_management_client_enums import ( DayOfWeek, DefaultName, + ManagedServiceIdentityType, PrivateEndpointConnectionProvisioningState, PrivateEndpointServiceConnectionStatus, ProvisioningState, @@ -123,6 +130,7 @@ 'ErrorResponse', 'ExportRDBParameters', 'ImportRDBParameters', + 'ManagedServiceIdentity', 'NotificationListResponse', 'Operation', 'OperationDisplay', @@ -136,6 +144,7 @@ 'ProxyResource', 'RedisAccessKeys', 'RedisCommonProperties', + 'RedisCommonPropertiesRedisConfiguration', 'RedisCreateParameters', 'RedisCreateProperties', 'RedisFirewallRule', @@ -163,8 +172,10 @@ 'Sku', 'TrackedResource', 'UpgradeNotification', + 'UserAssignedIdentity', 'DayOfWeek', 'DefaultName', + 'ManagedServiceIdentityType', 'PrivateEndpointConnectionProvisioningState', 'PrivateEndpointServiceConnectionStatus', 'ProvisioningState', 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 index c46da32e08de..ef495d334f91 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/_models.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/_models.py @@ -15,11 +15,11 @@ class CheckNameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Resource name. - :type name: str - :param type: Required. Resource type. The only legal value of this property for checking redis + :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'. - :type type: str + :vartype type: str """ _validation = { @@ -36,6 +36,13 @@ 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'] @@ -66,6 +73,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorAdditionalInfo, self).__init__(**kwargs) self.type = None self.info = None @@ -108,6 +117,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorDetail, self).__init__(**kwargs) self.code = None self.message = None @@ -119,8 +130,8 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - :param error: The error object. - :type error: ~azure.mgmt.redis.models.ErrorDetail + :ivar error: The error object. + :vartype error: ~azure.mgmt.redis.models.ErrorDetail """ _attribute_map = { @@ -131,6 +142,10 @@ 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) @@ -140,12 +155,12 @@ class ExportRDBParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param format: File format. - :type format: str - :param prefix: Required. Prefix to use for exported files. - :type prefix: str - :param container: Required. Container name to export to. - :type container: str + :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 = { @@ -163,6 +178,14 @@ 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'] @@ -174,10 +197,10 @@ class ImportRDBParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param format: File format. - :type format: str - :param files: Required. files to import. - :type files: list[str] + :ivar format: File format. + :vartype format: str + :ivar files: Required. files to import. + :vartype files: list[str] """ _validation = { @@ -193,18 +216,83 @@ 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. - :param value: List of all notifications. - :type value: list[~azure.mgmt.redis.models.UpgradeNotification] + :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 """ @@ -222,6 +310,10 @@ 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 @@ -230,10 +322,10 @@ def __init__( class Operation(msrest.serialization.Model): """REST API operation. - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The object that describes the operation. - :type display: ~azure.mgmt.redis.models.OperationDisplay + :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 = { @@ -245,6 +337,12 @@ 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) @@ -253,14 +351,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """The object that describes the operation. - :param provider: Friendly name of the resource provider. - :type provider: str - :param operation: Operation type: read, write, delete, listKeys/action, etc. - :type operation: str - :param resource: Resource type on which the operation is performed. - :type resource: str - :param description: Friendly name of the operation. - :type description: str + :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 = { @@ -274,6 +372,16 @@ 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) @@ -286,8 +394,8 @@ class OperationListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of operations supported by the resource provider. - :type value: list[~azure.mgmt.redis.models.Operation] + :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 """ @@ -305,6 +413,10 @@ 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 @@ -331,6 +443,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -366,6 +480,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -385,11 +501,11 @@ class PrivateEndpointConnection(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~azure.mgmt.redis.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: + :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". @@ -417,6 +533,14 @@ 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) @@ -426,8 +550,8 @@ def __init__( class PrivateEndpointConnectionListResult(msrest.serialization.Model): """List of private endpoint connection associated with the specified storage account. - :param value: Array of private endpoint connections. - :type value: list[~azure.mgmt.redis.models.PrivateEndpointConnection] + :ivar value: Array of private endpoint connections. + :vartype value: list[~azure.mgmt.redis.models.PrivateEndpointConnection] """ _attribute_map = { @@ -438,6 +562,10 @@ 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) @@ -459,8 +587,8 @@ class PrivateLinkResource(Resource): :vartype group_id: str :ivar required_members: The private link resource required member names. :vartype required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] + :ivar required_zone_names: The private link resource Private link DNS zone name. + :vartype required_zone_names: list[str] """ _validation = { @@ -484,6 +612,10 @@ 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 @@ -493,8 +625,8 @@ def __init__( class PrivateLinkResourceListResult(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private link resources. - :type value: list[~azure.mgmt.redis.models.PrivateLinkResource] + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.redis.models.PrivateLinkResource] """ _attribute_map = { @@ -505,6 +637,10 @@ 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) @@ -512,14 +648,14 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """A collection of information about the state of the connection between service consumer and provider. - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or ~azure.mgmt.redis.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any + :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. - :type actions_required: str + :vartype actions_required: str """ _attribute_map = { @@ -532,6 +668,16 @@ 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) @@ -569,6 +715,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -599,6 +747,8 @@ def __init__( self, **kwargs ): + """ + """ super(RedisAccessKeys, self).__init__(**kwargs) self.primary_key = None self.secondary_key = None @@ -607,35 +757,35 @@ def __init__( class RedisCommonProperties(msrest.serialization.Model): """Create/Update/Get common properties of the redis cache. - :param redis_configuration: All Redis Settings. Few possible keys: + :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. - :type redis_configuration: dict[str, str] - :param redis_version: Redis version. Only major version will be used in PUT/PATCH request with + :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). - :type redis_version: str - :param enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. - :type enable_non_ssl_port: bool - :param replicas_per_master: The number of replicas to be created per primary. - :type replicas_per_master: int - :param replicas_per_primary: The number of replicas to be created per primary. - :type replicas_per_primary: int - :param tenant_settings: A dictionary of tenant settings. - :type tenant_settings: dict[str, str] - :param shard_count: The number of shards to be created on a Premium Cluster Cache. - :type shard_count: int - :param minimum_tls_version: Optional: requires clients to use a specified TLS version (or + :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". - :type minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion - :param public_network_access: Whether or not public endpoint access is allowed for this cache. + :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". - :type public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess + "Enabled", "Disabled". Default value: "Enabled". + :vartype public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess """ _attribute_map = { - 'redis_configuration': {'key': 'redisConfiguration', 'type': '{str}'}, + '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'}, @@ -650,16 +800,161 @@ 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', 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', 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): @@ -667,46 +962,48 @@ class RedisCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param zones: A list of availability zones denoting where the resource needs to come from. - :type zones: list[str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param redis_configuration: All Redis Settings. Few possible keys: + :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. - :type redis_configuration: dict[str, str] - :param redis_version: Redis version. Only major version will be used in PUT/PATCH request with + :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). - :type redis_version: str - :param enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. - :type enable_non_ssl_port: bool - :param replicas_per_master: The number of replicas to be created per primary. - :type replicas_per_master: int - :param replicas_per_primary: The number of replicas to be created per primary. - :type replicas_per_primary: int - :param tenant_settings: A dictionary of tenant settings. - :type tenant_settings: dict[str, str] - :param shard_count: The number of shards to be created on a Premium Cluster Cache. - :type shard_count: int - :param minimum_tls_version: Optional: requires clients to use a specified TLS version (or + :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". - :type minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion - :param public_network_access: Whether or not public endpoint access is allowed for this cache. + :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". - :type public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess - :param sku: Required. The SKU of the Redis cache to deploy. - :type sku: ~azure.mgmt.redis.models.Sku - :param subnet_id: The full resource ID of a subnet in a virtual network to deploy the Redis + "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. - :type subnet_id: str - :param static_ip: Static IP address. Required when deploying a Redis cache inside an existing - Azure Virtual Network. - :type static_ip: str + :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 = { @@ -720,7 +1017,8 @@ class RedisCreateParameters(msrest.serialization.Model): 'zones': {'key': 'zones', 'type': '[str]'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'redis_configuration': {'key': 'properties.redisConfiguration', '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'}, @@ -738,19 +1036,66 @@ 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', 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', 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) @@ -761,40 +1106,40 @@ class RedisCreateProperties(RedisCommonProperties): All required parameters must be populated in order to send to Azure. - :param redis_configuration: All Redis Settings. Few possible keys: + :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. - :type redis_configuration: dict[str, str] - :param redis_version: Redis version. Only major version will be used in PUT/PATCH request with + :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). - :type redis_version: str - :param enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. - :type enable_non_ssl_port: bool - :param replicas_per_master: The number of replicas to be created per primary. - :type replicas_per_master: int - :param replicas_per_primary: The number of replicas to be created per primary. - :type replicas_per_primary: int - :param tenant_settings: A dictionary of tenant settings. - :type tenant_settings: dict[str, str] - :param shard_count: The number of shards to be created on a Premium Cluster Cache. - :type shard_count: int - :param minimum_tls_version: Optional: requires clients to use a specified TLS version (or + :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". - :type minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion - :param public_network_access: Whether or not public endpoint access is allowed for this cache. + :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". - :type public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess - :param sku: Required. The SKU of the Redis cache to deploy. - :type sku: ~azure.mgmt.redis.models.Sku - :param subnet_id: The full resource ID of a subnet in a virtual network to deploy the Redis + "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. - :type subnet_id: str - :param static_ip: Static IP address. Required when deploying a Redis cache inside an existing - Azure Virtual Network. - :type static_ip: str + :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 = { @@ -804,7 +1149,7 @@ class RedisCreateProperties(RedisCommonProperties): } _attribute_map = { - 'redis_configuration': {'key': 'redisConfiguration', 'type': '{str}'}, + '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'}, @@ -822,6 +1167,44 @@ 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) @@ -843,10 +1226,10 @@ class RedisFirewallRule(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param start_ip: Required. lowest IP address included in the range. - :type start_ip: str - :param end_ip: Required. highest IP address included in the range. - :type end_ip: 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 = { @@ -869,6 +1252,12 @@ 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'] @@ -889,10 +1278,10 @@ class RedisFirewallRuleCreateParameters(RedisFirewallRule): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param start_ip: Required. lowest IP address included in the range. - :type start_ip: str - :param end_ip: Required. highest IP address included in the range. - :type end_ip: 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 = { @@ -915,6 +1304,12 @@ 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) @@ -923,8 +1318,8 @@ class RedisFirewallRuleListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: Results of the list firewall rules operation. - :type value: list[~azure.mgmt.redis.models.RedisFirewallRule] + :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 """ @@ -942,6 +1337,10 @@ 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 @@ -968,6 +1367,8 @@ def __init__( self, **kwargs ): + """ + """ super(RedisForceRebootResponse, self).__init__(**kwargs) self.message = None @@ -1014,6 +1415,8 @@ def __init__( self, **kwargs ): + """ + """ super(RedisInstanceDetails, self).__init__(**kwargs) self.ssl_port = None self.non_ssl_port = None @@ -1044,6 +1447,8 @@ def __init__( self, **kwargs ): + """ + """ super(RedisLinkedServer, self).__init__(**kwargs) self.id = None @@ -1053,13 +1458,13 @@ class RedisLinkedServerCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param linked_redis_cache_id: Required. Fully qualified resourceId of the linked redis cache. - :type linked_redis_cache_id: str - :param linked_redis_cache_location: Required. Location of the linked redis cache. - :type linked_redis_cache_location: str - :param server_role: Required. Role of the linked server. Possible values include: "Primary", + :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". - :type server_role: str or ~azure.mgmt.redis.models.ReplicationRole + :vartype server_role: str or ~azure.mgmt.redis.models.ReplicationRole """ _validation = { @@ -1078,6 +1483,15 @@ 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'] @@ -1089,13 +1503,13 @@ class RedisLinkedServerCreateProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param linked_redis_cache_id: Required. Fully qualified resourceId of the linked redis cache. - :type linked_redis_cache_id: str - :param linked_redis_cache_location: Required. Location of the linked redis cache. - :type linked_redis_cache_location: str - :param server_role: Required. Role of the linked server. Possible values include: "Primary", + :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". - :type server_role: str or ~azure.mgmt.redis.models.ReplicationRole + :vartype server_role: str or ~azure.mgmt.redis.models.ReplicationRole """ _validation = { @@ -1114,6 +1528,15 @@ 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'] @@ -1127,13 +1550,13 @@ class RedisLinkedServerProperties(RedisLinkedServerCreateProperties): All required parameters must be populated in order to send to Azure. - :param linked_redis_cache_id: Required. Fully qualified resourceId of the linked redis cache. - :type linked_redis_cache_id: str - :param linked_redis_cache_location: Required. Location of the linked redis cache. - :type linked_redis_cache_location: str - :param server_role: Required. Role of the linked server. Possible values include: "Primary", + :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". - :type server_role: str or ~azure.mgmt.redis.models.ReplicationRole + :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 """ @@ -1156,6 +1579,15 @@ 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 @@ -1173,12 +1605,12 @@ class RedisLinkedServerWithProperties(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param linked_redis_cache_id: Fully qualified resourceId of the linked redis cache. - :type linked_redis_cache_id: str - :param linked_redis_cache_location: Location of the linked redis cache. - :type linked_redis_cache_location: str - :param server_role: Role of the linked server. Possible values include: "Primary", "Secondary". - :type server_role: str or ~azure.mgmt.redis.models.ReplicationRole + :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 """ @@ -1204,6 +1636,15 @@ 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) @@ -1216,8 +1657,8 @@ class RedisLinkedServerWithPropertiesList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of linked servers (with properties) of a Redis cache. - :type value: list[~azure.mgmt.redis.models.RedisLinkedServerWithProperties] + :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 """ @@ -1235,6 +1676,10 @@ 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 @@ -1245,8 +1690,8 @@ class RedisListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of Redis cache instances. - :type value: list[~azure.mgmt.redis.models.RedisResource] + :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 """ @@ -1264,6 +1709,10 @@ 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 @@ -1284,8 +1733,8 @@ class RedisPatchSchedule(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param schedule_entries: Required. List of patch schedules for a Redis cache. - :type schedule_entries: list[~azure.mgmt.redis.models.ScheduleEntry] + :ivar schedule_entries: Required. List of patch schedules for a Redis cache. + :vartype schedule_entries: list[~azure.mgmt.redis.models.ScheduleEntry] """ _validation = { @@ -1306,6 +1755,10 @@ 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'] @@ -1315,8 +1768,8 @@ class RedisPatchScheduleListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: Results of the list patch schedules operation. - :type value: list[~azure.mgmt.redis.models.RedisPatchSchedule] + :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 """ @@ -1334,6 +1787,10 @@ 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 @@ -1346,40 +1803,40 @@ class RedisProperties(RedisCreateProperties): All required parameters must be populated in order to send to Azure. - :param redis_configuration: All Redis Settings. Few possible keys: + :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. - :type redis_configuration: dict[str, str] - :param redis_version: Redis version. Only major version will be used in PUT/PATCH request with + :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). - :type redis_version: str - :param enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. - :type enable_non_ssl_port: bool - :param replicas_per_master: The number of replicas to be created per primary. - :type replicas_per_master: int - :param replicas_per_primary: The number of replicas to be created per primary. - :type replicas_per_primary: int - :param tenant_settings: A dictionary of tenant settings. - :type tenant_settings: dict[str, str] - :param shard_count: The number of shards to be created on a Premium Cluster Cache. - :type shard_count: int - :param minimum_tls_version: Optional: requires clients to use a specified TLS version (or + :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". - :type minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion - :param public_network_access: Whether or not public endpoint access is allowed for this cache. + :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". - :type public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess - :param sku: Required. The SKU of the Redis cache to deploy. - :type sku: ~azure.mgmt.redis.models.Sku - :param subnet_id: The full resource ID of a subnet in a virtual network to deploy the Redis + "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. - :type subnet_id: str - :param static_ip: Static IP address. Required when deploying a Redis cache inside an existing - Azure Virtual Network. - :type static_ip: str + :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". @@ -1417,7 +1874,7 @@ class RedisProperties(RedisCreateProperties): } _attribute_map = { - 'redis_configuration': {'key': 'redisConfiguration', 'type': '{str}'}, + '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'}, @@ -1443,6 +1900,44 @@ 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 @@ -1457,14 +1952,14 @@ def __init__( class RedisRebootParameters(msrest.serialization.Model): """Specifies which Redis node(s) to reboot. - :param reboot_type: Which Redis node(s) to reboot. Depending on this value data loss is + :ivar reboot_type: Which Redis node(s) to reboot. Depending on this value data loss is possible. Possible values include: "PrimaryNode", "SecondaryNode", "AllNodes". - :type reboot_type: str or ~azure.mgmt.redis.models.RebootType - :param shard_id: If clustering is enabled, the ID of the shard to be rebooted. - :type shard_id: int - :param ports: A list of redis instances to reboot, specified by per-instance SSL ports or + :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. - :type ports: list[int] + :vartype ports: list[int] """ _attribute_map = { @@ -1477,6 +1972,16 @@ 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) @@ -1488,9 +1993,9 @@ class RedisRegenerateKeyParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_type: Required. The Redis access key to regenerate. Possible values include: + :ivar key_type: Required. The Redis access key to regenerate. Possible values include: "Primary", "Secondary". - :type key_type: str or ~azure.mgmt.redis.models.RedisKeyType + :vartype key_type: str or ~azure.mgmt.redis.models.RedisKeyType """ _validation = { @@ -1505,6 +2010,11 @@ 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'] @@ -1524,10 +2034,10 @@ class TrackedResource(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: 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 = { @@ -1549,6 +2059,12 @@ 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'] @@ -1569,46 +2085,48 @@ class RedisResource(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param zones: A list of availability zones denoting where the resource needs to come from. - :type zones: list[str] - :param redis_configuration: All Redis Settings. Few possible keys: + :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. - :type redis_configuration: dict[str, str] - :param redis_version: Redis version. Only major version will be used in PUT/PATCH request with + :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). - :type redis_version: str - :param enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. - :type enable_non_ssl_port: bool - :param replicas_per_master: The number of replicas to be created per primary. - :type replicas_per_master: int - :param replicas_per_primary: The number of replicas to be created per primary. - :type replicas_per_primary: int - :param tenant_settings: A dictionary of tenant settings. - :type tenant_settings: dict[str, str] - :param shard_count: The number of shards to be created on a Premium Cluster Cache. - :type shard_count: int - :param minimum_tls_version: Optional: requires clients to use a specified TLS version (or + :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". - :type minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion - :param public_network_access: Whether or not public endpoint access is allowed for this cache. + :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". - :type public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess - :param sku: Required. The SKU of the Redis cache to deploy. - :type sku: ~azure.mgmt.redis.models.Sku - :param subnet_id: The full resource ID of a subnet in a virtual network to deploy the Redis + "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. - :type subnet_id: str - :param static_ip: Static IP address. Required when deploying a Redis cache inside an existing - Azure Virtual Network. - :type static_ip: str + :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". @@ -1656,7 +2174,8 @@ class RedisResource(TrackedResource): 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, 'zones': {'key': 'zones', 'type': '[str]'}, - 'redis_configuration': {'key': 'properties.redisConfiguration', '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'}, @@ -1682,17 +2201,64 @@ 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', 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', 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) @@ -1709,40 +2275,43 @@ def __init__( class RedisUpdateParameters(msrest.serialization.Model): """Parameters supplied to the Update Redis operation. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param redis_configuration: All Redis Settings. Few possible keys: + :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. - :type redis_configuration: dict[str, str] - :param redis_version: Redis version. Only major version will be used in PUT/PATCH request with + :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). - :type redis_version: str - :param enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. - :type enable_non_ssl_port: bool - :param replicas_per_master: The number of replicas to be created per primary. - :type replicas_per_master: int - :param replicas_per_primary: The number of replicas to be created per primary. - :type replicas_per_primary: int - :param tenant_settings: A dictionary of tenant settings. - :type tenant_settings: dict[str, str] - :param shard_count: The number of shards to be created on a Premium Cluster Cache. - :type shard_count: int - :param minimum_tls_version: Optional: requires clients to use a specified TLS version (or + :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". - :type minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion - :param public_network_access: Whether or not public endpoint access is allowed for this cache. + :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". - :type public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess - :param sku: The SKU of the Redis cache to deploy. - :type sku: ~azure.mgmt.redis.models.Sku + "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}'}, - 'redis_configuration': {'key': 'properties.redisConfiguration', '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'}, @@ -1758,54 +2327,90 @@ 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', 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', 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. - :param redis_configuration: All Redis Settings. Few possible keys: + :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. - :type redis_configuration: dict[str, str] - :param redis_version: Redis version. Only major version will be used in PUT/PATCH request with + :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). - :type redis_version: str - :param enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. - :type enable_non_ssl_port: bool - :param replicas_per_master: The number of replicas to be created per primary. - :type replicas_per_master: int - :param replicas_per_primary: The number of replicas to be created per primary. - :type replicas_per_primary: int - :param tenant_settings: A dictionary of tenant settings. - :type tenant_settings: dict[str, str] - :param shard_count: The number of shards to be created on a Premium Cluster Cache. - :type shard_count: int - :param minimum_tls_version: Optional: requires clients to use a specified TLS version (or + :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". - :type minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion - :param public_network_access: Whether or not public endpoint access is allowed for this cache. + :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". - :type public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess - :param sku: The SKU of the Redis cache to deploy. - :type sku: ~azure.mgmt.redis.models.Sku + "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': '{str}'}, + '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'}, @@ -1821,6 +2426,37 @@ 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) @@ -1830,14 +2466,14 @@ class ScheduleEntry(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param day_of_week: Required. Day of the week when a cache can be patched. Possible values + :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". - :type day_of_week: str or ~azure.mgmt.redis.models.DayOfWeek - :param start_hour_utc: Required. Start hour after which cache patching can start. - :type start_hour_utc: int - :param maintenance_window: ISO8601 timespan specifying how much time cache patching can take. - :type maintenance_window: ~datetime.timedelta + :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 = { @@ -1855,6 +2491,16 @@ 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'] @@ -1866,15 +2512,15 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The type of Redis cache to deploy. Valid values: (Basic, Standard, + :ivar name: Required. The type of Redis cache to deploy. Valid values: (Basic, Standard, Premium). Possible values include: "Basic", "Standard", "Premium". - :type name: str or ~azure.mgmt.redis.models.SkuName - :param family: Required. The SKU family to use. Valid values: (C, P). (C = Basic/Standard, P = + :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". - :type family: str or ~azure.mgmt.redis.models.SkuFamily - :param capacity: Required. The size of the Redis cache to deploy. Valid values: for C + :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). - :type capacity: int + :vartype capacity: int """ _validation = { @@ -1893,6 +2539,17 @@ 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'] @@ -1928,7 +2585,41 @@ 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 ea5d67ca55be..3c7e80b9d40a 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,7 +7,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Any, Dict, List, Optional, Union from azure.core.exceptions import HttpResponseError import msrest.serialization @@ -20,11 +20,11 @@ class CheckNameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Resource name. - :type name: str - :param type: Required. Resource type. The only legal value of this property for checking redis + :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'. - :type type: str + :vartype type: str """ _validation = { @@ -44,6 +44,13 @@ def __init__( type: str, **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 = name self.type = type @@ -74,6 +81,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorAdditionalInfo, self).__init__(**kwargs) self.type = None self.info = None @@ -116,6 +125,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorDetail, self).__init__(**kwargs) self.code = None self.message = None @@ -127,8 +138,8 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - :param error: The error object. - :type error: ~azure.mgmt.redis.models.ErrorDetail + :ivar error: The error object. + :vartype error: ~azure.mgmt.redis.models.ErrorDetail """ _attribute_map = { @@ -141,6 +152,10 @@ def __init__( error: Optional["ErrorDetail"] = None, **kwargs ): + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.redis.models.ErrorDetail + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -150,12 +165,12 @@ class ExportRDBParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param format: File format. - :type format: str - :param prefix: Required. Prefix to use for exported files. - :type prefix: str - :param container: Required. Container name to export to. - :type container: str + :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 = { @@ -177,6 +192,14 @@ def __init__( format: Optional[str] = None, **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 = format self.prefix = prefix @@ -188,10 +211,10 @@ class ImportRDBParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param format: File format. - :type format: str - :param files: Required. files to import. - :type files: list[str] + :ivar format: File format. + :vartype format: str + :ivar files: Required. files to import. + :vartype files: list[str] """ _validation = { @@ -210,18 +233,86 @@ def __init__( format: Optional[str] = None, **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 = format self.files = 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, + *, + type: Union[str, "ManagedServiceIdentityType"], + user_assigned_identities: Optional[Dict[str, "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". + :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 = type + self.user_assigned_identities = user_assigned_identities + + class NotificationListResponse(msrest.serialization.Model): """The response of listUpgradeNotifications. Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of all notifications. - :type value: list[~azure.mgmt.redis.models.UpgradeNotification] + :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 """ @@ -241,6 +332,10 @@ def __init__( value: Optional[List["UpgradeNotification"]] = None, **kwargs ): + """ + :keyword value: List of all notifications. + :paramtype value: list[~azure.mgmt.redis.models.UpgradeNotification] + """ super(NotificationListResponse, self).__init__(**kwargs) self.value = value self.next_link = None @@ -249,10 +344,10 @@ def __init__( class Operation(msrest.serialization.Model): """REST API operation. - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The object that describes the operation. - :type display: ~azure.mgmt.redis.models.OperationDisplay + :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 = { @@ -267,6 +362,12 @@ def __init__( display: Optional["OperationDisplay"] = None, **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 = name self.display = display @@ -275,14 +376,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """The object that describes the operation. - :param provider: Friendly name of the resource provider. - :type provider: str - :param operation: Operation type: read, write, delete, listKeys/action, etc. - :type operation: str - :param resource: Resource type on which the operation is performed. - :type resource: str - :param description: Friendly name of the operation. - :type description: str + :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 = { @@ -301,6 +402,16 @@ def __init__( description: Optional[str] = None, **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 = provider self.operation = operation @@ -313,8 +424,8 @@ class OperationListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of operations supported by the resource provider. - :type value: list[~azure.mgmt.redis.models.Operation] + :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 """ @@ -334,6 +445,10 @@ def __init__( value: Optional[List["Operation"]] = None, **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 = value self.next_link = None @@ -360,6 +475,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -395,6 +512,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -414,11 +533,11 @@ class PrivateEndpointConnection(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~azure.mgmt.redis.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: + :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". @@ -449,6 +568,14 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **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 = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state @@ -458,8 +585,8 @@ def __init__( class PrivateEndpointConnectionListResult(msrest.serialization.Model): """List of private endpoint connection associated with the specified storage account. - :param value: Array of private endpoint connections. - :type value: list[~azure.mgmt.redis.models.PrivateEndpointConnection] + :ivar value: Array of private endpoint connections. + :vartype value: list[~azure.mgmt.redis.models.PrivateEndpointConnection] """ _attribute_map = { @@ -472,6 +599,10 @@ def __init__( value: Optional[List["PrivateEndpointConnection"]] = None, **kwargs ): + """ + :keyword value: Array of private endpoint connections. + :paramtype value: list[~azure.mgmt.redis.models.PrivateEndpointConnection] + """ super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) self.value = value @@ -493,8 +624,8 @@ class PrivateLinkResource(Resource): :vartype group_id: str :ivar required_members: The private link resource required member names. :vartype required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] + :ivar required_zone_names: The private link resource Private link DNS zone name. + :vartype required_zone_names: list[str] """ _validation = { @@ -520,6 +651,10 @@ def __init__( required_zone_names: Optional[List[str]] = None, **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 @@ -529,8 +664,8 @@ def __init__( class PrivateLinkResourceListResult(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private link resources. - :type value: list[~azure.mgmt.redis.models.PrivateLinkResource] + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.redis.models.PrivateLinkResource] """ _attribute_map = { @@ -543,6 +678,10 @@ def __init__( value: Optional[List["PrivateLinkResource"]] = None, **kwargs ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.redis.models.PrivateLinkResource] + """ super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value @@ -550,14 +689,14 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """A collection of information about the state of the connection between service consumer and provider. - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or ~azure.mgmt.redis.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any + :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. - :type actions_required: str + :vartype actions_required: str """ _attribute_map = { @@ -574,6 +713,16 @@ def __init__( 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". + :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 = status self.description = description @@ -611,6 +760,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -641,6 +792,8 @@ def __init__( self, **kwargs ): + """ + """ super(RedisAccessKeys, self).__init__(**kwargs) self.primary_key = None self.secondary_key = None @@ -649,35 +802,35 @@ def __init__( class RedisCommonProperties(msrest.serialization.Model): """Create/Update/Get common properties of the redis cache. - :param redis_configuration: All Redis Settings. Few possible keys: + :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. - :type redis_configuration: dict[str, str] - :param redis_version: Redis version. Only major version will be used in PUT/PATCH request with + :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). - :type redis_version: str - :param enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. - :type enable_non_ssl_port: bool - :param replicas_per_master: The number of replicas to be created per primary. - :type replicas_per_master: int - :param replicas_per_primary: The number of replicas to be created per primary. - :type replicas_per_primary: int - :param tenant_settings: A dictionary of tenant settings. - :type tenant_settings: dict[str, str] - :param shard_count: The number of shards to be created on a Premium Cluster Cache. - :type shard_count: int - :param minimum_tls_version: Optional: requires clients to use a specified TLS version (or + :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". - :type minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion - :param public_network_access: Whether or not public endpoint access is allowed for this cache. + :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". - :type public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess + "Enabled", "Disabled". Default value: "Enabled". + :vartype public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess """ _attribute_map = { - 'redis_configuration': {'key': 'redisConfiguration', 'type': '{str}'}, + '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'}, @@ -691,17 +844,46 @@ class RedisCommonProperties(msrest.serialization.Model): def __init__( self, *, - redis_configuration: Optional[Dict[str, str]] = None, + redis_configuration: Optional["RedisCommonPropertiesRedisConfiguration"] = None, redis_version: Optional[str] = None, - enable_non_ssl_port: Optional[bool] = 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"]] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = "Enabled", **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 = redis_configuration self.redis_version = redis_version @@ -714,51 +896,181 @@ def __init__( self.public_network_access = public_network_access +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, + *, + additional_properties: Optional[Dict[str, Any]] = None, + rdb_backup_enabled: Optional[str] = None, + rdb_backup_frequency: Optional[str] = None, + rdb_backup_max_snapshot_count: Optional[str] = None, + rdb_storage_connection_string: 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, + **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 = additional_properties + self.rdb_backup_enabled = rdb_backup_enabled + 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_storage_connection_string0 = aof_storage_connection_string0 + self.aof_storage_connection_string1 = aof_storage_connection_string1 + self.maxfragmentationmemory_reserved = maxfragmentationmemory_reserved + self.maxmemory_policy = maxmemory_policy + self.maxmemory_reserved = maxmemory_reserved + self.maxmemory_delta = maxmemory_delta + 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. - :param zones: A list of availability zones denoting where the resource needs to come from. - :type zones: list[str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param redis_configuration: All Redis Settings. Few possible keys: + :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. - :type redis_configuration: dict[str, str] - :param redis_version: Redis version. Only major version will be used in PUT/PATCH request with + :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). - :type redis_version: str - :param enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. - :type enable_non_ssl_port: bool - :param replicas_per_master: The number of replicas to be created per primary. - :type replicas_per_master: int - :param replicas_per_primary: The number of replicas to be created per primary. - :type replicas_per_primary: int - :param tenant_settings: A dictionary of tenant settings. - :type tenant_settings: dict[str, str] - :param shard_count: The number of shards to be created on a Premium Cluster Cache. - :type shard_count: int - :param minimum_tls_version: Optional: requires clients to use a specified TLS version (or + :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". - :type minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion - :param public_network_access: Whether or not public endpoint access is allowed for this cache. + :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". - :type public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess - :param sku: Required. The SKU of the Redis cache to deploy. - :type sku: ~azure.mgmt.redis.models.Sku - :param subnet_id: The full resource ID of a subnet in a virtual network to deploy the Redis + "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. - :type subnet_id: str - :param static_ip: Static IP address. Required when deploying a Redis cache inside an existing - Azure Virtual Network. - :type static_ip: str + :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 = { @@ -772,7 +1084,8 @@ class RedisCreateParameters(msrest.serialization.Model): 'zones': {'key': 'zones', 'type': '[str]'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'redis_configuration': {'key': 'properties.redisConfiguration', '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'}, @@ -793,23 +1106,71 @@ def __init__( sku: "Sku", zones: Optional[List[str]] = None, tags: Optional[Dict[str, str]] = None, - redis_configuration: Optional[Dict[str, str]] = None, + identity: Optional["ManagedServiceIdentity"] = None, + redis_configuration: Optional["RedisCommonPropertiesRedisConfiguration"] = None, redis_version: Optional[str] = None, - enable_non_ssl_port: Optional[bool] = 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"]] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = "Enabled", subnet_id: Optional[str] = None, static_ip: Optional[str] = None, **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 = zones self.location = location self.tags = tags + self.identity = identity self.redis_configuration = redis_configuration self.redis_version = redis_version self.enable_non_ssl_port = enable_non_ssl_port @@ -829,40 +1190,40 @@ class RedisCreateProperties(RedisCommonProperties): All required parameters must be populated in order to send to Azure. - :param redis_configuration: All Redis Settings. Few possible keys: + :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. - :type redis_configuration: dict[str, str] - :param redis_version: Redis version. Only major version will be used in PUT/PATCH request with + :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). - :type redis_version: str - :param enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. - :type enable_non_ssl_port: bool - :param replicas_per_master: The number of replicas to be created per primary. - :type replicas_per_master: int - :param replicas_per_primary: The number of replicas to be created per primary. - :type replicas_per_primary: int - :param tenant_settings: A dictionary of tenant settings. - :type tenant_settings: dict[str, str] - :param shard_count: The number of shards to be created on a Premium Cluster Cache. - :type shard_count: int - :param minimum_tls_version: Optional: requires clients to use a specified TLS version (or + :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". - :type minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion - :param public_network_access: Whether or not public endpoint access is allowed for this cache. + :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". - :type public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess - :param sku: Required. The SKU of the Redis cache to deploy. - :type sku: ~azure.mgmt.redis.models.Sku - :param subnet_id: The full resource ID of a subnet in a virtual network to deploy the Redis + "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. - :type subnet_id: str - :param static_ip: Static IP address. Required when deploying a Redis cache inside an existing - Azure Virtual Network. - :type static_ip: str + :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 = { @@ -872,7 +1233,7 @@ class RedisCreateProperties(RedisCommonProperties): } _attribute_map = { - 'redis_configuration': {'key': 'redisConfiguration', 'type': '{str}'}, + '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'}, @@ -890,19 +1251,57 @@ def __init__( self, *, sku: "Sku", - redis_configuration: Optional[Dict[str, str]] = None, + redis_configuration: Optional["RedisCommonPropertiesRedisConfiguration"] = None, redis_version: Optional[str] = None, - enable_non_ssl_port: Optional[bool] = 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"]] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = "Enabled", subnet_id: Optional[str] = None, static_ip: Optional[str] = None, **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__(redis_configuration=redis_configuration, redis_version=redis_version, enable_non_ssl_port=enable_non_ssl_port, replicas_per_master=replicas_per_master, replicas_per_primary=replicas_per_primary, tenant_settings=tenant_settings, shard_count=shard_count, minimum_tls_version=minimum_tls_version, public_network_access=public_network_access, **kwargs) self.sku = sku self.subnet_id = subnet_id @@ -924,10 +1323,10 @@ class RedisFirewallRule(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param start_ip: Required. lowest IP address included in the range. - :type start_ip: str - :param end_ip: Required. highest IP address included in the range. - :type end_ip: 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 = { @@ -953,6 +1352,12 @@ def __init__( end_ip: str, **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 = start_ip self.end_ip = end_ip @@ -973,10 +1378,10 @@ class RedisFirewallRuleCreateParameters(RedisFirewallRule): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param start_ip: Required. lowest IP address included in the range. - :type start_ip: str - :param end_ip: Required. highest IP address included in the range. - :type end_ip: 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 = { @@ -1002,6 +1407,12 @@ def __init__( end_ip: str, **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__(start_ip=start_ip, end_ip=end_ip, **kwargs) @@ -1010,8 +1421,8 @@ class RedisFirewallRuleListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: Results of the list firewall rules operation. - :type value: list[~azure.mgmt.redis.models.RedisFirewallRule] + :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 """ @@ -1031,6 +1442,10 @@ def __init__( value: Optional[List["RedisFirewallRule"]] = None, **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 = value self.next_link = None @@ -1057,6 +1472,8 @@ def __init__( self, **kwargs ): + """ + """ super(RedisForceRebootResponse, self).__init__(**kwargs) self.message = None @@ -1103,6 +1520,8 @@ def __init__( self, **kwargs ): + """ + """ super(RedisInstanceDetails, self).__init__(**kwargs) self.ssl_port = None self.non_ssl_port = None @@ -1133,6 +1552,8 @@ def __init__( self, **kwargs ): + """ + """ super(RedisLinkedServer, self).__init__(**kwargs) self.id = None @@ -1142,13 +1563,13 @@ class RedisLinkedServerCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param linked_redis_cache_id: Required. Fully qualified resourceId of the linked redis cache. - :type linked_redis_cache_id: str - :param linked_redis_cache_location: Required. Location of the linked redis cache. - :type linked_redis_cache_location: str - :param server_role: Required. Role of the linked server. Possible values include: "Primary", + :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". - :type server_role: str or ~azure.mgmt.redis.models.ReplicationRole + :vartype server_role: str or ~azure.mgmt.redis.models.ReplicationRole """ _validation = { @@ -1171,6 +1592,15 @@ def __init__( server_role: Union[str, "ReplicationRole"], **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 = linked_redis_cache_id self.linked_redis_cache_location = linked_redis_cache_location @@ -1182,13 +1612,13 @@ class RedisLinkedServerCreateProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param linked_redis_cache_id: Required. Fully qualified resourceId of the linked redis cache. - :type linked_redis_cache_id: str - :param linked_redis_cache_location: Required. Location of the linked redis cache. - :type linked_redis_cache_location: str - :param server_role: Required. Role of the linked server. Possible values include: "Primary", + :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". - :type server_role: str or ~azure.mgmt.redis.models.ReplicationRole + :vartype server_role: str or ~azure.mgmt.redis.models.ReplicationRole """ _validation = { @@ -1211,6 +1641,15 @@ def __init__( server_role: Union[str, "ReplicationRole"], **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 = linked_redis_cache_id self.linked_redis_cache_location = linked_redis_cache_location @@ -1224,13 +1663,13 @@ class RedisLinkedServerProperties(RedisLinkedServerCreateProperties): All required parameters must be populated in order to send to Azure. - :param linked_redis_cache_id: Required. Fully qualified resourceId of the linked redis cache. - :type linked_redis_cache_id: str - :param linked_redis_cache_location: Required. Location of the linked redis cache. - :type linked_redis_cache_location: str - :param server_role: Required. Role of the linked server. Possible values include: "Primary", + :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". - :type server_role: str or ~azure.mgmt.redis.models.ReplicationRole + :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 """ @@ -1257,6 +1696,15 @@ def __init__( server_role: Union[str, "ReplicationRole"], **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__(linked_redis_cache_id=linked_redis_cache_id, linked_redis_cache_location=linked_redis_cache_location, server_role=server_role, **kwargs) self.provisioning_state = None @@ -1274,12 +1722,12 @@ class RedisLinkedServerWithProperties(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param linked_redis_cache_id: Fully qualified resourceId of the linked redis cache. - :type linked_redis_cache_id: str - :param linked_redis_cache_location: Location of the linked redis cache. - :type linked_redis_cache_location: str - :param server_role: Role of the linked server. Possible values include: "Primary", "Secondary". - :type server_role: str or ~azure.mgmt.redis.models.ReplicationRole + :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 """ @@ -1309,6 +1757,15 @@ def __init__( server_role: Optional[Union[str, "ReplicationRole"]] = None, **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 = linked_redis_cache_id self.linked_redis_cache_location = linked_redis_cache_location @@ -1321,8 +1778,8 @@ class RedisLinkedServerWithPropertiesList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of linked servers (with properties) of a Redis cache. - :type value: list[~azure.mgmt.redis.models.RedisLinkedServerWithProperties] + :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 """ @@ -1342,6 +1799,10 @@ def __init__( value: Optional[List["RedisLinkedServerWithProperties"]] = None, **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 = value self.next_link = None @@ -1352,8 +1813,8 @@ class RedisListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of Redis cache instances. - :type value: list[~azure.mgmt.redis.models.RedisResource] + :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 """ @@ -1373,6 +1834,10 @@ def __init__( value: Optional[List["RedisResource"]] = None, **kwargs ): + """ + :keyword value: List of Redis cache instances. + :paramtype value: list[~azure.mgmt.redis.models.RedisResource] + """ super(RedisListResult, self).__init__(**kwargs) self.value = value self.next_link = None @@ -1393,8 +1858,8 @@ class RedisPatchSchedule(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param schedule_entries: Required. List of patch schedules for a Redis cache. - :type schedule_entries: list[~azure.mgmt.redis.models.ScheduleEntry] + :ivar schedule_entries: Required. List of patch schedules for a Redis cache. + :vartype schedule_entries: list[~azure.mgmt.redis.models.ScheduleEntry] """ _validation = { @@ -1417,6 +1882,10 @@ def __init__( schedule_entries: List["ScheduleEntry"], **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 = schedule_entries @@ -1426,8 +1895,8 @@ class RedisPatchScheduleListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: Results of the list patch schedules operation. - :type value: list[~azure.mgmt.redis.models.RedisPatchSchedule] + :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 """ @@ -1447,6 +1916,10 @@ def __init__( value: Optional[List["RedisPatchSchedule"]] = None, **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 = value self.next_link = None @@ -1459,40 +1932,40 @@ class RedisProperties(RedisCreateProperties): All required parameters must be populated in order to send to Azure. - :param redis_configuration: All Redis Settings. Few possible keys: + :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. - :type redis_configuration: dict[str, str] - :param redis_version: Redis version. Only major version will be used in PUT/PATCH request with + :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). - :type redis_version: str - :param enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. - :type enable_non_ssl_port: bool - :param replicas_per_master: The number of replicas to be created per primary. - :type replicas_per_master: int - :param replicas_per_primary: The number of replicas to be created per primary. - :type replicas_per_primary: int - :param tenant_settings: A dictionary of tenant settings. - :type tenant_settings: dict[str, str] - :param shard_count: The number of shards to be created on a Premium Cluster Cache. - :type shard_count: int - :param minimum_tls_version: Optional: requires clients to use a specified TLS version (or + :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". - :type minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion - :param public_network_access: Whether or not public endpoint access is allowed for this cache. + :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". - :type public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess - :param sku: Required. The SKU of the Redis cache to deploy. - :type sku: ~azure.mgmt.redis.models.Sku - :param subnet_id: The full resource ID of a subnet in a virtual network to deploy the Redis + "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. - :type subnet_id: str - :param static_ip: Static IP address. Required when deploying a Redis cache inside an existing - Azure Virtual Network. - :type static_ip: str + :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". @@ -1530,7 +2003,7 @@ class RedisProperties(RedisCreateProperties): } _attribute_map = { - 'redis_configuration': {'key': 'redisConfiguration', 'type': '{str}'}, + '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'}, @@ -1556,19 +2029,57 @@ def __init__( self, *, sku: "Sku", - redis_configuration: Optional[Dict[str, str]] = None, + redis_configuration: Optional["RedisCommonPropertiesRedisConfiguration"] = None, redis_version: Optional[str] = None, - enable_non_ssl_port: Optional[bool] = 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"]] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = "Enabled", subnet_id: Optional[str] = None, static_ip: Optional[str] = None, **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__(redis_configuration=redis_configuration, redis_version=redis_version, enable_non_ssl_port=enable_non_ssl_port, replicas_per_master=replicas_per_master, replicas_per_primary=replicas_per_primary, tenant_settings=tenant_settings, shard_count=shard_count, minimum_tls_version=minimum_tls_version, public_network_access=public_network_access, sku=sku, subnet_id=subnet_id, static_ip=static_ip, **kwargs) self.provisioning_state = None self.host_name = None @@ -1583,14 +2094,14 @@ def __init__( class RedisRebootParameters(msrest.serialization.Model): """Specifies which Redis node(s) to reboot. - :param reboot_type: Which Redis node(s) to reboot. Depending on this value data loss is + :ivar reboot_type: Which Redis node(s) to reboot. Depending on this value data loss is possible. Possible values include: "PrimaryNode", "SecondaryNode", "AllNodes". - :type reboot_type: str or ~azure.mgmt.redis.models.RebootType - :param shard_id: If clustering is enabled, the ID of the shard to be rebooted. - :type shard_id: int - :param ports: A list of redis instances to reboot, specified by per-instance SSL ports or + :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. - :type ports: list[int] + :vartype ports: list[int] """ _attribute_map = { @@ -1607,6 +2118,16 @@ def __init__( 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". + :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 = reboot_type self.shard_id = shard_id @@ -1618,9 +2139,9 @@ class RedisRegenerateKeyParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_type: Required. The Redis access key to regenerate. Possible values include: + :ivar key_type: Required. The Redis access key to regenerate. Possible values include: "Primary", "Secondary". - :type key_type: str or ~azure.mgmt.redis.models.RedisKeyType + :vartype key_type: str or ~azure.mgmt.redis.models.RedisKeyType """ _validation = { @@ -1637,6 +2158,11 @@ def __init__( key_type: Union[str, "RedisKeyType"], **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 = key_type @@ -1656,10 +2182,10 @@ class TrackedResource(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: 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 = { @@ -1684,6 +2210,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ super(TrackedResource, self).__init__(**kwargs) self.tags = tags self.location = location @@ -1704,46 +2236,48 @@ class RedisResource(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param zones: A list of availability zones denoting where the resource needs to come from. - :type zones: list[str] - :param redis_configuration: All Redis Settings. Few possible keys: + :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. - :type redis_configuration: dict[str, str] - :param redis_version: Redis version. Only major version will be used in PUT/PATCH request with + :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). - :type redis_version: str - :param enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. - :type enable_non_ssl_port: bool - :param replicas_per_master: The number of replicas to be created per primary. - :type replicas_per_master: int - :param replicas_per_primary: The number of replicas to be created per primary. - :type replicas_per_primary: int - :param tenant_settings: A dictionary of tenant settings. - :type tenant_settings: dict[str, str] - :param shard_count: The number of shards to be created on a Premium Cluster Cache. - :type shard_count: int - :param minimum_tls_version: Optional: requires clients to use a specified TLS version (or + :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". - :type minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion - :param public_network_access: Whether or not public endpoint access is allowed for this cache. + :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". - :type public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess - :param sku: Required. The SKU of the Redis cache to deploy. - :type sku: ~azure.mgmt.redis.models.Sku - :param subnet_id: The full resource ID of a subnet in a virtual network to deploy the Redis + "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. - :type subnet_id: str - :param static_ip: Static IP address. Required when deploying a Redis cache inside an existing - Azure Virtual Network. - :type static_ip: str + :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". @@ -1791,7 +2325,8 @@ class RedisResource(TrackedResource): 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, 'zones': {'key': 'zones', 'type': '[str]'}, - 'redis_configuration': {'key': 'properties.redisConfiguration', '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'}, @@ -1820,21 +2355,69 @@ def __init__( sku: "Sku", tags: Optional[Dict[str, str]] = None, zones: Optional[List[str]] = None, - redis_configuration: Optional[Dict[str, str]] = None, + identity: Optional["ManagedServiceIdentity"] = None, + redis_configuration: Optional["RedisCommonPropertiesRedisConfiguration"] = None, redis_version: Optional[str] = None, - enable_non_ssl_port: Optional[bool] = 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"]] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = "Enabled", subnet_id: Optional[str] = None, static_ip: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword 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__(tags=tags, location=location, **kwargs) self.zones = zones + self.identity = identity self.redis_configuration = redis_configuration self.redis_version = redis_version self.enable_non_ssl_port = enable_non_ssl_port @@ -1860,40 +2443,43 @@ def __init__( class RedisUpdateParameters(msrest.serialization.Model): """Parameters supplied to the Update Redis operation. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param redis_configuration: All Redis Settings. Few possible keys: + :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. - :type redis_configuration: dict[str, str] - :param redis_version: Redis version. Only major version will be used in PUT/PATCH request with + :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). - :type redis_version: str - :param enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. - :type enable_non_ssl_port: bool - :param replicas_per_master: The number of replicas to be created per primary. - :type replicas_per_master: int - :param replicas_per_primary: The number of replicas to be created per primary. - :type replicas_per_primary: int - :param tenant_settings: A dictionary of tenant settings. - :type tenant_settings: dict[str, str] - :param shard_count: The number of shards to be created on a Premium Cluster Cache. - :type shard_count: int - :param minimum_tls_version: Optional: requires clients to use a specified TLS version (or + :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". - :type minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion - :param public_network_access: Whether or not public endpoint access is allowed for this cache. + :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". - :type public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess - :param sku: The SKU of the Redis cache to deploy. - :type sku: ~azure.mgmt.redis.models.Sku + "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}'}, - 'redis_configuration': {'key': 'properties.redisConfiguration', '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'}, @@ -1909,20 +2495,57 @@ def __init__( self, *, tags: Optional[Dict[str, str]] = None, - redis_configuration: Optional[Dict[str, str]] = None, + identity: Optional["ManagedServiceIdentity"] = None, + redis_configuration: Optional["RedisCommonPropertiesRedisConfiguration"] = None, redis_version: Optional[str] = None, - enable_non_ssl_port: Optional[bool] = 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"]] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = "Enabled", sku: Optional["Sku"] = None, **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 = tags + self.identity = identity self.redis_configuration = redis_configuration self.redis_version = redis_version self.enable_non_ssl_port = enable_non_ssl_port @@ -1938,37 +2561,37 @@ def __init__( class RedisUpdateProperties(RedisCommonProperties): """Patchable properties of the redis cache. - :param redis_configuration: All Redis Settings. Few possible keys: + :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. - :type redis_configuration: dict[str, str] - :param redis_version: Redis version. Only major version will be used in PUT/PATCH request with + :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). - :type redis_version: str - :param enable_non_ssl_port: Specifies whether the non-ssl Redis server port (6379) is enabled. - :type enable_non_ssl_port: bool - :param replicas_per_master: The number of replicas to be created per primary. - :type replicas_per_master: int - :param replicas_per_primary: The number of replicas to be created per primary. - :type replicas_per_primary: int - :param tenant_settings: A dictionary of tenant settings. - :type tenant_settings: dict[str, str] - :param shard_count: The number of shards to be created on a Premium Cluster Cache. - :type shard_count: int - :param minimum_tls_version: Optional: requires clients to use a specified TLS version (or + :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". - :type minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion - :param public_network_access: Whether or not public endpoint access is allowed for this cache. + :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". - :type public_network_access: str or ~azure.mgmt.redis.models.PublicNetworkAccess - :param sku: The SKU of the Redis cache to deploy. - :type sku: ~azure.mgmt.redis.models.Sku + "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': '{str}'}, + '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'}, @@ -1983,18 +2606,49 @@ class RedisUpdateProperties(RedisCommonProperties): def __init__( self, *, - redis_configuration: Optional[Dict[str, str]] = None, + redis_configuration: Optional["RedisCommonPropertiesRedisConfiguration"] = None, redis_version: Optional[str] = None, - enable_non_ssl_port: Optional[bool] = 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"]] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = "Enabled", sku: Optional["Sku"] = None, **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__(redis_configuration=redis_configuration, redis_version=redis_version, enable_non_ssl_port=enable_non_ssl_port, replicas_per_master=replicas_per_master, replicas_per_primary=replicas_per_primary, tenant_settings=tenant_settings, shard_count=shard_count, minimum_tls_version=minimum_tls_version, public_network_access=public_network_access, **kwargs) self.sku = sku @@ -2004,14 +2658,14 @@ class ScheduleEntry(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param day_of_week: Required. Day of the week when a cache can be patched. Possible values + :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". - :type day_of_week: str or ~azure.mgmt.redis.models.DayOfWeek - :param start_hour_utc: Required. Start hour after which cache patching can start. - :type start_hour_utc: int - :param maintenance_window: ISO8601 timespan specifying how much time cache patching can take. - :type maintenance_window: ~datetime.timedelta + :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 = { @@ -2033,6 +2687,16 @@ def __init__( 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". + :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 = day_of_week self.start_hour_utc = start_hour_utc @@ -2044,15 +2708,15 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The type of Redis cache to deploy. Valid values: (Basic, Standard, + :ivar name: Required. The type of Redis cache to deploy. Valid values: (Basic, Standard, Premium). Possible values include: "Basic", "Standard", "Premium". - :type name: str or ~azure.mgmt.redis.models.SkuName - :param family: Required. The SKU family to use. Valid values: (C, P). (C = Basic/Standard, P = + :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". - :type family: str or ~azure.mgmt.redis.models.SkuFamily - :param capacity: Required. The size of the Redis cache to deploy. Valid values: for C + :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). - :type capacity: int + :vartype capacity: int """ _validation = { @@ -2075,6 +2739,17 @@ def __init__( capacity: int, **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 = name self.family = family @@ -2110,7 +2785,41 @@ 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/_redis_management_client_enums.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/_redis_management_client_enums.py index 7ffbf1d0003e..79fae6618d1c 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 @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class DayOfWeek(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DayOfWeek(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Day of the week when a cache can be patched. """ @@ -40,11 +25,21 @@ class DayOfWeek(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): EVERYDAY = "Everyday" WEEKEND = "Weekend" -class DefaultName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DefaultName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "default" -class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagedServiceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Type of managed service identity (where both SystemAssigned and UserAssigned types are + allowed). + """ + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + +class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current provisioning state. """ @@ -53,7 +48,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitive DELETING = "Deleting" FAILED = "Failed" -class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The private endpoint connection status. """ @@ -61,7 +56,7 @@ class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnum APPROVED = "Approved" REJECTED = "Rejected" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Redis instance provisioning status. """ @@ -78,7 +73,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UNPROVISIONING = "Unprovisioning" UPDATING = "Updating" -class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """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' @@ -87,7 +82,7 @@ class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ENABLED = "Enabled" DISABLED = "Disabled" -class RebootType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RebootType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Which Redis node(s) to reboot. Depending on this value data loss is possible. """ @@ -95,28 +90,28 @@ class RebootType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SECONDARY_NODE = "SecondaryNode" ALL_NODES = "AllNodes" -class RedisKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RedisKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Redis access key to regenerate. """ PRIMARY = "Primary" SECONDARY = "Secondary" -class ReplicationRole(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReplicationRole(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Role of the linked server. """ PRIMARY = "Primary" SECONDARY = "Secondary" -class SkuFamily(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """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(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of Redis cache to deploy. Valid values: (Basic, Standard, Premium) """ @@ -124,7 +119,7 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD = "Standard" PREMIUM = "Premium" -class TlsVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TlsVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """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/_firewall_rules_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_firewall_rules_operations.py index 891526f0406d..8c26e464fe14 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 @@ -5,24 +5,186 @@ # 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 azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from 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]] +_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" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules') + 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) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + 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" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str'), + "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_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" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str'), + "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + 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" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str'), + "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class FirewallRulesOperations(object): """FirewallRulesOperations operations. @@ -45,6 +207,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -59,7 +222,8 @@ def list( :param cache_name: The name of the Redis cache. :type cache_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RedisFirewallRuleListResult or the result of cls(response) + :return: An iterator like instance of either RedisFirewallRuleListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redis.models.RedisFirewallRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -68,36 +232,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cache_name=cache_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cache_name=cache_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RedisFirewallRuleListResult', pipeline_response) + deserialized = self._deserialize("RedisFirewallRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,17 +271,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules'} # type: ignore + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -150,39 +313,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RedisFirewallRule') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + cache_name=cache_name, + rule_name=rule_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RedisFirewallRule') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -195,8 +348,11 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + 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 @@ -223,34 +379,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + cache_name=cache_name, + rule_name=rule_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RedisFirewallRule', pipeline_response) @@ -259,8 +405,11 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -287,37 +436,28 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + cache_name=cache_name, + rule_name=rule_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) 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 f32b8b9910db..8dfcf6e59425 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 @@ -5,26 +5,188 @@ # 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 azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from 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]] +_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" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "linkedServerName": _SERIALIZER.url("linked_server_name", linked_server_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_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" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "linkedServerName": _SERIALIZER.url("linked_server_name", linked_server_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + 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" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "linkedServerName": _SERIALIZER.url("linked_server_name", linked_server_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_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" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers') + 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) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class LinkedServerOperations(object): """LinkedServerOperations operations. @@ -61,40 +223,29 @@ def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'linkedServerName': self._serialize.url("linked_server_name", linked_server_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'RedisLinkedServerCreateParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + name=name, + linked_server_name=linked_server_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RedisLinkedServerCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('RedisLinkedServerWithProperties', pipeline_response) @@ -106,8 +257,11 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _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 @@ -130,15 +284,19 @@ def begin_create( :type parameters: ~azure.mgmt.redis.models.RedisLinkedServerCreateParameters :keyword callable cls: A custom type or function that will be passed the direct response :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. + :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 RedisLinkedServerWithProperties or the result of cls(response) + :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 RedisLinkedServerWithProperties or the + result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.redis.models.RedisLinkedServerWithProperties] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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"] lro_delay = kwargs.pop( 'polling_interval', @@ -151,28 +309,21 @@ def begin_create( name=name, linked_server_name=linked_server_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', 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 - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'linkedServerName': self._serialize.url("linked_server_name", linked_server_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -184,8 +335,10 @@ def get_long_running_output(pipeline_response): ) else: 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 + @distributed_trace def delete( self, resource_group_name, # type: str @@ -213,34 +366,24 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'linkedServerName': self._serialize.url("linked_server_name", linked_server_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + 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'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -248,6 +391,8 @@ def delete( 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 @@ -274,34 +419,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'linkedServerName': self._serialize.url("linked_server_name", linked_server_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + name=name, + linked_server_name=linked_server_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RedisLinkedServerWithProperties', pipeline_response) @@ -310,8 +445,11 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + 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 @@ -326,8 +464,10 @@ def list( :param name: The name of the redis cache. :type name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RedisLinkedServerWithPropertiesList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redis.models.RedisLinkedServerWithPropertiesList] + :return: An iterator like instance of either RedisLinkedServerWithPropertiesList or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.redis.models.RedisLinkedServerWithPropertiesList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RedisLinkedServerWithPropertiesList"] @@ -335,36 +475,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RedisLinkedServerWithPropertiesList', pipeline_response) + deserialized = self._deserialize("RedisLinkedServerWithPropertiesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -377,12 +514,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_operations.py index b63e47af7c1a..215ceed25cac 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 @@ -5,24 +5,58 @@ # 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 azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from 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]] +_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" + # Construct URL + 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') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -62,30 +97,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,12 +130,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/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 5cacddcfde4c..b821ff1ee40f 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 @@ -5,24 +5,186 @@ # 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 azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from 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]] +_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" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/patchSchedules') + 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) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + 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" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "default": _SERIALIZER.url("default", default, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_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" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "default": _SERIALIZER.url("default", default, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + 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" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "default": _SERIALIZER.url("default", default, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class PatchSchedulesOperations(object): """PatchSchedulesOperations operations. @@ -45,6 +207,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_redis_resource( self, resource_group_name, # type: str @@ -59,7 +222,8 @@ def list_by_redis_resource( :param cache_name: The name of the Redis cache. :type cache_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RedisPatchScheduleListResult or the result of cls(response) + :return: An iterator like instance of either RedisPatchScheduleListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redis.models.RedisPatchScheduleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -68,36 +232,33 @@ def list_by_redis_resource( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_redis_resource.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_redis_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cache_name=cache_name, + template_url=self.list_by_redis_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_redis_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cache_name=cache_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RedisPatchScheduleListResult', pipeline_response) + deserialized = self._deserialize("RedisPatchScheduleListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,17 +271,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_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 @@ -150,39 +313,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'default': self._serialize.url("default", default, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RedisPatchSchedule') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + name=name, + default=default, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RedisPatchSchedule') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -195,8 +348,11 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -223,34 +379,24 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'default': self._serialize.url("default", default, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + name=name, + default=default, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -258,6 +404,8 @@ def delete( 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 @@ -284,34 +432,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'default': self._serialize.url("default", default, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + name=name, + default=default, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RedisPatchSchedule', pipeline_response) @@ -320,4 +458,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + 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 62e5a6829091..c6bedb4dc06d 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 @@ -5,26 +5,188 @@ # 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 azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from 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]] +_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" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections') + 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) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_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" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_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" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}') + 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'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_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" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}') + 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'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -47,6 +209,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -61,8 +224,10 @@ def list( :param cache_name: The name of the Redis cache. :type cache_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redis.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.redis.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -70,36 +235,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + cache_name=cache_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + cache_name=cache_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,17 +274,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections'} # type: ignore + @distributed_trace def get( self, resource_group_name, # type: str @@ -150,34 +314,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + cache_name=cache_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -186,8 +340,10 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + 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 @@ -202,40 +358,29 @@ def _put_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._put_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(properties, 'PrivateEndpointConnection') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_put_request_initial( + resource_group_name=resource_group_name, + cache_name=cache_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self._put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -243,8 +388,11 @@ def _put_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _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 @@ -267,15 +415,19 @@ def begin_put( :type properties: ~azure.mgmt.redis.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :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. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.redis.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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"] lro_delay = kwargs.pop( 'polling_interval', @@ -288,28 +440,21 @@ def begin_put( cache_name=cache_name, private_endpoint_connection_name=private_endpoint_connection_name, properties=properties, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', 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 - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -321,8 +466,10 @@ def get_long_running_output(pipeline_response): ) else: 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 + @distributed_trace def delete( self, resource_group_name, # type: str @@ -350,37 +497,28 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + cache_name=cache_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) 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 b953935f3523..8c430f672619 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 @@ -5,24 +5,68 @@ # 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 azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from 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]] +_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" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateLinkResources') + 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) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -45,6 +89,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_redis_cache( self, resource_group_name, # type: str @@ -59,7 +104,8 @@ def list_by_redis_cache( :param cache_name: The name of the Redis cache. :type cache_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResourceListResult or the result of cls(response) + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redis.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -68,36 +114,33 @@ def list_by_redis_cache( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_redis_cache.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'cacheName': self._serialize.url("cache_name", cache_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_redis_cache_request( + resource_group_name=resource_group_name, + cache_name=cache_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_redis_cache.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_redis_cache_request( + resource_group_name=resource_group_name, + cache_name=cache_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,12 +153,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/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 ed6b827e985b..f040ad148a15 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 @@ -5,26 +5,523 @@ # 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 azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from 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]] +_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" + # Construct URL + 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) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_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" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/listUpgradeNotifications') + 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) + + # 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') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + 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" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}') + 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) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_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] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}') + 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) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **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" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}') + 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) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + 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" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}') + 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) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_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" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis') + 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) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + 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) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_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" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/listKeys') + 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) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_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" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/regenerateKey') + 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) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_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" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/forceReboot') + 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) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_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" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/import') + 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) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_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" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/export') + 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) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class RedisOperations(object): """RedisOperations operations. @@ -47,6 +544,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, parameters, # type: "_models.CheckNameAvailabilityParameters" @@ -68,36 +566,26 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'CheckNameAvailabilityParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -105,6 +593,8 @@ def check_name_availability( 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 @@ -122,7 +612,8 @@ def list_upgrade_notifications( :param history: how many minutes in past to look for upgrade notifications. :type history: float :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NotificationListResponse or the result of cls(response) + :return: An iterator like instance of either NotificationListResponse or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redis.models.NotificationListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -131,37 +622,35 @@ def list_upgrade_notifications( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_upgrade_notifications.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['history'] = self._serialize.query("history", history, 'float') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_upgrade_notifications_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + history=history, + template_url=self.list_upgrade_notifications.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_upgrade_notifications_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + history=history, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('NotificationListResponse', pipeline_response) + deserialized = self._deserialize("NotificationListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -174,12 +663,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -198,39 +688,28 @@ def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'RedisCreateParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RedisCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('RedisResource', pipeline_response) @@ -242,8 +721,11 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _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 @@ -262,15 +744,19 @@ def begin_create( :type parameters: ~azure.mgmt.redis.models.RedisCreateParameters :keyword callable cls: A custom type or function that will be passed the direct response :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. + :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) + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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"] lro_delay = kwargs.pop( 'polling_interval', @@ -282,27 +768,21 @@ def begin_create( resource_group_name=resource_group_name, name=name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', 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 - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -314,8 +794,10 @@ def get_long_running_output(pipeline_response): ) else: 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 + @distributed_trace def update( self, resource_group_name, # type: str @@ -342,38 +824,28 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RedisUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RedisUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RedisResource', pipeline_response) @@ -382,8 +854,10 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}'} # type: ignore + def _delete_initial( self, resource_group_name, # type: str @@ -396,40 +870,31 @@ def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -445,15 +910,17 @@ def begin_delete( :type 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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -467,21 +934,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -493,8 +953,10 @@ def get_long_running_output(pipeline_response): ) else: 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 + @distributed_trace def get( self, resource_group_name, # type: str @@ -518,33 +980,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RedisResource', pipeline_response) @@ -553,8 +1005,11 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + 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 @@ -575,35 +1030,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RedisListResult', pipeline_response) + deserialized = self._deserialize("RedisListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -616,17 +1067,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis'} # type: ignore + @distributed_trace def list_by_subscription( self, **kwargs # type: Any @@ -644,34 +1097,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RedisListResult', pipeline_response) + deserialized = self._deserialize("RedisListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -684,17 +1132,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cache/redis'} # type: ignore + @distributed_trace def list_keys( self, resource_group_name, # type: str @@ -719,33 +1169,23 @@ def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RedisAccessKeys', pipeline_response) @@ -754,8 +1194,11 @@ def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + 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 @@ -783,38 +1226,28 @@ def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'RedisRegenerateKeyParameters') + + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RedisRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RedisAccessKeys', pipeline_response) @@ -823,8 +1256,11 @@ def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + 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 @@ -852,38 +1288,28 @@ def force_reboot( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.force_reboot.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'RedisRebootParameters') + + request = build_force_reboot_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.force_reboot.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RedisRebootParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RedisForceRebootResponse', pipeline_response) @@ -892,8 +1318,10 @@ def force_reboot( return cls(pipeline_response, deserialized, {}) return deserialized + force_reboot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/forceReboot'} # type: ignore + def _import_data_initial( self, resource_group_name, # type: str @@ -907,45 +1335,36 @@ def _import_data_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._import_data_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ImportRDBParameters') + + request = build_import_data_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._import_data_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ImportRDBParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _import_data_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/import'} # type: ignore + + @distributed_trace def begin_import_data( self, resource_group_name, # type: str @@ -964,15 +1383,18 @@ def begin_import_data( :type parameters: ~azure.mgmt.redis.models.ImportRDBParameters :keyword callable cls: A custom type or function that will be passed the direct response :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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[None] lro_delay = kwargs.pop( 'polling_interval', @@ -984,24 +1406,18 @@ def begin_import_data( resource_group_name=resource_group_name, name=name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1013,6 +1429,7 @@ def get_long_running_output(pipeline_response): ) else: 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 def _export_data_initial( @@ -1028,45 +1445,36 @@ def _export_data_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._export_data_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ExportRDBParameters') + + request = build_export_data_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._export_data_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ExportRDBParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _export_data_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/export'} # type: ignore + + @distributed_trace def begin_export_data( self, resource_group_name, # type: str @@ -1085,15 +1493,18 @@ def begin_export_data( :type parameters: ~azure.mgmt.redis.models.ExportRDBParameters :keyword callable cls: A custom type or function that will be passed the direct response :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1105,24 +1516,18 @@ def begin_export_data( resource_group_name=resource_group_name, name=name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1134,4 +1539,5 @@ def get_long_running_output(pipeline_response): ) else: 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