Skip to content

Commit

Permalink
[AutoRelease] t2-redis-2023-09-07-46055(can only be merged by SDK own…
Browse files Browse the repository at this point in the history
…er) (Azure#31973)

* code and test

* local-live-test

* Update CHANGELOG.md

---------

Co-authored-by: azure-sdk <PythonSdkPipelines>
Co-authored-by: ChenxiJiang333 <v-chenjiang@microsoft.com>
Co-authored-by: Yuchao Yan <yuchaoyan@microsoft.com>
  • Loading branch information
3 people authored Sep 19, 2023
1 parent a800e83 commit d949281
Show file tree
Hide file tree
Showing 77 changed files with 4,315 additions and 407 deletions.
16 changes: 16 additions & 0 deletions sdk/redis/azure-mgmt-redis/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Release History

## 14.3.0 (2023-09-19)

### Features Added

- Added operation RedisOperations.begin_flush_cache
- Added operation group AccessPolicyAssignmentOperations
- Added operation group AccessPolicyOperations
- Model RedisCommonProperties has a new parameter update_channel
- Model RedisCommonPropertiesRedisConfiguration has a new parameter aad_enabled
- Model RedisCreateParameters has a new parameter update_channel
- Model RedisCreateProperties has a new parameter update_channel
- Model RedisProperties has a new parameter update_channel
- Model RedisResource has a new parameter update_channel
- Model RedisUpdateParameters has a new parameter update_channel
- Model RedisUpdateProperties has a new parameter update_channel

## 14.2.0 (2023-06-16)

### Features Added
Expand Down
10 changes: 5 additions & 5 deletions sdk/redis/azure-mgmt-redis/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"commit": "c183bb012de8e9e1d0d2e67a0994748df4747d2c",
"commit": "c1d7ef4e6ff16ff97f24b1497c82de0b665310c5",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.2",
"autorest": "3.9.7",
"use": [
"@autorest/python@6.4.12",
"@autorest/modelerfour@4.24.3"
"@autorest/python@6.7.1",
"@autorest/modelerfour@4.26.2"
],
"autorest_command": "autorest specification/redis/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.4.12 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
"autorest_command": "autorest specification/redis/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False",
"readme": "specification/redis/resource-manager/readme.md"
}
2 changes: 1 addition & 1 deletion sdk/redis/azure-mgmt-redis/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "python",
"TagPrefix": "python/redis/azure-mgmt-redis",
"Tag": "python/redis/azure-mgmt-redis_7856b8cd44"
"Tag": "python/redis/azure-mgmt-redis_b608d511f0"
}
7 changes: 3 additions & 4 deletions sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,16 @@ class RedisManagementClientConfiguration(Configuration): # pylint: disable=too-
:param credential: Credential needed for the client to connect to Azure. Required.
: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. Required.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2023-04-01". Note that overriding this
:keyword api_version: Api Version. Default value is "2023-08-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
super(RedisManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2023-04-01")
api_version: str = kwargs.pop("api_version", "2023-08-01")

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
from ._configuration import RedisManagementClientConfiguration
from ._serialization import Deserializer, Serializer
from .operations import (
AccessPolicyAssignmentOperations,
AccessPolicyOperations,
AsyncOperationStatusOperations,
FirewallRulesOperations,
LinkedServerOperations,
Expand Down Expand Up @@ -51,14 +53,17 @@ class RedisManagementClient: # pylint: disable=client-accepts-api-version-keywo
:vartype private_link_resources: azure.mgmt.redis.operations.PrivateLinkResourcesOperations
:ivar async_operation_status: AsyncOperationStatusOperations operations
:vartype async_operation_status: azure.mgmt.redis.operations.AsyncOperationStatusOperations
:ivar access_policy: AccessPolicyOperations operations
:vartype access_policy: azure.mgmt.redis.operations.AccessPolicyOperations
:ivar access_policy_assignment: AccessPolicyAssignmentOperations operations
:vartype access_policy_assignment: azure.mgmt.redis.operations.AccessPolicyAssignmentOperations
:param credential: Credential needed for the client to connect to Azure. Required.
: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. Required.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2023-04-01". Note that overriding this
:keyword api_version: Api Version. Default value is "2023-08-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Expand Down Expand Up @@ -95,6 +100,10 @@ def __init__(
self.async_operation_status = AsyncOperationStatusOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.access_policy = AccessPolicyOperations(self._client, self._config, self._serialize, self._deserialize)
self.access_policy_assignment = AccessPolicyAssignmentOperations(
self._client, self._config, self._serialize, self._deserialize
)

def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
Expand Down
26 changes: 18 additions & 8 deletions sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,8 +662,9 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
_serialized.update(_new_attr) # type: ignore
_new_attr = _new_attr[k] # type: ignore
_serialized = _serialized[k]
except ValueError:
continue
except ValueError as err:
if isinstance(err, SerializationError):
raise

except (AttributeError, KeyError, TypeError) as err:
msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj))
Expand Down Expand Up @@ -741,6 +742,8 @@ def query(self, name, data, data_type, **kwargs):
:param data: The data to be serialized.
:param str data_type: The type to be serialized from.
:keyword bool skip_quote: Whether to skip quote the serialized result.
Defaults to False.
:rtype: str
:raises: TypeError if serialization fails.
:raises: ValueError if data is None
Expand All @@ -749,10 +752,8 @@ def query(self, name, data, data_type, **kwargs):
# Treat the list aside, since we don't want to encode the div separator
if data_type.startswith("["):
internal_data_type = data_type[1:-1]
data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data]
if not kwargs.get("skip_quote", False):
data = [quote(str(d), safe="") for d in data]
return str(self.serialize_iter(data, internal_data_type, **kwargs))
do_quote = not kwargs.get("skip_quote", False)
return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs))

