Skip to content

Commit 64627c3

Browse files
authored
code and test (Azure#32374)
Co-authored-by: azure-sdk <PythonSdkPipelines>
1 parent 3ed9aac commit 64627c3

40 files changed

+4220
-535
lines changed

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

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

3+
## 1.1.0b2 (2023-10-23)
4+
5+
### Features Added
6+
7+
- Added operation AzureBareMetalInstancesOperations.begin_restart
8+
- Added operation AzureBareMetalInstancesOperations.begin_shutdown
9+
- Added operation AzureBareMetalInstancesOperations.begin_start
10+
- Added operation group AzureBareMetalStorageInstancesOperations
11+
- Model Operation has a new parameter action_type
12+
- Model Operation has a new parameter origin
13+
- Model Resource has a new parameter system_data
14+
- Model TrackedResource has a new parameter system_data
15+
316
## 1.1.0b1 (2022-11-09)
417

518
### Other Changes

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

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,54 @@ For a more complete view of Azure libraries, see the [azure sdk python release](
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 [Bare Metal Infrastructure 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.7+ 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-baremetalinfrastructure
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.baremetalinfrastructure import BareMetalInfrastructureClient
40+
import os
41+
42+
sub_id = os.getenv("AZURE_SUBSCRIPTION_ID")
43+
client = BareMetalInfrastructureClient(credential=DefaultAzureCredential(), subscription_id=sub_id)
44+
```
45+
46+
## Examples
47+
48+
Code samples for this package can be found at:
49+
- [Search Bare Metal Infrastructure 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
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-baremetalinfrastructure%2FREADME.png)
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"commit": "7d6c14d986a67dca3451d7d92d8f6b9416d61fbf",
2+
"commit": "c280892951a9e45c059132c05aace25a9c752d48",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4-
"autorest": "3.9.2",
4+
"autorest": "3.9.7",
55
"use": [
6-
"@autorest/python@6.2.1",
7-
"@autorest/modelerfour@4.24.3"
6+
"@autorest/python@6.7.1",
7+
"@autorest/modelerfour@4.26.2"
88
],
9-
"autorest_command": "autorest specification/baremetalinfrastructure/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/baremetalinfrastructure/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False",
1010
"readme": "specification/baremetalinfrastructure/resource-manager/readme.md"
1111
}

sdk/baremetalinfrastructure/azure-mgmt-baremetalinfrastructure/azure/mgmt/baremetalinfrastructure/__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/baremetalinfrastructure/azure-mgmt-baremetalinfrastructure/azure/mgmt/baremetalinfrastructure/_bare_metal_infrastructure_client.py

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,38 @@
1212
from azure.core.rest import HttpRequest, HttpResponse
1313
from azure.mgmt.core import ARMPipelineClient
1414

15-
from . import models
15+
from . import models as _models
1616
from ._configuration import BareMetalInfrastructureClientConfiguration
1717
from ._serialization import Deserializer, Serializer
18-
from .operations import AzureBareMetalInstancesOperations, Operations
18+
from .operations import AzureBareMetalInstancesOperations, AzureBareMetalStorageInstancesOperations, Operations
1919

2020
if TYPE_CHECKING:
2121
# pylint: disable=unused-import,ungrouped-imports
2222
from azure.core.credentials import TokenCredential
2323

2424

2525
class BareMetalInfrastructureClient: # pylint: disable=client-accepts-api-version-keyword
26-
"""The BareMetalInfrastructure Management client.
26+
"""The Bare Metal Infrastructure Management client.
2727
2828
:ivar azure_bare_metal_instances: AzureBareMetalInstancesOperations operations
2929
:vartype azure_bare_metal_instances:
3030
azure.mgmt.baremetalinfrastructure.operations.AzureBareMetalInstancesOperations
3131
:ivar operations: Operations operations
3232
:vartype operations: azure.mgmt.baremetalinfrastructure.operations.Operations
33+
:ivar azure_bare_metal_storage_instances: AzureBareMetalStorageInstancesOperations operations
34+
:vartype azure_bare_metal_storage_instances:
35+
azure.mgmt.baremetalinfrastructure.operations.AzureBareMetalStorageInstancesOperations
3336
:param credential: Credential needed for the client to connect to Azure. Required.
3437
:type credential: ~azure.core.credentials.TokenCredential
35-
:param subscription_id: The ID of the target subscription. Required.
38+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
3639
:type subscription_id: str
3740
:param base_url: Service URL. Default value is "https://management.azure.com".
3841
:type base_url: str
39-
:keyword api_version: Api Version. Default value is "2021-08-09". Note that overriding this
40-
default value may result in unsupported behavior.
42+
:keyword api_version: Api Version. Default value is "2023-08-04-preview". Note that overriding
43+
this default value may result in unsupported behavior.
4144
:paramtype api_version: str
45+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
46+
Retry-After header is present.
4247
"""
4348

4449
def __init__(
@@ -51,16 +56,19 @@ def __init__(
5156
self._config = BareMetalInfrastructureClientConfiguration(
5257
credential=credential, subscription_id=subscription_id, **kwargs
5358
)
54-
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
59+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
5560

56-
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
61+
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
5762
self._serialize = Serializer(client_models)
5863
self._deserialize = Deserializer(client_models)
5964
self._serialize.client_side_validation = False
6065
self.azure_bare_metal_instances = AzureBareMetalInstancesOperations(
6166
self._client, self._config, self._serialize, self._deserialize
6267
)
6368
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
69+
self.azure_bare_metal_storage_instances = AzureBareMetalStorageInstancesOperations(
70+
self._client, self._config, self._serialize, self._deserialize
71+
)
6472

6573
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
6674
"""Runs the network request through the client's chained policies.
@@ -84,15 +92,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
8492
request_copy.url = self._client.format_url(request_copy.url)
8593
return self._client.send_request(request_copy, **kwargs)
8694

87-
def close(self):
88-
# type: () -> None
95+
def close(self) -> None:
8996
self._client.close()
9097

91-
def __enter__(self):
92-
# type: () -> BareMetalInfrastructureClient
98+
def __enter__(self) -> "BareMetalInfrastructureClient":
9399
self._client.__enter__()
94100
return self
95101

96-
def __exit__(self, *exc_details):
97-
# type: (Any) -> None
102+
def __exit__(self, *exc_details: Any) -> None:
98103
self._client.__exit__(*exc_details)

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

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
import sys
109
from typing import Any, TYPE_CHECKING
1110

1211
from azure.core.configuration import Configuration
@@ -15,11 +14,6 @@
1514

1615
from ._version import VERSION
1716

18-
if sys.version_info >= (3, 8):
19-
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
20-
else:
21-
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
22-
2317
if TYPE_CHECKING:
2418
# pylint: disable=unused-import,ungrouped-imports
2519
from azure.core.credentials import TokenCredential
@@ -33,16 +27,16 @@ class BareMetalInfrastructureClientConfiguration(Configuration): # pylint: disa
3327
3428
:param credential: Credential needed for the client to connect to Azure. Required.
3529
:type credential: ~azure.core.credentials.TokenCredential
36-
:param subscription_id: The ID of the target subscription. Required.
30+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
3731
:type subscription_id: str
38-
:keyword api_version: Api Version. Default value is "2021-08-09". Note that overriding this
39-
default value may result in unsupported behavior.
32+
:keyword api_version: Api Version. Default value is "2023-08-04-preview". Note that overriding
33+
this default value may result in unsupported behavior.
4034
:paramtype api_version: str
4135
"""
4236

4337
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
4438
super(BareMetalInfrastructureClientConfiguration, self).__init__(**kwargs)
45-
api_version = kwargs.pop("api_version", "2021-08-09") # type: Literal["2021-08-09"]
39+
api_version: str = kwargs.pop("api_version", "2023-08-04-preview")
4640

4741
if credential is None:
4842
raise ValueError("Parameter 'credential' must not be None.")
@@ -56,10 +50,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
5650
kwargs.setdefault("sdk_moniker", "mgmt-baremetalinfrastructure/{}".format(VERSION))
5751
self._configure(**kwargs)
5852

59-
def _configure(
60-
self, **kwargs # type: Any
61-
):
62-
# type: (...) -> None
53+
def _configure(self, **kwargs: Any) -> None:
6354
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
6455
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
6556
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)

0 commit comments

Comments
 (0)