Skip to content

Commit c5c220f

Browse files
author
SDKAuto
committed
CodeGen from PR 34160 in Azure/azure-rest-api-specs
Merge 88f4af1c57d0557d9ed70faaf568984a8b329dc5 into 5802c95f18bfba1003be50e545d07f8bb679c857
1 parent 9194780 commit c5c220f

File tree

83 files changed

+8465
-2565
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+8465
-2565
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,74 @@
11
# Release History
22

3+
## 1.0.0b2 (2025-05-12)
4+
5+
### Features Added
6+
7+
- Model `BillingBenefitsRP` added property `discounts`
8+
- Model `BillingBenefitsRP` added property `discount`
9+
- Enum `CommitmentGrain` added member `FULL_TERM`
10+
- Enum `CommitmentGrain` added member `UNKNOWN`
11+
- Model `SavingsPlanOrderAliasModel` added property `renew`
12+
- Added enum `ApplyDiscountOn`
13+
- Added model `CatalogClaimsItem`
14+
- Added model `ConditionsItem`
15+
- Added model `CustomPriceProperties`
16+
- Added model `Discount`
17+
- Added enum `DiscountAppliedScopeType`
18+
- Added enum `DiscountCombinationRule`
19+
- Added enum `DiscountEntityType`
20+
- Added model `DiscountList`
21+
- Added model `DiscountPatchRequest`
22+
- Added model `DiscountProperties`
23+
- Added enum `DiscountProvisioningState`
24+
- Added enum `DiscountRuleType`
25+
- Added enum `DiscountStatus`
26+
- Added enum `DiscountType`
27+
- Added model `DiscountTypeCustomPrice`
28+
- Added model `DiscountTypeCustomPriceMultiCurrency`
29+
- Added model `DiscountTypeProduct`
30+
- Added model `DiscountTypeProductFamily`
31+
- Added model `DiscountTypeProductSku`
32+
- Added model `DiscountTypeProperties`
33+
- Added model `EntityTypeAffiliateDiscount`
34+
- Added model `EntityTypePrimaryDiscount`
35+
- Added model `MarketSetPricesItems`
36+
- Added model `PriceGuaranteeProperties`
37+
- Added enum `PricingPolicy`
38+
- Added model `ProxyResource`
39+
- Added model `ResourceSku`
40+
- Added model `TrackedResource`
41+
- Model `SavingsPlanOperations` added method `begin_update`
42+
- Added model `DiscountOperations`
43+
- Added model `DiscountsOperations`
44+
- Method `BillingBenefitsRP.validate_purchase` has a new overload `def validate_purchase(self: None, body: IO[bytes], content_type: str)`
45+
- Method `BillingBenefitsRPOperationsMixin.validate_purchase` has a new overload `def validate_purchase(self: None, body: IO[bytes], content_type: str)`
46+
- Method `ReservationOrderAliasOperations.begin_create` has a new overload `def begin_create(self: None, reservation_order_alias_name: str, body: IO[bytes], content_type: str)`
47+
- Method `SavingsPlanOperations.validate_update` has a new overload `def validate_update(self: None, savings_plan_order_id: str, savings_plan_id: str, body: IO[bytes], content_type: str)`
48+
- Method `SavingsPlanOperations.begin_update` has a new overload `def begin_update(self: None, savings_plan_order_id: str, savings_plan_id: str, body: SavingsPlanUpdateRequest, content_type: str)`
49+
- Method `SavingsPlanOperations.begin_update` has a new overload `def begin_update(self: None, savings_plan_order_id: str, savings_plan_id: str, body: IO[bytes], content_type: str)`
50+
- Method `SavingsPlanOrderAliasOperations.begin_create` has a new overload `def begin_create(self: None, savings_plan_order_alias_name: str, body: IO[bytes], content_type: str)`
51+
- Method `DiscountOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, discount_name: str, body: DiscountPatchRequest, content_type: str)`
52+
- Method `DiscountOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, discount_name: str, body: IO[bytes], content_type: str)`
53+
- Method `DiscountsOperations.begin_create` has a new overload `def begin_create(self: None, resource_group_name: str, discount_name: str, body: Discount, content_type: str)`
54+
- Method `DiscountsOperations.begin_create` has a new overload `def begin_create(self: None, resource_group_name: str, discount_name: str, body: IO[bytes], content_type: str)`
55+
56+
### Breaking Changes
57+
58+
- Method `BillingBenefitsRP.__init__` inserted a `positional_or_keyword` parameter `subscription_id`
59+
- Method `BillingBenefitsRP.__init__` deleted or renamed its parameter `expand` of kind `positional_or_keyword`
60+
- Method `PurchaseRequest.__init__` parameter `renew` changed default value from `bool` to `none`
61+
- Method `ReservationOrderAliasRequest.__init__` parameter `renew` changed default value from `bool` to `none`
62+
- Method `ReservationOrderAliasResponse.__init__` parameter `renew` changed default value from `bool` to `none`
63+
- Method `SavingsPlanModel.__init__` parameter `renew` changed default value from `bool` to `none`
64+
- Method `SavingsPlanModelList.__init__` removed default value `None` from its parameter `value`
65+
- Method `SavingsPlanOrderModelList.__init__` removed default value `None` from its parameter `value`
66+
- Method `SavingsPlanUpdateRequestProperties.__init__` parameter `renew` changed default value from `bool` to `none`
67+
- Deleted or renamed model `BillingInformation`
68+
- Deleted or renamed model `OperationResultError`
69+
- Deleted or renamed model `Sku`
70+
- Deleted or renamed method `SavingsPlanOperations.update`
71+
372
## 1.0.0b1 (2022-12-14)
473

