Skip to content

Commit 407e15f

Browse files
azure-sdkmsyycChenxiJiang333
authored
[AutoRelease] t2-billing-2024-09-02-52526(can only be merged by SDK owner) (#37170)
* code and test * update changelog * update-testcase * Update CHANGELOG.md --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: msyyc <[email protected]> Co-authored-by: ChenxiJiang333 <[email protected]> Co-authored-by: ChenxiJiang333 <[email protected]>
1 parent 2a017be commit 407e15f

File tree

379 files changed

+72395
-13637
lines changed

Some content is hidden

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

379 files changed

+72395
-13637
lines changed

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

Lines changed: 801 additions & 0 deletions
Large diffs are not rendered by default.

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

Lines changed: 44 additions & 11 deletions
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 Billing Client Library.
4-
This package has been tested with Python 3.7+.
4+
This package has been tested with Python 3.8+.
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/billing)
17-
Code samples for this package can be found at [Billing](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.8+ 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-billing
22+
pip install azure-identity
23+
```
24+
25+
### Authentication
26+
27+
By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of 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.billing import BillingManagementClient
40+
import os
41+
42+
sub_id = os.getenv("AZURE_SUBSCRIPTION_ID")
43+
client = BillingManagementClient(credential=DefaultAzureCredential(), subscription_id=sub_id)
44+
```
45+
46+
## Examples
47+
48+
Code samples for this package can be found at:
49+
- [Search Billing](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
2258

2359
If you encounter any bugs or have suggestions, please file an issue in the
2460
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
2561
section of the project.
26-
27-
28-
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-billing%2FREADME.png)
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"commit": "4522e1d3fb6dcb81bc63e3414d11dd7eaf08264b",
2+
"commit": "e79d9ef3e065f2dcb6bd1db51e29c62a99dff5cb",
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.1",
7-
"@autorest/modelerfour@4.24.3"
6+
"@autorest/python@6.19.0",
7+
"@autorest/modelerfour@4.27.0"
88
],
9-
"autorest_command": "autorest specification/billing/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.1 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
9+
"autorest_command": "autorest specification/billing/resource-manager/readme.md --generate-sample=True --generate-test=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.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False",
1010
"readme": "specification/billing/resource-manager/readme.md"
1111
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
try:
1515
from ._patch import __all__ as _patch_all
16-
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
16+
from ._patch import * # pylint: disable=unused-wildcard-import
1717
except ImportError:
1818
_patch_all = []
1919
from ._patch import patch_sdk as _patch_sdk

sdk/billing/azure-mgmt-billing/azure/mgmt/billing/_billing_management_client.py

Lines changed: 132 additions & 61 deletions
Large diffs are not rendered by default.

sdk/billing/azure-mgmt-billing/azure/mgmt/billing/_configuration.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
from typing import Any, TYPE_CHECKING
1010

11-
from azure.core.configuration import Configuration
1211
from azure.core.pipeline import policies
1312
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1413

@@ -19,43 +18,46 @@
1918
from azure.core.credentials import TokenCredential
2019

2120

22-
class BillingManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
21+
class BillingManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
2322
"""Configuration for BillingManagementClient.
2423
2524
Note that all parameters used to create this instance are saved as instance
2625
attributes.
2726
2827
:param credential: Credential needed for the client to connect to Azure. Required.
2928
:type credential: ~azure.core.credentials.TokenCredential
30-
:param subscription_id: The ID that uniquely identifies an Azure subscription. Required.
29+
:param subscription_id: The ID that uniquely identifies a billing subscription. Required.
3130
:type subscription_id: str
31+
:keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this
32+
default value may result in unsupported behavior.
33+
:paramtype api_version: str
3234
"""
3335

3436
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
35-
super(BillingManagementClientConfiguration, self).__init__(**kwargs)
37+
api_version: str = kwargs.pop("api_version", "2024-04-01")
38+
3639
if credential is None:
3740
raise ValueError("Parameter 'credential' must not be None.")
3841
if subscription_id is None:
3942
raise ValueError("Parameter 'subscription_id' must not be None.")
4043

4144
self.credential = credential
4245
self.subscription_id = subscription_id
46+
self.api_version = api_version
4347
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
4448
kwargs.setdefault("sdk_moniker", "mgmt-billing/{}".format(VERSION))
49+
self.polling_interval = kwargs.get("polling_interval", 30)
4550
self._configure(**kwargs)
4651

47-
def _configure(
48-
self, **kwargs # type: Any
49-
):
50-
# type: (...) -> None
52+
def _configure(self, **kwargs: Any) -> None:
5153
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
5254
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
5355
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
5456
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
5557
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
56-
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
5758
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
5859
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
60+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
5961
self.authentication_policy = kwargs.get("authentication_policy")
6062
if self.credential and not self.authentication_policy:
6163
self.authentication_policy = ARMChallengeAuthenticationPolicy(

0 commit comments

Comments
 (0)