跳转到主要内容

Microsoft Azure Container Registry Python客户端库

项目描述

Microsoft Azure SDK for Python

这是Microsoft Azure Container Registry客户端库。此软件包已在Python 3.7+上进行了测试。要查看Azure库的更完整视图,请参阅azure sdk python发布

免责声明

Azure SDK Python包对Python 2.7的支持已于2022年1月1日结束。有关更多信息及疑问,请参阅https://github.com/Azure/azure-sdk-for-python/issues/20691

入门指南

先决条件

安装软件包

pip install azure-mgmt-containerregistry
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.containerregistry import ContainerRegistryManagementClient
import os

sub_id = os.getenv("AZURE_SUBSCRIPTION_ID")
client = ContainerRegistryManagementClient(credential=DefaultAzureCredential(), subscription_id=sub_id)

示例

此包的代码示例可以在以下位置找到:

故障排除

下一步

提供反馈

如果您遇到任何错误或有建议,请在项目的问题部分提交问题。

发行历史

10.3.0 (2023-11-20)

新增功能

  • 模型注册表具有新的参数metadata_search
  • Model RegistryUpdateParameters具有新的参数metadata_search

10.2.0 (2023-09-21)

新增功能

  • 添加了操作组ArchiveVersionsOperations
  • 添加了操作组ArchivesOperations

10.1.0 (2023-02-15)

新增功能

  • 添加了操作组CacheRulesOperations
  • 添加了操作组CredentialSetsOperations

10.0.0 (2022-05-26)

功能

  • Model Policies具有新的参数azure_ad_authentication_as_arm_policy
  • Model Policies具有新的参数soft_delete_policy

破坏性变更

  • Model NetworkRuleSet不再具有参数virtual_network_rules

9.1.0 (2022-03-03)

功能

  • 添加了操作RegistriesOperations.begin_generate_credentials
  • Model NetworkRuleSet具有新的参数virtual_network_rules
  • Model Registry具有新的参数anonymous_pull_enabled
  • Model RegistryUpdateParameters具有新的参数anonymous_pull_enabled

9.0.0 (2022-01-19)

功能

  • 添加了操作RegistriesOperations.get_private_link_resource

破坏性变更

  • Model NetworkRuleSet不再具有参数virtual_network_rules
  • Model Registry不再具有参数anonymous_pull_enabled
  • Model RegistryUpdateParameters不再具有参数anonymous_pull_enabled
  • 删除了操作RegistriesOperations.begin_generate_credentials

8.2.0 (2021-10-26)

功能

  • Model ConnectedRegistryUpdateParameters具有新的参数notifications_list
  • Model ConnectedRegistry具有新的参数notifications_list

8.1.0 (2021-07-22)

功能

  • Model Policies具有新的参数export_policy
  • Model OperationDefinition具有新的参数is_data_action

8.0.0 (2021-05-25)

功能

  • Model PipelineRun具有新的参数system_data
  • Model TaskRunRequest具有新的参数log_template
  • Model TaskUpdateParameters具有新的参数log_template
  • Model Token具有新的参数system_data
  • Model EncodedTaskRunRequest具有新的参数log_template
  • Model ScopeMap具有新的参数system_data
  • Model AgentPool具有新的参数system_data
  • Model RegistryUpdateParameters具有新的参数anonymous_pull_enabled
  • Model RegistryUpdateParameters具有新的参数network_rule_bypass_options
  • Model ExportPipeline具有新的参数system_data
  • Model KeyVaultProperties具有新的参数key_rotation_enabled
  • Model KeyVaultProperties具有新的参数last_key_rotation_timestamp
  • Model Run具有新的参数log_artifact
  • Model Run具有新的参数system_data
  • Model FileTaskRunRequest具有新的参数log_template
  • Model RunRequest具有新的参数log_template
  • Model OperationServiceSpecificationDefinition具有新的参数log_specifications
  • Model Webhook具有新的参数system_data
  • Model ProxyResource具有新的参数system_data
  • Model TaskRun具有新的参数system_data
  • Model DockerBuildRequest具有新的参数log_template
  • Model Task具有新的参数is_system_task
  • Model Task具有新的参数system_data
  • Model Task具有新的参数log_template
  • Model Registry具有新的参数zone_redundancy
  • Model Registry具有新的参数anonymous_pull_enabled
  • Model Registry具有新的参数system_data
  • Model Registry具有新的参数network_rule_bypass_options
  • Model ImportPipeline具有新的参数system_data
  • Model Resource具有新的参数system_data
  • 模型PrivateEndpointConnection新增了参数system_data
  • 模型Replication新增了参数zone_redundancy
  • 模型Replication新增了参数system_data
  • 新增操作组ConnectedRegistriesOperations