574
* Initial Release
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,61 @@
11
# Microsoft Azure SDK for Python
22

33
This is the Microsoft Azure Billingbenefits Management Client Library.
4-
This package has been tested with Python 3.7+.
4+
This package has been tested with Python 3.9+.
55
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).
66

77
## _Disclaimer_
88

99
_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_
1010

11-
# Usage
11+
## Getting started
1212

13+
### Prerequisites
1314

14-
To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt)
15-
16-
For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/)
17-
Code samples for this package can be found at [Billingbenefits Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com.
18-
Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
15+
- Python 3.9+ is required to use this package.
16+
- [Azure subscription](https://azure.microsoft.com/free/)
1917

18+
### Install the package
2019

21-
# Provide Feedback
20+
```bash
21+
pip install azure-mgmt-billingbenefits
22+
pip install azure-identity
23+
```
2224

23-
If you encounter any bugs or have suggestions, please file an issue in the
24-
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
25-
section of the project.
25+
### Authentication
26+
27+
By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables.
28+
29+
- `AZURE_CLIENT_ID` for Azure client ID.
30+
- `AZURE_TENANT_ID` for Azure tenant ID.
31+
- `AZURE_CLIENT_SECRET` for Azure client secret.
32+
33+
In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`.
34+
35+
With above configuration, client can be authenticated by following code:
36+
37+
```python
38+
from azure.identity import DefaultAzureCredential
39+
from azure.mgmt.billingbenefits import BillingBenefitsRP
40+
import os
2641

42+
sub_id = os.getenv("AZURE_SUBSCRIPTION_ID")
43+
client = BillingBenefitsRP(credential=DefaultAzureCredential(), subscription_id=sub_id)
44+
```
2745

46+
## Examples
2847

48+
Code samples for this package can be found at:
49+
- [Search Billingbenefits Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com
50+
- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
51+
52+
53+
## Troubleshooting
54+
55+
## Next steps
56+
57+
## Provide Feedback
58+
59+
If you encounter any bugs or have suggestions, please file an issue in the
60+
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
61+
section of the project.
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"commit": "9b3aa35e75751e751070a7af1f96518cb8820e44",
2+
"commit": "5d1d249638483d74d716e0b83f6d6ab7239cc3e2",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4-
"autorest": "3.9.2",
4+
"autorest": "3.10.2",
55
"use": [
6-
"@autorest/python@6.2.7",
7-
"@autorest/modelerfour@4.24.3"
6+
"@autorest/python@6.34.1",
7+
"@autorest/modelerfour@4.27.0"
88
],
9-
"autorest_command": "autorest specification/billingbenefits/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.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
9+
"autorest_command": "autorest specification/billingbenefits/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.34.1 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False",
1010
"readme": "specification/billingbenefits/resource-manager/readme.md"
1111
}

sdk/billingbenefits/azure-mgmt-billingbenefits/azure/mgmt/billingbenefits/__init__.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,28 @@
55
# Code generated by Microsoft (R) AutoRest Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
8+
# pylint: disable=wrong-import-position
89

9-
from ._billing_benefits_rp import BillingBenefitsRP
10+
from typing import TYPE_CHECKING
11+
12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
14+
15+
from ._billing_benefits_rp import BillingBenefitsRP # type: ignore
1016
from ._version import VERSION
1117

1218
__version__ = VERSION
1319

1420
try:
1521
from ._patch import __all__ as _patch_all
16-
from ._patch import * # pylint: disable=unused-wildcard-import
22+
from ._patch import *
1723
except ImportError:
1824
_patch_all = []
1925
from ._patch import patch_sdk as _patch_sdk
2026

2127
__all__ = [
2228
"BillingBenefitsRP",
2329
]
24-
__all__.extend([p for p in _patch_all if p not in __all__])
30+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
2531

2632
_patch_sdk()

sdk/billingbenefits/azure-mgmt-billingbenefits/azure/mgmt/billingbenefits/_billing_benefits_rp.py

+60-27
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,23 @@
77
# --------------------------------------------------------------------------
88

99
from copy import deepcopy
10-
from typing import Any, Optional, TYPE_CHECKING
10+
from typing import Any, Optional, TYPE_CHECKING, cast
11+
from typing_extensions import Self
1112

13+
from azure.core.pipeline import policies
1214
from azure.core.rest import HttpRequest, HttpResponse
15+
from azure.core.settings import settings
1316
from azure.mgmt.core import ARMPipelineClient
17+
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
18+
from azure.mgmt.core.tools import get_arm_endpoints
1419

1520
from . import models as _models
1621
from ._configuration import BillingBenefitsRPConfiguration
17-
from ._serialization import Deserializer, Serializer
22+
from ._utils.serialization import Deserializer, Serializer
1823
from .operations import (
1924
BillingBenefitsRPOperationsMixin,
25+
DiscountOperations,
26+
DiscountsOperations,
2027
Operations,
2128
ReservationOrderAliasOperations,
2229
SavingsPlanOperations,
@@ -25,66 +32,92 @@
2532
)
2633

2734
if TYPE_CHECKING:
28-
# pylint: disable=unused-import,ungrouped-imports
2935
from azure.core.credentials import TokenCredential
3036

3137

32-
class BillingBenefitsRP(BillingBenefitsRPOperationsMixin): # pylint: disable=client-accepts-api-version-keyword
38+
class BillingBenefitsRP(BillingBenefitsRPOperationsMixin): # pylint: disable=too-many-instance-attributes
3339
"""Azure Benefits RP let users create and manage benefits like savings plan.
3440
41+
:ivar discounts: DiscountsOperations operations
42+
:vartype discounts: azure.mgmt.billingbenefits.operations.DiscountsOperations
3543
:ivar operations: Operations operations
3644
:vartype operations: azure.mgmt.billingbenefits.operations.Operations
45+
:ivar reservation_order_alias: ReservationOrderAliasOperations operations
46+
:vartype reservation_order_alias:
47+
azure.mgmt.billingbenefits.operations.ReservationOrderAliasOperations
3748
:ivar savings_plan_order_alias: SavingsPlanOrderAliasOperations operations
3849
:vartype savings_plan_order_alias:
3950
azure.mgmt.billingbenefits.operations.SavingsPlanOrderAliasOperations
4051
:ivar savings_plan_order: SavingsPlanOrderOperations operations
4152
:vartype savings_plan_order: azure.mgmt.billingbenefits.operations.SavingsPlanOrderOperations
4253
:ivar savings_plan: SavingsPlanOperations operations
4354
:vartype savings_plan: azure.mgmt.billingbenefits.operations.SavingsPlanOperations
44-
:ivar reservation_order_alias: ReservationOrderAliasOperations operations
45-
:vartype reservation_order_alias:
46-
azure.mgmt.billingbenefits.operations.ReservationOrderAliasOperations
55+
:ivar discount: DiscountOperations operations
56+
:vartype discount: azure.mgmt.billingbenefits.operations.DiscountOperations
4757
:param credential: Credential needed for the client to connect to Azure. Required.
4858
:type credential: ~azure.core.credentials.TokenCredential
49-
:param expand: May be used to expand the detail information of some properties. Default value
50-
is None.
51-
:type expand: str
52-
:param base_url: Service URL. Default value is "https://management.azure.com".
59+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
60+
:type subscription_id: str
61+
:param base_url: Service URL. Default value is None.
5362
:type base_url: str
54-
:keyword api_version: Api Version. Default value is "2022-11-01". Note that overriding this
55-
default value may result in unsupported behavior.
63+
:keyword api_version: Api Version. Default value is "2024-11-01-preview". Note that overriding
64+
this default value may result in unsupported behavior.
5665
:paramtype api_version: str
5766
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
5867
Retry-After header is present.
5968
"""
6069

6170
def __init__(
62-
self,
63-
credential: "TokenCredential",
64-
expand: Optional[str] = None,
65-
base_url: str = "https://management.azure.com",
66-
**kwargs: Any
71+
self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any
6772
) -> None:
68-
self._config = BillingBenefitsRPConfiguration(credential=credential, expand=expand, **kwargs)
69-
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
73+
_cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore
74+
_endpoints = get_arm_endpoints(_cloud)
75+
if not base_url:
76+
base_url = _endpoints["resource_manager"]
77+
credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"])
78+
self._config = BillingBenefitsRPConfiguration(
79+
credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs
80+
)
81+
82+
_policies = kwargs.pop("policies", None)
83+
if _policies is None:
84+
_policies = [
85+
policies.RequestIdPolicy(**kwargs),
86+
self._config.headers_policy,
87+
self._config.user_agent_policy,
88+
self._config.proxy_policy,
89+
policies.ContentDecodePolicy(**kwargs),
90+
ARMAutoResourceProviderRegistrationPolicy(),
91+
self._config.redirect_policy,
92+
self._config.retry_policy,
93+
self._config.authentication_policy,
94+
self._config.custom_hook_policy,
95+
self._config.logging_policy,
96+
policies.DistributedTracingPolicy(**kwargs),
97+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
98+
self._config.http_logging_policy,
99+
]
100+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs)
70101

71102
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
72103
self._serialize = Serializer(client_models)
73104
self._deserialize = Deserializer(client_models)
74105
self._serialize.client_side_validation = False
106+
self.discounts = DiscountsOperations(self._client, self._config, self._serialize, self._deserialize)
75107
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
108+
self.reservation_order_alias = ReservationOrderAliasOperations(
109+
self._client, self._config, self._serialize, self._deserialize
110+
)
76111
self.savings_plan_order_alias = SavingsPlanOrderAliasOperations(
77112
self._client, self._config, self._serialize, self._deserialize
78113
)
79114
self.savings_plan_order = SavingsPlanOrderOperations(
80115
self._client, self._config, self._serialize, self._deserialize
81116
)
82117
self.savings_plan = SavingsPlanOperations(self._client, self._config, self._serialize, self._deserialize)
83-
self.reservation_order_alias = ReservationOrderAliasOperations(
84-
self._client, self._config, self._serialize, self._deserialize
85-
)
118+
self.discount = DiscountOperations(self._client, self._config, self._serialize, self._deserialize)
86119

87-
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
120+
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
88121
"""Runs the network request through the client's chained policies.
89122
90123
>>> from azure.core.rest import HttpRequest
@@ -104,14 +137,14 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
104137

105138
request_copy = deepcopy(request)
106139
request_copy.url = self._client.format_url(request_copy.url)
107-
return self._client.send_request(request_copy, **kwargs)
140+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
108141

109142
def close(self) -> None:
110143
self._client.close()
111144

112-
def __enter__(self) -> "BillingBenefitsRP":
145+
def __enter__(self) -> Self:
113146
self._client.__enter__()
114147
return self
115148

116-
def __exit__(self, *exc_details) -> None:
149+
def __exit__(self, *exc_details: Any) -> None:
117150
self._client.__exit__(*exc_details)

0 commit comments

Comments
 (0)