Microsoft Azure Container Instance Client Library for Python
项目描述
Microsoft Azure SDK for Python
这是Microsoft Azure Container Instance Client Library。此包已在Python 3.7+上进行了测试。有关Azure库的更完整视图,请参阅azure sdk python release。
免责声明
Azure SDK Python包对Python 2.7的支持已于2022年1月1日结束。有关更多信息及疑问,请参阅https://github.com/Azure/azure-sdk-for-python/issues/20691
入门指南
先决条件
- 使用此包需要Python 3.7+。
- Azure订阅
安装包
pip install azure-mgmt-containerinstance
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.containerinstance import ContainerInstanceManagementClient
import os
sub_id = os.getenv("AZURE_SUBSCRIPTION_ID")
client = ContainerInstanceManagementClient(credential=DefaultAzureCredential(), subscription_id=sub_id)
示例
此包的代码示例可在以下位置找到
故障排除
下一步
提供反馈
如果您遇到任何错误或有建议,请在项目的 问题 部分提交问题。
发布历史
10.1.0 (2023-04-21)
新增功能
- 模型容器新增参数 security_context
- 模型容器组新增参数 confidential_compute_properties
- 模型容器组新增参数 extensions
- 模型容器组新增参数 priority
- 模型容器组属性新增参数 confidential_compute_properties
- 模型容器组属性新增参数 extensions
- 模型容器组属性新增参数 priority
- 模型加密属性新增参数 identity
- 模型初始化容器定义新增参数 security_context
10.1.0b2 (2023-04-20)
新增功能
- 模型容器组新增参数 is_custom_provisioning_timeout
- 模型容器组新增参数 provisioning_timeout_in_seconds
- 模型容器组属性新增参数 is_custom_provisioning_timeout
- 模型容器组属性新增参数 provisioning_timeout_in_seconds
破坏性更改
- 模型容器组不再有参数 confidential_compute_properties
- 模型容器组不再有参数 priority
- 模型容器组属性不再有参数 confidential_compute_properties
- 模型容器组属性不再有参数 priority
10.1.0b1 (2022-12-26)
新增功能
- 模型容器组新增参数 confidential_compute_properties
- 模型容器组新增参数 extensions
- 模型容器组新增参数 priority
- 模型容器组属性新增参数 confidential_compute_properties
- 模型容器组属性新增参数 extensions
- 模型容器组属性新增参数 priority
- 模型加密属性新增参数 identity
10.0.0 (2022-08-29)
新增功能
- 添加了操作组 SubnetServiceAssociationLinkOperations
- 模型 IpAddress 新增参数 auto_generated_domain_name_label_scope
- 模型 Usage 新增参数 id
破坏性更改
- 模型 IpAddress 不再有参数 dns_name_label_reuse_policy
9.2.0 (2022-04-15)
功能
- 模型 IpAddress 新增参数 dns_name_label_reuse_policy
9.1.0 (2021-10-13)
功能
- 模型容器组新增参数 zones
- 模型 Resource 新增参数 zones
9.0.0 (2021-09-17)
功能
- 模型 ImageRegistryCredential 新增参数 identity_url
- 模型 ImageRegistryCredential 新增参数 identity
- 模型容器组新增参数 subnet_ids
- 添加操作 ContainerGroupsOperations.get_outbound_network_dependencies_endpoints
破坏性更改
- 模型容器组不再有参数 network_profile
8.0.0 (2021-07-20)
功能
- 模型 LogAnalytics 新增参数 workspace_resource_id
- 模型 ContainerHttpGet 新增参数 http_headers
- 添加操作 ContainersOperations.attach
破坏性更改
- 操作 ContainersOperations.list_logs 新增签名
7.0.0 (2020-11-25)
- GA 版本
7.0.0b1 (2020-10-12)
这是beta预览版本。
此版本使用新一代代码生成器,引入了重要的破坏性更改,但也引入了重要的新功能(如统一认证和异步编程)。
一般破坏性更改
-
凭证系统已完全重构成
azure.common.credentials
或msrestazure.azure_active_directory
实例不再受支持,请使用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 等跟踪库。查看此 跟踪快速入门 以获取概述。
2.0.0 (2020-06-24)
功能
- 模型 ContainerGroup 有一个新参数 init_containers
- 模型 ContainerGroup 有一个新参数 sku
- 模型 ContainerGroup 有一个新参数 encryption_properties
- 添加了操作组 ContainersOperations
- 添加了操作组 LocationOperations
破坏性更改
- 模型 CachedImages 已不再有参数 id
- 删除了操作组 ContainerGroupUsageOperations
- 删除了操作组 ServiceAssociationLinkOperations
- 删除了操作组 ContainerOperations
1.5.0 (2019-05-22)
功能
- 添加客户端级别操作列表 cached_images 和 list_capabilities
1.4.1 (2019-04-01)
错误修复
- 修复由 setuptools 40.6.0 引起的错误 wheel METADATA
1.4.0 (2018-11-12)
功能
- 添加 container_groups.start
1.3.0 (2018-11-05)
功能
- 模型 ResourceLimits 有一个新参数 gpu
- 模型 ResourceRequests 有一个新参数 gpu
- 模型 ContainerGroup 有一个新参数 dns_config
1.2.1 (2018-10-16)
错误修复
- 修复 1.2.0 中损坏的 sdist。没有代码更改。
1.2.0 (2018-10-08)
功能
- 模型 ContainerGroup 有一个新参数 identity(MSI 支持)
- 添加了操作组 ServiceAssociationLinkOperations
注意
- 在 Python 3 上不再安装 azure-mgmt-nspkg(基于 PEP420 的命名空间包)
1.1.0 (2018-09-06)
功能
- 模型 LogAnalytics 有一个新参数 log_type
- 模型 LogAnalytics 有一个新参数 metadata
- 模型 ContainerGroup 有一个新参数 network_profile
- 添加了操作 ContainerGroupsOperations.stop
- 添加了操作 ContainerGroupsOperations.restart
1.0.0 (2018-06-13)
功能
- 模型 Container 有一个新参数 liveness_probe
- 模型 Container 有一个新参数 readiness_probe
- 模型 ContainerGroup 有一个新参数 diagnostics
- 模型 EnvironmentVariable 有一个新参数 secure_value
- 客户端类可以用作上下文管理器以保持底层 HTTP 会话打开以提高性能
通用重大更改
此版本使用下一代代码生成器,可能会引入重大更改。
- 模型签名现在仅使用关键字参数语法。所有位置参数必须重写为关键字参数。为了在大多数情况下保持自动完成,现在为 Python 2 和 Python 3 生成模型。Python 3 使用 "*" 语法进行关键字仅参数。
- 枚举类型现在使用 "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
在轮询完成后调用将不再引发异常,而是立即执行回调。
- 返回类型从
0.4.0 (2018-03-19)
破坏性更改
- container_groups.create_or_update 现在是一个长运行操作
功能
- 新增 start_container 操作组
0.3.1 (2018-02-05)
- 将 dnsnamelabel 修复为 dns_name_label
0.3.0 (2018-02-01)
- 添加 dnsnamelabel
- 添加 fqdn
- 添加 container_group_usage 操作组
- 将 git_repo 和 secret 添加到 volumes
- 添加 container_groups.update
API 版本现在是 2018-02-01-preview
0.2.0 (2017-10-20)
- 添加了 on-failure/never 容器组重试策略
- 添加了容器卷挂载支持
- 添加了操作 API
- 添加了容器组实例视图
- 重命名事件类
0.1.0 (2017-07-27)
- 初步预览版本
项目详情
下载文件
下载您平台上的文件。如果您不确定选择哪个,请了解有关 安装包 的更多信息。
源分布
构建分布
哈希值 for azure-mgmt-containerinstance-10.1.0-py3-none-any.whl
算法 | 哈希摘要 | |
---|---|---|
SHA256 | ee7977b7b70f2233e44ec6ce8c99027f3f7892bb3452b4bad46df340d9f98959 |
|
MD5 | b5a2a34f0a80d1a8ce335f51c73b798d |
|
BLAKE2b-256 | 34113bfa586ac0514e1fe224879c065dbec39c0d9d2653b74549ac8080408f07 |