破坏性变更

  • 模型QuickBuildRequest的参数类型现在为必填
  • 模型BuildStepProperties的参数类型现在为必填
  • 模型BuildStepPropertiesUpdateParameters的参数类型现在为必填
  • 模型QueueBuildRequest的参数类型现在为必填
  • 模型BuildTaskBuildRequest的参数类型现在为必填
  • 模型TokenCredentialsProperties不再有参数active_directory_object
  • 模型Registry不再有参数storage_account
  • 删除了操作RegistriesOperations.get_build_source_upload_url
  • 删除了操作RegistriesOperations.begin_schedule_run

8.0.0b1 (2020-10-12)

这是beta预览版本。

本版本使用新一代代码生成器,引入了重要的不兼容性更改,但也引入了重要的新功能(如统一身份验证和异步编程)。

一般不兼容性更改

  • 凭证系统已完全重构

    • azure.common.credentialsmsrestazure.azure_active_directory实例不再受支持,请使用azure-identity类:[https://pypi.ac.cn/project/azure-identity/](https://pypi.ac.cn/project/azure-identity/)
    • 参数名称credentials已更改为credential
  • 客户端上的config属性不再存在,配置应作为关键字参数传递。例如:MyClient(credential, subscription_id, enable_logging=True)。有关受支持的完整选项集,请参阅azure-core初始化文档中的参数接受

  • 不能再导入version模块,请使用__version__代替

  • 之前返回msrest.polling.LROPoller的操作现在返回azure.core.polling.LROPoller,并以begin_为前缀。

  • 异常树已被简化,大多数异常现在为azure.core.exceptions.HttpResponseError(已删除CloudError)。

  • 大多数操作关键字参数已更改。其中一些最显著的是

    • raw已被删除。等效功能可通过使用cls找到,这是一个回调,将为高级用户提供对内部HTTP响应的访问
    • 有关受支持的完整选项集,请参阅azure-core请求文档中的参数接受

一般新功能

  • 支持使用typing进行类型注解。SDKs已准备好mypy。
  • 该客户端现在对异步提供稳定和官方支持。检查您的包中的aio命名空间以找到异步客户端。
  • 该客户端现在支持原生跟踪库,如OpenCensus或OpenTelemetry。有关概述,请参阅此跟踪快速入门

3.0.0rc15(2020-9-16)

功能

  • Model FileTaskRunRequest具有新的参数log_template
  • Model Run具有新的参数log_artifact
  • Model EncodedTaskRunRequest具有新的参数log_template
  • 模型ImportPipeline新增了参数location
  • Model TaskRunRequest具有新的参数log_template
  • Model Task具有新的参数log_template
  • Model Task具有新的参数is_system_task
  • Model RunRequest具有新的参数log_template
  • 模型ExportPipeline新增了参数location
  • Model TaskUpdateParameters具有新的参数log_template
  • 模型TaskRunUpdateParameters新增了参数location
  • Model DockerBuildRequest具有新的参数log_template

破坏性变更

  • 模型TaskRun不再有参数tags

3.0.0rc14(2020-06-15)

功能

  • 模型RunGetLogResult新增了参数log_artifact_link

3.0.0rc13 (2020-05-15)

功能

  • 模型Replication新增了参数region_endpoint_enabled
  • 模型ReplicationUpdateParameters新增了参数region_endpoint_enabled

破坏性变更

  • 操作ReplicationsOperations.create新增了签名
  • 操作ReplicationsOperations.update新增了签名
  • 操作ReplicationsOperations.create新增了签名

3.0.0rc12(2020-05-06)

功能

  • 模型Registry新增了参数public_network_access
  • 模型ErrorResponseBody新增了参数details
  • 模型ErrorResponseBody新增了参数target
  • 模型RegistryUpdateParameters新增了参数public_network_access
  • 添加了操作组PipelineRunsOperations
  • 添加了操作组ImportPipelinesOperations
  • 添加了操作组ExportPipelinesOperations

3.0.0rc11 (2020-03-25)

破坏性变更

  • 操作 PrivateEndpointConnectionsOperations.create_or_update 具有新的签名
  • 操作 PrivateEndpointConnectionsOperations.create_or_update 具有新的签名

3.0.0rc10 (2020-03-11)

功能

  • 模型 FileTaskRunRequest 具有新的参数 agent_pool_name
  • 模型 RunRequest 具有新的参数 agent_pool_name
  • 模型 RunFilter 具有新的参数 agent_pool_name
  • 模型 DockerBuildRequest 具有新的参数 agent_pool_name
  • 模型 TaskRunRequest 具有新的参数 agent_pool_name
  • 模型 EncodedTaskRunRequest 具有新的参数 agent_pool_name
  • 模型 TaskUpdateParameters 具有新的参数 agent_pool_name
  • 模型 Run 具有新的参数 agent_pool_name
  • 模型 Task 具有新的参数 agent_pool_name
  • 添加了操作 TaskRunsOperations.get_details
  • 添加了操作组 AgentPoolsOperations

3.0.0rc9 (2020-03-02)

功能

  • 模型 Registry 具有新的参数 encryption
  • 模型 Registry 具有新的参数 data_endpoint_host_names
  • 模型 Registry 具有新的参数 private_endpoint_connections
  • 模型 Registry 具有新的参数 identity
  • 模型 Registry 具有新的参数 data_endpoint_enabled
  • 模型 TokenCredentialsProperties 具有新的参数 active_directory_object
  • 模型 RegistryUpdateParameters 具有新的参数 identity
  • 模型 RegistryUpdateParameters 具有新的参数 data_endpoint_enabled
  • 模型 RegistryUpdateParameters 具有新的参数 encryption
  • 添加了操作 RegistriesOperations.list_private_link_resources
  • 添加了操作组 PrivateEndpointConnectionsOperations

破坏性变更

  • 模型 Token 不再具有参数 object_id

3.0.0rc8 (2020-01-10)

功能

  • 添加了操作组 TaskRunsOperations

3.0.0rc7 (2019-10-23)

错误修复

  • 在 ScopeMaps 中进行了一些小修复

3.0.0rc6 (2019-10-03)

功能

  • 添加了操作 RegistriesOperations.generate_credentials

3.0.0rc5 (2019-08-02)

错误修复

  • 将 API 版本恢复到 2019-05-01

3.0.0rc4 (2019-07-10)

错误修复

  • 修复了从 2019-05-01 到 2017-10-01 错误的默认 API 版本

3.0.0rc3 (2019-07-01)

新的预览 API 版本 2019-06-01-preview 包含以下内容

功能

  • 模型 BaseImageTriggerUpdateParameters 具有新的参数 update_trigger_payload_type
  • 模型 BaseImageTriggerUpdateParameters 具有新的参数 update_trigger_endpoint
  • 模型 RegistryUpdateParameters 具有新的参数 policies
  • 模型 Registry 具有新的参数 policies
  • 模型 TaskRunRequest 具有新的参数 override_task_step_properties
  • 模型 BaseImageTrigger 具有新的参数 update_trigger_payload_type
  • 模型 BaseImageTrigger 具有新的参数 update_trigger_endpoint
  • 模型 Run 具有新的参数 update_trigger_token
  • 添加了操作 RegistriesOperations.get_build_source_upload_url
  • 添加了操作 RegistriesOperations.schedule_run

破坏性变更

  • 模型 RegistryUpdateParameters 不再具有参数 storage_account
  • 模型 TaskRunRequest 不再具有参数 task_name
  • 模型 TaskRunRequest 不再具有参数 values
  • 模型 TaskRunRequest 具有新的必选参数 task_id
  • 删除了操作 RegistriesOperations.list_policies
  • 删除了操作 RegistriesOperations.generate_credentials
  • 删除了操作 RegistriesOperations.update_policies

3.0.0rc2 (2019-06-12)

功能

  • 模型 Run 具有新的参数 timer_trigger

一般破坏性更改

本版本使用下一代代码生成器,在导入时可能会引入破坏性更改。总之,一些模块的可见性/导入不正确,并且已重命名。这解决了由于使用本不应使用的类而引起的一些问题。

  • 无法从 azure.mgmt.containerregistry.containerregistry_management_client 导入 ContainerRegistryManagementClient(从 azure.mgmt.containerregistry 的导入与之前相同)
  • ContainerRegistryManagementClientConfiguration 的导入已从 azure.mgmt.containerregistry.containerregistry_management_client 移至 azure.mgmt.containerregistry
  • 无法从 azure.mgmt.containerregistry.v20xx_yy_zz.containerregistry_management_client 导入 ContainerRegistryManagementClient(从 azure.mgmt.containerregistry.v20xx_yy_zz 的导入与之前相同)
  • ContainerRegistryManagementClientConfiguration 的导入已从 azure.mgmt.containerregistry.v20xx_yy_zz.containerregistry_management_client 移至 azure.mgmt.containerregistry.v20xx_yy_zz
  • 从 "models" 子模块中导入的模型 MyClass 现在无法使用 azure.mgmt.containerregistry.v20xx_yy_zz.models.my_class 进行导入(从 azure.mgmt.containerregistry.v20xx_yy_zz.models 的导入仍然像以前一样工作)
  • operations 子模块中的操作类 MyClassOperations 现在无法使用 azure.mgmt.containerregistry.v20xx_yy_zz.operations.my_class_operations 进行导入(从 azure.mgmt.containerregistry.v20xx_yy_zz.operations 的导入仍然像以前一样工作)

最后但同样重要的是,HTTP 连接池现在默认启用。您应该始终将客户端用作上下文管理器,或调用 close(),或每个进程最多使用一个 containerregistry mgmt 客户端。

3.0.0rc1(2019-05-24)

功能

  • 模型 Registry 具有新的参数 policies
  • 模型 RegistryUpdateParameters 具有新的参数 policies
  • 添加预览 ScopeMaps(2019-05-01-preview API 版本)

破坏性变更

  • 模型 RegistryUpdateParameters 不再具有参数 storage_account
  • 删除了操作 RegistriesOperations.update_policies
  • 删除了操作 RegistriesOperations.list_policies

2.8.0 (2019-04-30)

功能

  • 模型 CustomRegistryCredentials 有一个新参数 identity
  • 模型 Run 有一个新参数 run_error_message
  • 模型 Task 有一个新参数 identity
  • 模型 TaskUpdateParameters 有一个新参数 identity
  • 模型 Target 有一个新参数 name
  • 模型 Target 有一个新参数 version
  • 模型 TriggerProperties 有一个新参数 timer_triggers
  • 模型 TriggerUpdateParameters 有一个新参数 timer_triggers

2.7.0 (2019-01-25)

功能

  • 模型 Run 有一个新参数 custom_registries
  • 模型 Run 有一个新参数 source_registry_auth
  • 模型 DockerBuildStepUpdateParameters 有一个新参数 target
  • 模型 FileTaskRunRequest 有一个新参数 credentials
  • 模型 DockerBuildRequest 有一个新参数 credentials
  • 模型 DockerBuildRequest 有一个新参数 target
  • 模型 TaskUpdateParameters 有一个新参数 credentials
  • 模型 Task 有一个新参数 credentials
  • 模型 EncodedTaskRunRequest 有一个新参数 credentials
  • 模型 DockerBuildStep 有一个新参数 target

2.6.0 (2019-01-02)

功能

  • 添加 IP 规则

错误修复

  • 将错误的 "id" 重命名为 "virtual_network_resource_id"

2.5.0 (2018-12-10)

功能

  • 将网络规则集添加到注册表属性中

2.4.0 (2018-11-05)

功能

  • 将上下文令牌添加到任务步骤中

2.3.0 (2018-10-17)

  • 支持任务/运行的上下文路径、源位置 URL 和拉取请求触发器。
  • 允许在导入镜像时指定源注册表的凭据。

2.2.0 (2018-09-11)

功能

  • 添加了操作 RegistriesOperations.get_build_source_upload_url
  • 添加了操作 RegistriesOperations.schedule_run
  • 添加操作组 RunsOperations
  • 添加操作组 TasksOperations

默认 API 版本现在是 2018-09-01

2.1.0 (2018-07-26)

功能

  • 模型 OperationDefinition 有一个新参数 service_specification
  • 模型 OperationDefinition 有一个新参数 origin
  • 添加操作 RegistriesOperations.list_policies
  • 添加操作 RegistriesOperations.update_policies

2.0.0 (2018-04-30)

功能

  • 支持构建步骤/任务(ApiVersion 2018-02-01-preview)
  • 支持 Azure 配置文件
  • 客户端类可以用作上下文管理器以保持底层 HTTP 会话开启以改善性能

一般破坏性更改

此版本使用了一个下一代代码生成器,它可能会引入破坏性更改。

  • 模型签名现在仅使用关键字参数语法。所有位置参数必须重写为关键字参数。为了在大多数情况下保持自动完成,现在为 Python 2 和 Python 3 生成模型。Python 3 使用 "*" 语法表示关键字参数。
  • 枚举类型现在使用 "str" 混合(class 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 在轮询完成后调用将不再抛出异常,而是立即执行回调。

错误修复

  • 与 wheel 0.31.0 的兼容性。

1.0.1 (2017-10-09)

  • 将 Managed_Basic、Managed_Standard、Managed_Premium 重命名为 Basic、Standard、Premium。

1.0.0 (2017-09-22)

  • 新默认 API 版本 2017-10-01。
  • 移除对 API 版本 2017-06-01-preview 的支持。
  • 新增对具有三个 Managed SKU 的托管注册表的支持。
  • 新增对注册表网络钩子和复制的支持。
  • 将 Basic SKU 重命名为 Classic SKU。

0.3.1 (2017-06-30)

  • 支持注册表 SKU 更新(2017-06-01-preview)。
  • 新增 listUsages API 以获取容器注册表的配额使用情况(2017-06-01-preview)。

0.3.0 (2017-06-15)

  • 此包现在支持额外的 ApiVersion 2017-06-01-preview。

0.2.1 (2017-04-20)

此 wheel 包现在使用 azure wheel 扩展构建。

0.2.0 (2017-03-20)

  • 新增 ApiVersion 2017-03-01。
  • 更新 getCredentials 为 listCredentials 以支持多个登录凭证。
  • 优化 regenerateCredential 以支持重新生成指定的登录凭证。
  • 将 Sku 添加到注册表属性中,作为必填属性。
  • 将 GetProperties 重命名为 Get。
  • 将 CreateOrUpdate 更改为 Create,并添加注册表创建参数。

0.1.1 (2016-12-12)

错误修复

  • 修复 Create 和 Delete 操作中的随机错误。

0.1.0 (2016-11-04)

  • 初始发布

项目详情


下载文件

下载您平台上的文件。如果您不确定要选择哪个,请了解更多关于 安装包 的信息。

源代码分发

azure-mgmt-containerregistry-10.3.0.tar.gz (1.5 MB 查看哈希值)

上传时间 源码

构建版本

azure_mgmt_containerregistry-10.3.0-py3-none-any.whl (2.3 MB 查看哈希值)

上传时间 Python 3

由以下支持