# Not a list, regular serialization
output = self.serialize_data(data, data_type, **kwargs)
Expand Down Expand Up @@ -891,6 +892,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
not be None or empty.
:param str div: If set, this str will be used to combine the elements
in the iterable into a combined string. Default is 'None'.
:keyword bool do_quote: Whether to quote the serialized result of each iterable element.
Defaults to False.
:rtype: list, str
"""
if isinstance(data, str):
Expand All @@ -903,9 +906,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
for d in data:
try:
serialized.append(self.serialize_data(d, iter_type, **kwargs))
except ValueError:
except ValueError as err:
if isinstance(err, SerializationError):
raise
serialized.append(None)

if kwargs.get("do_quote", False):
serialized = ["" if s is None else quote(str(s), safe="") for s in serialized]

if div:
serialized = ["" if s is None else str(s) for s in serialized]
serialized = div.join(serialized)
Expand Down Expand Up @@ -950,7 +958,9 @@ def serialize_dict(self, attr, dict_type, **kwargs):
for key, value in attr.items():
try:
serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs)
except ValueError:
except ValueError as err:
if isinstance(err, SerializationError):
raise
serialized[self.serialize_unicode(key)] = None

if "xml" in serialization_ctxt:
Expand Down
14 changes: 0 additions & 14 deletions sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_vendor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import List, cast

from azure.core.pipeline.transport import HttpRequest


Expand All @@ -16,15 +14,3 @@ def _convert_request(request, files=None):
if files:
request.set_formdata_body(files)
return request


def _format_url_section(template, **kwargs):
components = template.split("/")
while components:
try:
return template.format(**kwargs)
except KeyError as key:
# Need the cast, as for some reasons "split" is typed as list[str | Any]
formatted_components = cast(List[str], template.split("/"))
components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
template = "/".join(components)
2 changes: 1 addition & 1 deletion sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

VERSION = "14.2.0"
VERSION = "14.3.0"
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,16 @@ class RedisManagementClientConfiguration(Configuration): # pylint: disable=too-
:param credential: Credential needed for the client to connect to Azure. Required.
: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. Required.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2023-04-01". Note that overriding this
:keyword api_version: Api Version. Default value is "2023-08-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
super(RedisManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2023-04-01")
api_version: str = kwargs.pop("api_version", "2023-08-01")

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
from .._serialization import Deserializer, Serializer
from ._configuration import RedisManagementClientConfiguration
from .operations import (
AccessPolicyAssignmentOperations,
AccessPolicyOperations,
AsyncOperationStatusOperations,
FirewallRulesOperations,
LinkedServerOperations,
Expand Down Expand Up @@ -51,14 +53,18 @@ class RedisManagementClient: # pylint: disable=client-accepts-api-version-keywo
:vartype private_link_resources: azure.mgmt.redis.aio.operations.PrivateLinkResourcesOperations
:ivar async_operation_status: AsyncOperationStatusOperations operations
:vartype async_operation_status: azure.mgmt.redis.aio.operations.AsyncOperationStatusOperations
:ivar access_policy: AccessPolicyOperations operations
:vartype access_policy: azure.mgmt.redis.aio.operations.AccessPolicyOperations
:ivar access_policy_assignment: AccessPolicyAssignmentOperations operations
:vartype access_policy_assignment:
azure.mgmt.redis.aio.operations.AccessPolicyAssignmentOperations
:param credential: Credential needed for the client to connect to Azure. Required.
: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. Required.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2023-04-01". Note that overriding this
:keyword api_version: Api Version. Default value is "2023-08-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Expand Down Expand Up @@ -95,6 +101,10 @@ def __init__(
self.async_operation_status = AsyncOperationStatusOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.access_policy = AccessPolicyOperations(self._client, self._config, self._serialize, self._deserialize)
self.access_policy_assignment = AccessPolicyAssignmentOperations(
self._client, self._config, self._serialize, self._deserialize
)

def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
"""Runs the network request through the client's chained policies.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations
from ._private_link_resources_operations import PrivateLinkResourcesOperations
from ._async_operation_status_operations import AsyncOperationStatusOperations
from ._access_policy_operations import AccessPolicyOperations
from ._access_policy_assignment_operations import AccessPolicyAssignmentOperations

from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
Expand All @@ -28,6 +30,8 @@
"PrivateEndpointConnectionsOperations",
"PrivateLinkResourcesOperations",
"AsyncOperationStatusOperations",
"AccessPolicyOperations",
"AccessPolicyAssignmentOperations",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()
Loading

0 comments on commit d949281

Please sign in to comment.