跳转到主要内容

Microsoft Azure Reservations Client Library for Python

项目描述

Microsoft Azure SDK for Python

这是Microsoft Azure Reservations客户端库。此包已与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-reservations
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.reservations import AzureReservationAPI
import os

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

示例

此包的代码示例可以在docs.microsoft.com上的预订示例存储库找到。

故障排除

下一步

提供反馈

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

Impressions

发布历史

2.3.0 (2023-03-20)

新增功能

  • 模型目录Msrp有一个新参数p3_y
  • 模型目录Msrp有一个新参数p5_y

2.2.0 (2023-02-15)

新增功能

  • 模型CalculateExchangeRequestProperties有一个新参数savings_plans_to_purchase
  • 模型CalculateExchangeResponseProperties有一个新参数savings_plans_to_purchase
  • 模型ExchangeResponseProperties有一个新参数savings_plans_to_purchase
  • 模型Patch有一个新参数applied_scope_properties
  • 模型Patch有一个新参数review_date_time
  • 模型PurchaseRequest有一个新参数applied_scope_properties
  • 模型PurchaseRequest有一个新参数review_date_time
  • 模型ReservationOrderResponse有一个新参数expiry_date_time
  • 模型ReservationOrderResponse有一个新参数review_date_time
  • 模型ReservationSummary有一个新参数no_benefit_count
  • 模型ReservationSummary有一个新参数warning_count
  • 模型ReservationsProperties有一个新参数applied_scope_properties
  • 模型ReservationsProperties有一个新参数expiry_date_time
  • 模型ReservationsProperties有一个新参数purchase_date_time
  • 模型ReservationsProperties有一个新参数review_date_time
  • 模型ReservationsProperties有一个新参数swap_properties
  • 操作AzureReservationAPIOperationsMixin.get_catalog有一个新的可选参数filter
  • 操作AzureReservationAPIOperationsMixin.get_catalog有一个新的可选参数skip
  • 操作AzureReservationAPIOperationsMixin.get_catalog有一个新的可选参数take

破坏性更改

  • 将操作ReturnOperations.post重命名为ReturnOperations.begin_post

2.2.0b1 (2022-12-27)

新增功能

  • 模型ReservationsProperties有一个新参数applied_scope_properties
  • 模型ReservationsProperties有一个新参数swap_properties

2.1.0 (2022-09-19)

新增功能

  • 添加了操作ReservationOperations.archive
  • 添加了操作ReservationOperations.unarchive
  • 添加了操作组CalculateRefundOperations
  • 添加了操作组ReturnOperations

2.0.0 (2022-04-20)

功能

  • 添加了操作ReservationOperations.list_all
  • 添加了操作ReservationOrderOperations.change_directory
  • 模型CalculatePriceResponseProperties有一个新参数grand_total
  • 模型CalculatePriceResponseProperties有一个新参数is_tax_included
  • 模型CalculatePriceResponseProperties有一个新参数net_total
  • 模型CalculatePriceResponseProperties有一个新参数tax_total
  • 模型Catalog有一个新参数capabilities
  • 模型Catalog有一个新参数msrp
  • 模型Catalog有一个新参数size
  • 模型Catalog有一个新参数tier
  • 模型CurrentQuotaLimit有一个新参数id
  • 模型CurrentQuotaLimit有一个新参数name
  • 模型CurrentQuotaLimit有一个新参数type
  • 模型CurrentQuotaLimitBase有一个新参数id
  • 模型CurrentQuotaLimitBase有一个新参数name
  • 模型CurrentQuotaLimitBase有一个新参数type
  • 模型OperationResponse有一个新参数is_data_action
  • 模型OperationResponse有一个新参数properties
  • 模型QuotaRequestOneResourceSubmitResponse有一个新参数id_properties_id
  • 模型QuotaRequestOneResourceSubmitResponse有一个新参数name_properties_name
  • 模型QuotaRequestOneResourceSubmitResponse新增参数type_properties_type
  • 模型ReservationOrderResponse新增参数benefit_start_time
  • 模型ReservationOrderResponse新增参数system_data
  • 模型ReservationResponse新增参数kind
  • 模型ReservationResponse新增参数system_data

重大变更

  • 操作AzureReservationAPIOperationsMixin.get_catalog新增参数offer_id
  • 操作AzureReservationAPIOperationsMixin.get_catalog新增参数plan_id
  • 操作AzureReservationAPIOperationsMixin.get_catalog新增参数publisher_id

1.0.0 (2021-05-20)

功能

  • 模型ReservationToPurchaseExchange新增参数reservation_id
  • 模型ReservationToPurchaseExchange新增参数properties
  • 模型ReservationToPurchaseCalculateExchange新增参数properties

重大变更

  • 移除了操作ReservationOrderOperations.change_directory
  • 移除了操作组AutoQuotaIncreaseOperations

1.0.0b1 (2020-12-09)

这是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)。有关支持的完整选项,请参阅[https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies)

  • 无法再导入version模块,请使用__version__代替

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

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

  • 大多数操作关键字参数已更改。以下是一些最明显的更改:

    • raw已被删除。等效功能可以通过使用cls找到,这是一个回调,将提供对内部HTTP响应的访问,以便高级用户使用。
    • 有关支持的完整选项,请参阅[https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies)

一般新功能

  • 支持使用typing进行类型注解。SDKs已为mypy准备好。
  • 此客户端现在稳定并正式支持异步。请检查您的包中的aio命名空间以找到异步客户端。
  • 此客户端现在原生支持OpenCensus或OpenTelemetry等跟踪库。请参阅此[https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/core/azure-core-tracing-opentelemetry](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/core/azure-core-tracing-opentelemetry)跟踪快速入门以了解概述。

