Microsoft Azure Redis Cache 管理客户端库 for Python
项目描述
Microsoft Azure SDK for Python
这是 Microsoft Azure Redis Cache 管理客户端库。此包已在 Python 3.8+ 上进行了测试。有关 Azure 库的更完整视图,请参阅azure sdk python 发布。
免责声明
Azure SDK Python 对 Python 2.7 的支持已于 2022 年 1 月 1 日结束。有关更多信息,请参阅 https://github.com/Azure/azure-sdk-for-python/issues/20691
入门指南
先决条件
- 使用此包需要 Python 3.8+。
- Azure 订阅
安装包
pip install azure-mgmt-redis
pip install azure-identity
身份验证
默认情况下,Azure Active Directory令牌认证依赖于以下环境变量的正确配置。
AZURE_CLIENT_ID
用于 Azure 客户端 ID。AZURE_TENANT_ID
用于 Azure 租户 ID。AZURE_CLIENT_SECRET
用于 Azure 客户端密钥。
此外,可以通过环境变量 AZURE_SUBSCRIPTION_ID
配置 Azure 订阅 ID。
以上配置后,客户端可以通过以下代码进行认证
from azure.identity import DefaultAzureCredential
from azure.mgmt.redis import RedisManagementClient
import os
sub_id = os.getenv("AZURE_SUBSCRIPTION_ID")
client = RedisManagementClient(credential=DefaultAzureCredential(), subscription_id=sub_id)
示例
此包的代码示例可以在以下位置找到
故障排除
下一步
提供反馈
如果您遇到任何错误或有建议,请在该项目的问题部分提交问题。
版本历史
14.4.0 (2024-07-21)
新增功能
- Model RedisCommonProperties 具有新参数 disable_access_key_authentication
- Model RedisCommonPropertiesRedisConfiguration 具有新参数 notify_keyspace_events
- Model RedisCreateParameters 具有新参数 disable_access_key_authentication
- Model RedisCreateProperties 具有新参数 disable_access_key_authentication
- Model RedisProperties 具有新参数 disable_access_key_authentication
- Model RedisResource 具有新参数 disable_access_key_authentication
- Model RedisUpdateParameters 具有新参数 disable_access_key_authentication
- Model RedisUpdateProperties 具有新参数 disable_access_key_authentication
14.3.0 (2023-09-19)
新增功能
- 添加了操作 RedisOperations.begin_flush_cache
- 添加了操作组 AccessPolicyAssignmentOperations
- 添加了操作组 AccessPolicyOperations
- Model RedisCommonProperties 具有新参数 update_channel
- Model RedisCommonPropertiesRedisConfiguration 具有新参数 aad_enabled
- Model RedisCreateParameters 具有新参数 update_channel
- Model RedisCreateProperties 具有新参数 update_channel
- Model RedisProperties 具有新参数 update_channel
- Model RedisResource 具有新参数 update_channel
- Model RedisUpdateParameters 具有新参数 update_channel
- Model RedisUpdateProperties 具有新参数 update_channel
14.2.0 (2023-06-16)
新增功能
- Model ExportRDBParameters 具有新参数 storage_subscription_id
- Model ImportRDBParameters 具有新参数 storage_subscription_id
- Model RedisCommonPropertiesRedisConfiguration 具有新参数 storage_subscription_id
14.1.0 (2022-10-28)
新增功能
- Model RedisLinkedServerCreateParameters 具有新参数 geo_replicated_primary_host_name
- Model RedisLinkedServerCreateParameters 具有新参数 primary_host_name
- Model RedisLinkedServerCreateProperties 具有新参数 geo_replicated_primary_host_name
- Model RedisLinkedServerCreateProperties 具有新参数 primary_host_name
- Model RedisLinkedServerProperties 具有新参数 geo_replicated_primary_host_name
- Model RedisLinkedServerProperties 具有新参数 primary_host_name
- Model RedisLinkedServerWithProperties 具有新参数 geo_replicated_primary_host_name
- Model RedisLinkedServerWithProperties 具有新参数 primary_host_name
14.0.0 (2022-09-05)
新增功能
- 添加了操作组 AsyncOperationStatusOperations
- Model ExportRDBParameters 具有新参数 preferred_data_archive_auth_method
- Model ImportRDBParameters 具有新参数 preferred_data_archive_auth_method
- Model RedisCommonPropertiesRedisConfiguration 具有新参数 aof_backup_enabled
- Model RedisCommonPropertiesRedisConfiguration 具有新参数 authnotrequired
- Model RedisCommonPropertiesRedisConfiguration 具有新参数 zonal_configuration
- Model RedisPatchSchedule 具有新参数 location
重大更改
- 将操作 LinkedServerOperations.delete 重命名为 LinkedServerOperations.begin_delete
- 将操作 RedisOperations.update 重命名为 RedisOperations.begin_update
13.1.0 (2021-12-16)
功能
- Model RedisResource 具有新参数 identity
- Model RedisUpdateParameters 具有新参数 identity
- Model RedisCreateParameters 具有新参数 identity
13.0.0 (2021-07-16)
功能
- Model RedisUpdateProperties 具有新参数 redis_version
- 模型 RedisUpdateProperties 添加了新参数 replicas_per_primary
- 模型 RedisUpdateProperties 添加了新参数 public_network_access
- 模型 RedisCommonProperties 添加了新参数 redis_version
- 模型 RedisCommonProperties 添加了新参数 replicas_per_primary
- 模型 RedisCommonProperties 添加了新参数 public_network_access
- 模型 RedisFirewallRuleCreateParameters 添加了新参数 type
- 模型 RedisFirewallRuleCreateParameters 添加了新参数 name
- 模型 RedisFirewallRuleCreateParameters 添加了新参数 id
- 模型 RedisProperties 添加了新参数 private_endpoint_connections
- 模型 RedisProperties 添加了新参数 replicas_per_primary
- 模型 RedisProperties 添加了新参数 public_network_access
- 模型 RedisCreateProperties 添加了新参数 redis_version
- 模型 RedisCreateProperties 添加了新参数 replicas_per_primary
- 模型 RedisCreateProperties 添加了新参数 public_network_access
- 模型 RedisUpdateParameters 添加了新参数 redis_version
- 模型 RedisUpdateParameters 添加了新参数 replicas_per_primary
- 模型 RedisUpdateParameters 添加了新参数 public_network_access
- 模型 RedisResource 添加了新参数 private_endpoint_connections
- 模型 RedisResource 添加了新参数 replicas_per_primary
- 模型 RedisResource 添加了新参数 public_network_access
- 模型 RedisInstanceDetails 添加了新参数 is_primary
- 模型 RedisCreateParameters 添加了新参数 redis_version
- 模型 RedisCreateParameters 添加了新参数 replicas_per_primary
- 模型 RedisCreateParameters 添加了新参数 public_network_access
- 添加了操作 RedisOperations.list_by_subscription
- 添加了操作 FirewallRulesOperations.list
- 添加了操作组 PrivateLinkResourcesOperations
- 添加了操作组 PrivateEndpointConnectionsOperations
重大变更
- 移除了操作 RedisOperations.list
- 移除了操作 FirewallRulesOperations.list_by_redis_resource
12.0.0 (2020-11-25)
12.0.0b1 (2020-10-12)
这是测试预览版本。
该版本使用下一代代码生成器,引入了重要的重大变更,但也引入了重要的新功能(如统一身份验证和异步编程)。
一般重大变更
-
凭证系统已完全重构成
azure.common.credentials
或msrestazure.azure_active_directory
实例不再受支持,请使用azure-identity
类:[https://pypi.ac.cn/project/azure-identity/](https://pypi.ac.cn/project/azure-identity/)credentials
参数已重命名为credential
-
客户端上的
config
属性不再存在,配置应作为 kwarg 传递。例如:MyClient(credential, subscription_id, enable_logging=True)
。有关受支持选项的完整列表,请参阅 azure-core 初始化文档中的参数接受 -
不再可以导入
version
模块,请使用__version__
代替 -
以前返回
msrest.polling.LROPoller
的操作现在返回azure.core.polling.LROPoller
并以前缀begin_
开头。 -
异常树已简化,大多数异常现在为
azure.core.exceptions.HttpResponseError
(已删除CloudError
)。 -
大多数操作 kwarg 已更改。其中一些最明显的变化
raw
已删除。等效功能可以通过使用cls
找到,它是一个回调,将为高级用户提供对内部 HTTP 响应的访问- 有关受支持的选项的完整列表,请参阅 azure-core 请求文档中的参数接受
一般新功能
- 支持使用
typing
进行类型注解。SDKs 已准备好使用 mypy。 - 该客户端现在稳定并正式支持异步。检查您的包中的
aio
命名空间以找到异步客户端。 - 该客户端现在原生支持 OpenCensus 或 OpenTelemetry 等跟踪库。请参阅此 跟踪快速入门 以了解概述。
7.0.0rc2 (2020-09-01)
功能
- 模型 RedisRebootParameters 添加了新参数 ports
- 模型 RedisInstanceDetails 新增参数 is_master
重大变更
- 操作 RedisOperations.force_reboot 新增签名
7.0.0rc1(2019-12-07)
功能
- 模型 RedisUpdateParameters 新增参数 replicas_per_master
- 模型 RedisCreateParameters 新增参数 replicas_per_master
- 模型 RedisResource 新增参数 instances
- 模型 RedisResource 新增参数 replicas_per_master
一般性重大变更
本版本使用下一代代码生成器,可能会因某些导入而引入重大变更。总结来说,一些模块的可见性/导入方式不正确,已被重命名。这解决了由于使用本不应使用的类而引起的一些问题。
- RedisManagementClient 无法从
azure.mgmt.redis.redis_management_client
导入(从azure.mgmt.redis
导入与之前相同) - RedisManagementClientConfiguration 的导入已从
azure.mgmt.redis.redis_management_client
移至azure.mgmt.redis
- 从 "models" 子模块导入模型
MyClass
的方式无法使用azure.mgmt.redis.models.my_class
(从azure.mgmt.redis.models
导入与之前相同) - 从
operations
子模块导入操作类MyClassOperations
的方式无法使用azure.mgmt.redis.operations.my_class_operations
(从azure.mgmt.redis.operations
导入与之前相同)
最后但同样重要的是,HTTP 连接池现在默认启用。您应始终将客户端用作上下文管理器,或调用 close(),或每个进程使用不超过一个客户端。
6.0.0 (2019-01-15)
注意
- 在 Python 3 上不再安装 azure-mgmt-nspkg(基于 PEP420 的命名空间包)
功能
- 客户端类可以用作上下文管理器,以保持底层 HTTP 会话打开,以提高性能
- 模型 RedisCreateParameters 新增参数 minimum_tls_version
- 模型 RedisResource 新增参数 minimum_tls_version
- 模型 RedisUpdateParameters 新增参数 minimum_tls_version
- 添加了操作 PatchSchedulesOperations.list_by_redis_resource
- 添加了操作 RedisOperations.list_upgrade_notifications
- 添加了操作 RedisOperations.check_name_availability
一般性重大变更
本版本使用下一代代码生成器,可能会引入重大变更。
- 模型签名现在只使用关键字参数语法。所有位置参数必须重写为关键字参数。为了在大多数情况下保持自动完成,现在为 Python 2 和 Python 3 生成模型。Python 3 使用 "*" 语法进行关键字-only 参数。
- 枚举类型现在使用 "str" 混合(类 AzureEnum(str, Enum))来改进遇到未识别的枚举值时的行为。虽然这不是重大变更,但区分很重要,这里进行了说明:https://docs.pythonlang.cn/3/library/enum.html#others 初步了解
- "is" 完全不应使用。
- "format" 将返回字符串值,其中 "%s" 字符串格式化将返回
NameOfEnum.stringvalue
。应优先使用格式化语法。
- 新的长时间运行操作
- 返回类型从
msrestazure.azure_operation.AzureOperationPoller
更改为msrest.polling.LROPoller
。外部 API 与之前相同。 - 返回类型现在始终是
msrest.polling.LROPoller
,无论使用哪些可选参数。 - 使用
raw=True
时的行为已更改。现在不再是返回初始调用结果作为ClientRawResponse
,而不进行轮询,而是返回 LROPoller。轮询后,最终资源将作为ClientRawResponse
返回。 - 新的
polling
参数。默认行为是Polling=True
,这将使用 ARM 算法进行轮询。当Polling=False
时,将返回初始调用的响应,而不进行轮询。 polling
参数接受msrest.polling.PollingMethod
子类的实例。add_done_callback
将不再在轮询完成后引发,而是立即执行回调。
- 返回类型从
5.0.0 (2018-02-08)
免责声明
一些模型(如RedisCreateParameters)的参数顺序被打乱,这是由于我们的代码生成器中的限制造成的。如果您使用关键字参数,则不会出现错误。如果您使用位置参数,我们强烈建议在创建模型时仅使用关键字参数,因为下一个版本6.0.0将使用仅关键字参数来处理模型。
重大变更
- RedisCreateParameters参数顺序被打乱(见免责声明)
- RedisUpdateParameters参数顺序被打乱(见免责声明)
- 将redis_firewall_rule操作组合并到firewall_rules
- 将firewall_rules.list重命名为firewall_rules.list_by_redis_resource
功能
- 所有操作组现在都有一个"models"属性
- 添加linked_server操作组
新的ApiVersion 2017-10-01
4.1.1 (2017-10-25)
错误修复
- 修复redis更新中的"tags"属性
4.1.0 (2017-04-18)
功能
- 添加防火墙规则操作
备注
- 此轮包现在使用azure wheel扩展构建
4.0.0 (2017-01-13)
错误修复
- 修复在不存在时修补的错误
重大更改
redis.update
不再是一个异步操作
3.0.0 (2016-11-14)
新功能
- 将"Everyday"和"Weekend"添加到调度枚举中
- 改进技术文档
重大更改
- 简化
patch_schedules.create_or_update
参数
2.0.0 (2016-10-20)
- 主要错误修复和重构。
1.0.0 (2016-08-09)
- 初始版本(API版本2016-04-01)
项目详情
下载文件
下载适用于您平台的文件。如果您不确定要选择哪一个,请了解有关安装包的更多信息。