Skip to content

Commit 5968294

Browse files
azure-sdkChenxiJiang333msyyc
authored
[AutoPR azure-mgmt-commerce]-generated-from-SDK Generation - Python-5979984 (#45582)
* Configurations: 'specification/commerce/resource-manager/Microsoft.Commerce/Commerce/tspconfig.yaml', API Version: 2015-06-01-preview, SDK Release Type: beta, and CommitSHA: 'de8053fa6afbc8e563095a6a40ad662bf4e90a4d' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5979984 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. * Configurations: 'specification/commerce/resource-manager/Microsoft.Commerce/Commerce/tspconfig.yaml', API Version: 2015-06-01-preview, SDK Release Type: beta, and CommitSHA: '48e2c462287288d03adad21e682404d90375462e' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5985785 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. * update * Update dev_requirements.txt * Update CHANGELOG.md * update * Update CHANGELOG.md --------- Co-authored-by: ChenxiJiang333 <v-chenjiang@microsoft.com> Co-authored-by: ChenxiJiang333 <119990644+ChenxiJiang333@users.noreply.github.com> Co-authored-by: Yuchao Yan <yuchaoyan@microsoft.com>
1 parent a5df4ac commit 5968294

54 files changed

Lines changed: 3824 additions & 2126 deletions

Some content is hidden

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

sdk/commerce/azure-mgmt-commerce/CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
# Release History
22

3+
## 6.1.0b2 (2026-03-10)
4+
5+
### Features Added
6+
7+
- Model `UsageManagementClient` added parameter `cloud_setting` in method `__init__`
8+
- Client `UsageManagementClient` added method `send_request`
9+
- Model `UsageAggregation` added property `properties`
10+
- Added model `ErrorObjectResponse`
11+
- Added model `UsageSample`
12+
13+
### Breaking Changes
14+
15+
- This version introduces new hybrid models which have dual dictionary and model nature. Please follow https://aka.ms/azsdk/python/migrate/hybrid-models for migration.
16+
- For the method breakings, please refer to https://aka.ms/azsdk/python/migrate/operations for migration.
17+
- Deleted or renamed model `InfoField`
18+
- Renamed enum `OfferTermInfoEnum` to `OfferTermInfoName`
19+
- Model `UsageAggregation` moved instance variable `subscription_id`, `meter_id`, `usage_start_time`, `usage_end_time`, `quantity`, `unit`, `meter_name`, `meter_category`, `meter_sub_category`, `meter_region`, `info_fields` and `instance_data` under property `properties`
20+
- Method `UsageAggregatesOperations.list` changed its parameter `reported_start_time`/`reported_end_time`/`show_details`/`aggregation_granularity`/`continuation_token_parameter` from `positional_or_keyword` to `keyword_only`
21+
22+
### Other Changes
23+
24+
- Deleted model `RateCardQueryParameters` which actually were not used by SDK users
25+
326
## 6.1.0b1 (2023-02-10)
427

528
### Other Changes
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
include _meta.json
2-
recursive-include tests *.py *.json
3-
recursive-include samples *.py *.md
41
include *.md
5-
include azure/__init__.py
6-
include azure/mgmt/__init__.py
72
include LICENSE
83
include azure/mgmt/commerce/py.typed
4+
recursive-include tests *.py
5+
recursive-include samples *.py *.md
6+
include azure/__init__.py
7+
include azure/mgmt/__init__.py

sdk/commerce/azure-mgmt-commerce/README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Microsoft Azure SDK for Python
22

33
This is the Microsoft Azure Commerce 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_
@@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For
1212

1313
### Prerequisites
1414

15-
- Python 3.7+ is required to use this package.
15+
- Python 3.9+ is required to use this package.
1616
- [Azure subscription](https://azure.microsoft.com/free/)
1717

1818
### Install the package
@@ -24,7 +24,7 @@ pip install azure-identity
2424

2525
### Authentication
2626

27-
By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables.
27+
By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables.
2828

2929
- `AZURE_CLIENT_ID` for Azure client ID.
3030
- `AZURE_TENANT_ID` for Azure tenant ID.
@@ -45,8 +45,9 @@ client = UsageManagementClient(credential=DefaultAzureCredential(), subscription
4545

4646
## Examples
4747

48-
49-
Code samples for this package can be found at [Commerce](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
48+
Code samples for this package can be found at:
49+
- [Search Commerce](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)
5051

5152

5253
## Troubleshooting
@@ -58,6 +59,3 @@ Code samples for this package can be found at [Commerce](https://docs.microsoft.
5859
If you encounter any bugs or have suggestions, please file an issue in the
5960
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
6061
section of the project.
61-
62-
63-

sdk/commerce/azure-mgmt-commerce/_meta.json

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"apiVersion": "2015-06-01-preview",
3+
"apiVersions": {
4+
"Microsoft.Commerce": "2015-06-01-preview"
5+
},
6+
"commit": "48e2c462287288d03adad21e682404d90375462e",
7+
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
8+
"typespec_src": "specification/commerce/resource-manager/Microsoft.Commerce/Commerce",
9+
"emitterVersion": "0.60.2"
10+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"CrossLanguagePackageId": "Microsoft.Commerce",
3+
"CrossLanguageDefinitionId": {
4+
"azure.mgmt.commerce.models.ErrorObjectResponse": "Microsoft.Commerce.ErrorObjectResponse",
5+
"azure.mgmt.commerce.models.ErrorResponse": "Microsoft.Commerce.ErrorResponse",
6+
"azure.mgmt.commerce.models.MeterInfo": "Microsoft.Commerce.MeterInfo",
7+
"azure.mgmt.commerce.models.OfferTermInfo": "Microsoft.Commerce.OfferTermInfo",
8+
"azure.mgmt.commerce.models.MonetaryCommitment": "Microsoft.Commerce.MonetaryCommitment",
9+
"azure.mgmt.commerce.models.MonetaryCredit": "Microsoft.Commerce.MonetaryCredit",
10+
"azure.mgmt.commerce.models.RecurringCharge": "Microsoft.Commerce.RecurringCharge",
11+
"azure.mgmt.commerce.models.ResourceRateCardInfo": "Microsoft.Commerce.ResourceRateCardInfo",
12+
"azure.mgmt.commerce.models.UsageAggregation": "Microsoft.Commerce.UsageAggregation",
13+
"azure.mgmt.commerce.models.UsageSample": "Microsoft.Commerce.UsageSample",
14+
"azure.mgmt.commerce.models.AggregationGranularity": "Microsoft.Commerce.AggregationGranularity",
15+
"azure.mgmt.commerce.models.OfferTermInfoName": "Microsoft.Commerce.OfferTermInfoName",
16+
"azure.mgmt.commerce.operations.UsageAggregatesOperations.list": "Microsoft.Commerce.UsageAggregatesOperationGroup.list",
17+
"azure.mgmt.commerce.aio.operations.UsageAggregatesOperations.list": "Microsoft.Commerce.UsageAggregatesOperationGroup.list",
18+
"azure.mgmt.commerce.operations.RateCardOperations.get": "Microsoft.Commerce.RateCardOperationGroup.get",
19+
"azure.mgmt.commerce.aio.operations.RateCardOperations.get": "Microsoft.Commerce.RateCardOperationGroup.get"
20+
}
21+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
1+
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
1+
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,31 @@
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
44
# Licensed under the MIT License. See License.txt in the project root for license information.
5-
# Code generated by Microsoft (R) AutoRest Code Generator.
5+
# Code generated by Microsoft (R) Python 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 ._usage_management_client import UsageManagementClient
10+
from typing import TYPE_CHECKING
11+
12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
14+
15+
from ._client import UsageManagementClient # 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
"UsageManagementClient",
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()
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) Python Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from copy import deepcopy
10+
from typing import Any, Optional, TYPE_CHECKING, cast
11+
from typing_extensions import Self
12+
13+
from azure.core.pipeline import policies
14+
from azure.core.rest import HttpRequest, HttpResponse
15+
from azure.core.settings import settings
16+
from azure.mgmt.core import ARMPipelineClient
17+
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
18+
from azure.mgmt.core.tools import get_arm_endpoints
19+
20+
from ._configuration import UsageManagementClientConfiguration
21+
from ._utils.serialization import Deserializer, Serializer
22+
from .operations import RateCardOperations, UsageAggregatesOperations
23+
24+
if TYPE_CHECKING:
25+
from azure.core import AzureClouds
26+
from azure.core.credentials import TokenCredential
27+
28+
29+
class UsageManagementClient:
30+
"""UsageManagementClient.
31+
32+
:ivar usage_aggregates: UsageAggregatesOperations operations
33+
:vartype usage_aggregates: azure.mgmt.commerce.operations.UsageAggregatesOperations
34+
:ivar rate_card: RateCardOperations operations
35+
:vartype rate_card: azure.mgmt.commerce.operations.RateCardOperations
36+
:param credential: Credential used to authenticate requests to the service. Required.
37+
:type credential: ~azure.core.credentials.TokenCredential
38+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
39+
:type subscription_id: str
40+
:param base_url: Service host. Default value is None.
41+
:type base_url: str
42+
:keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is
43+
None.
44+
:paramtype cloud_setting: ~azure.core.AzureClouds
45+
:keyword api_version: The API version to use for this operation. Known values are
46+
"2015-06-01-preview" and None. Default value is "2015-06-01-preview". Note that overriding this
47+
default value may result in unsupported behavior.
48+
:paramtype api_version: str
49+
"""
50+
51+
def __init__(
52+
self,
53+
credential: "TokenCredential",
54+
subscription_id: str,
55+
base_url: Optional[str] = None,
56+
*,
57+
cloud_setting: Optional["AzureClouds"] = None,
58+
**kwargs: Any
59+
) -> None:
60+
_endpoint = "{endpoint}"
61+
_cloud = cloud_setting or settings.current.azure_cloud # type: ignore
62+
_endpoints = get_arm_endpoints(_cloud)
63+
if not base_url:
64+
base_url = _endpoints["resource_manager"]
65+
credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"])
66+
self._config = UsageManagementClientConfiguration(
67+
credential=credential,
68+
subscription_id=subscription_id,
69+
base_url=cast(str, base_url),
70+
cloud_setting=cloud_setting,
71+
credential_scopes=credential_scopes,
72+
**kwargs
73+
)
74+
75+
_policies = kwargs.pop("policies", None)
76+
if _policies is None:
77+
_policies = [
78+
policies.RequestIdPolicy(**kwargs),
79+
self._config.headers_policy,
80+
self._config.user_agent_policy,
81+
self._config.proxy_policy,
82+
policies.ContentDecodePolicy(**kwargs),
83+
ARMAutoResourceProviderRegistrationPolicy(),
84+
self._config.redirect_policy,
85+
self._config.retry_policy,
86+
self._config.authentication_policy,
87+
self._config.custom_hook_policy,
88+
self._config.logging_policy,
89+
policies.DistributedTracingPolicy(**kwargs),
90+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
91+
self._config.http_logging_policy,
92+
]
93+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, _endpoint), policies=_policies, **kwargs)
94+
95+
self._serialize = Serializer()
96+
self._deserialize = Deserializer()
97+
self._serialize.client_side_validation = False
98+
self.usage_aggregates = UsageAggregatesOperations(
99+
self._client, self._config, self._serialize, self._deserialize
100+
)
101+
self.rate_card = RateCardOperations(self._client, self._config, self._serialize, self._deserialize)
102+
103+
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
104+
"""Runs the network request through the client's chained policies.
105+
106+
>>> from azure.core.rest import HttpRequest
107+
>>> request = HttpRequest("GET", "https://www.example.org/")
108+
<HttpRequest [GET], url: 'https://www.example.org/'>
109+
>>> response = client.send_request(request)
110+
<HttpResponse: 200 OK>
111+
112+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
113+
114+
:param request: The network request you want to make. Required.
115+
:type request: ~azure.core.rest.HttpRequest
116+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
117+
:return: The response of your network call. Does not do error handling on your response.
118+
:rtype: ~azure.core.rest.HttpResponse
119+
"""
120+
121+
request_copy = deepcopy(request)
122+
path_format_arguments = {
123+
"endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
124+
}
125+
126+
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
127+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
128+
129+
def close(self) -> None:
130+
self._client.close()
131+
132+
def __enter__(self) -> Self:
133+
self._client.__enter__()
134+
return self
135+
136+
def __exit__(self, *exc_details: Any) -> None:
137+
self._client.__exit__(*exc_details)

0 commit comments

Comments
 (0)