0.8.0 (2020-07-15)

功能

  • 添加了操作QuotaOperations.get
  • 添加了操作QuotaOperations.create_or_update
  • 添加了操作QuotaOperations.list
  • 添加了操作QuotaOperations.update
  • 添加了操作组QuotaRequestStatusOperations
  • 添加了reservedResourceType

重大变更

  • 模型SupportRequestAction不再有参数auto_quota_increase_state
  • 模型QuotaRequestOneResourceSubmitResponse不再有参数resource_type
  • 模型QuotaRequestOneResourceSubmitResponse不再有参数limit
  • 模型QuotaRequestOneResourceSubmitResponse不再有参数unit
  • 模型QuotaRequestOneResourceSubmitResponse不再有参数name1
  • 模型QuotaRequestOneResourceSubmitResponse不再有参数current_value
  • 模型QuotaRequestOneResourceSubmitResponse不再有参数quota_period
  • 模型EmailActions有新的签名
  • 模型CurrentQuotaLimit有新的签名
  • 模型CurrentQuotaLimitBase有新的签名
  • 移除了操作QuotaOperations.list_status
  • 移除了操作组QuotasOperations
  • 移除了操作组QuotaRequestOperations
  • 移除了操作组QuotaRequestsOperations

0.7.0 (2020-01-29)

功能

  • 添加了操作组QuotaRequestsOperations
  • 添加了操作组QuotaOperations
  • 添加了操作组QuotaRequestOperations
  • 添加了操作组 AutoQuotaIncreaseOperations
  • 添加了操作组 QuotasOperations

0.6.0 (2019-10-24)

错误修复

  • 修复了目录模型结构与实际 API 不匹配的问题

重大变更

  • 移除了可能被视为破坏性变更的 CatalogBillingPlansItem

0.5.0 (2019-10-04)

功能

  • 模型 ReservationProperties 新增参数 billing_plan
  • 模型 CalculatePriceResponseProperties 新增参数 payment_schedule
  • 模型 ReservationOrderResponse 新增参数 plan_information
  • 模型 ReservationOrderResponse 新增参数 billing_plan
  • 模型 Catalog 新增参数 billing_plans
  • 模型 PurchaseRequest 新增参数 billing_plan

重大变更

  • 操作 ReservationOrderOperations.get 新增签名

0.4.0 (2019-09-09)

功能

  • 模型 ReservationProperties 新增参数 term
  • 模型 ReservationProperties 新增参数 renew_properties
  • 模型 ReservationProperties 新增参数 renew_source
  • 模型 ReservationProperties 新增参数 billing_scope_id
  • 模型 ReservationProperties 新增参数 renew
  • 模型 ReservationProperties 新增参数 renew_destination
  • 模型 Patch 新增参数 renew_properties
  • 模型 Patch 新增参数 renew
  • 模型 PurchaseRequest 新增参数 renew
  • 添加了操作 ReservationOperations.available_scopes
  • 添加了操作组 AzureReservationAPIOperationsMixin

重大变更

  • 操作 ReservationOperations.get 新增签名

一般重大变更

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

  • AzureReservationAPI 无法从 azure.mgmt.reservations.azure_reservation_api 导入(从 azure.mgmt.reservations 的导入与之前相同)
  • AzureReservationAPIConfiguration 的导入已从 azure.mgmt.reservations.azure_reservation_api 移至 azure.mgmt.reservations
  • 来自 "models" 子模块的模型 MyClass 无法使用 azure.mgmt.reservations.models.my_class 导入(从 azure.mgmt.reservations.models 的导入与之前相同)
  • 来自 operations 子模块的操作类 MyClassOperations 无法使用 azure.mgmt.reservations.operations.my_class_operations 导入(从 azure.mgmt.reservations.operations 的导入与之前相同)

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

0.3.2 (2019-04-18)

功能

  • 添加了操作 ReservationOrderOperations.purchase
  • 添加了操作 ReservationOrderOperations.calculate

0.3.1 (2018-11-05)

功能

  • 添加红帽支持

0.3.0 (2018-08-22)

功能

  • 模型 Patch 新增参数 'name'
  • 枚举 ReservedResourceType 新增值 'cosmos_db'

0.2.1 (2018-06-14)

  • 在适用时提供枚举定义

0.2.0 (2018-06-12)

注意

    • 更新了更新预订 API

      • 添加了可选参数 InstanceFlexibility
  • 支持 InstanceFlexibility

  • 支持 ReservedResourceType(虚拟机、SQL 数据库、SuseLinux)

  • 升级到 rest api 版本 2018-06-01

破坏性变更

    • 更新了获取目录 API

      • 添加了必选参数 'reserved_resource_type'
      • 添加了可选参数 'location'
    • 更新了目录模型

      • 将属性 'capabilities' 重命名为 'sku_properties'
      • 移除了属性 'size' 和 'tier'
    • 更新了 ReservationProperties 模型

      • 移除了属性 'kind'

0.1.0 (2017-11-03)

  • 初始发布

项目详情


下载文件

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

源分发

azure-mgmt-reservations-2.3.0.zip (157.1 kB 查看哈希值)

上传时间

构建分发

azure_mgmt_reservations-2.3.0-py3-none-any.whl (140.6 kB 查看哈希值)

上传时间 Python 3

由以下支持

AWSAWS云计算和安全赞助商DatadogDatadog监控FastlyFastlyCDNGoogleGoogle下载分析MicrosoftMicrosoftPSF赞助商PingdomPingdom监控SentrySentry错误日志StatusPageStatusPage状态页面