Skip to content

Commit 7b0b7e9

Browse files
author
SDKAuto
committed
CodeGen from PR 33888 in Azure/azure-rest-api-specs
Merge 0d675641c296b5126c00403d01b5005a4b109330 into 03803e4637c4c2dfe8358336d69d9735e118457d
1 parent 610a33b commit 7b0b7e9

File tree

67 files changed

+2979
-1865
lines changed

Some content is hidden

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

67 files changed

+2979
-1865
lines changed

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

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

3+
## 2.0.0 (2025-04-25)
4+
5+
### Features Added
6+
7+
- Client `AzureStackManagementClient` added operation group `deployment_license`
8+
- Added model `DeploymentLicenseRequest`
9+
- Added model `DeploymentLicenseResponse`
10+
- Model `CloudManifestFileOperations` added parameter `kwargs` in method `__init__`
11+
- Model `CustomerSubscriptionsOperations` added parameter `kwargs` in method `__init__`
12+
- Model `Operations` added parameter `kwargs` in method `__init__`
13+
- Model `ProductsOperations` added parameter `kwargs` in method `__init__`
14+
- Model `ProductsOperations` added method `list_products`
15+
- Model `RegistrationsOperations` added parameter `kwargs` in method `__init__`
16+
- Model `RegistrationsOperations` added method `list_by_subscription`
17+
- Added model `DeploymentLicenseOperations`
18+
- Method `CustomerSubscriptionsOperations.create` has a new overload `def create(self: None, resource_group: str, registration_name: str, customer_subscription_name: str, customer_creation_parameters: CustomerSubscription, content_type: str)`
19+
- Method `CustomerSubscriptionsOperations.create` has a new overload `def create(self: None, resource_group: str, registration_name: str, customer_subscription_name: str, customer_creation_parameters: IO[bytes], content_type: str)`
20+
- Method `ProductsOperations.get_product` has a new overload `def get_product(self: None, resource_group: str, registration_name: str, product_name: str, device_configuration: Optional[DeviceConfiguration], content_type: str)`
21+
- Method `ProductsOperations.get_product` has a new overload `def get_product(self: None, resource_group: str, registration_name: str, product_name: str, device_configuration: Optional[IO[bytes]], content_type: str)`
22+
- Method `ProductsOperations.get_products` has a new overload `def get_products(self: None, resource_group: str, registration_name: str, product_name: str, device_configuration: Optional[DeviceConfiguration], content_type: str)`
23+
- Method `ProductsOperations.get_products` has a new overload `def get_products(self: None, resource_group: str, registration_name: str, product_name: str, device_configuration: Optional[IO[bytes]], content_type: str)`
24+
- Method `ProductsOperations.upload_log` has a new overload `def upload_log(self: None, resource_group: str, registration_name: str, product_name: str, marketplace_product_log_update: Optional[MarketplaceProductLogUpdate], content_type: str)`
25+
- Method `ProductsOperations.upload_log` has a new overload `def upload_log(self: None, resource_group: str, registration_name: str, product_name: str, marketplace_product_log_update: Optional[IO[bytes]], content_type: str)`
26+
- Method `ProductsOperations.list_products` has a new overload `def list_products(self: None, resource_group: str, registration_name: str, product_name: str, device_configuration: Optional[DeviceConfiguration], content_type: str)`
27+
- Method `ProductsOperations.list_products` has a new overload `def list_products(self: None, resource_group: str, registration_name: str, product_name: str, device_configuration: Optional[IO[bytes]], content_type: str)`
28+
- Method `RegistrationsOperations.create_or_update` has a new overload `def create_or_update(self: None, resource_group: str, registration_name: str, token: RegistrationParameter, content_type: str)`
29+
- Method `RegistrationsOperations.create_or_update` has a new overload `def create_or_update(self: None, resource_group: str, registration_name: str, token: IO[bytes], content_type: str)`
30+
- Method `RegistrationsOperations.update` has a new overload `def update(self: None, resource_group: str, registration_name: str, token: RegistrationParameter, content_type: str)`
31+
- Method `RegistrationsOperations.update` has a new overload `def update(self: None, resource_group: str, registration_name: str, token: IO[bytes], content_type: str)`
32+
- Method `DeploymentLicenseOperations.create` has a new overload `def create(self: None, deployment_license_request: DeploymentLicenseRequest, content_type: str)`
33+
- Method `DeploymentLicenseOperations.create` has a new overload `def create(self: None, deployment_license_request: IO[bytes], content_type: str)`
34+
35+
### Breaking Changes
36+
37+
- Deleted or renamed client operation group `AzureStackManagementClient.linked_subscriptions`
38+
- Model `CustomerSubscription` deleted or renamed its instance variable `system_data`
39+
- Deleted or renamed enum value `Location.GLOBAL_ENUM`
40+
- Model `Product` deleted or renamed its instance variable `system_data`
41+
- Model `Registration` deleted or renamed its instance variable `kind`
42+
- Model `Registration` deleted or renamed its instance variable `system_data`
43+
- Model `TrackedResource` deleted or renamed its instance variable `kind`
44+
- Model `TrackedResource` deleted or renamed its instance variable `system_data`
45+
- Deleted or renamed model `CreatedByType`
46+
- Deleted or renamed model `LinkedSubscription`
47+
- Deleted or renamed model `LinkedSubscriptionParameter`
48+
- Deleted or renamed model `LinkedSubscriptionsList`
49+
- Deleted or renamed model `SystemData`
50+
- Deleted or renamed model `LinkedSubscriptionsOperations`
51+
352
## 2.0.0b1 (2022-11-17)
453

554
### Features Added
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 Azure Stack 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 [Azure Stack 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-azurestack
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.azurestack import AzureStackManagementClient
40+
import os
2641

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

46+
## Examples
2847

48+
Code samples for this package can be found at:
49+
- [Search Azure Stack 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.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"commit": "b32e1896f30e6ea155449cb49719a6286e32b961",
2+
"commit": "4c6d0481729ff095999f4edf219bd68f9347d719",
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/azurestack/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/azurestack/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/azurestack/resource-manager/readme.md"
1111
}

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

Lines changed: 9 additions & 3 deletions
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 ._azure_stack_management_client import AzureStackManagementClient
10+
from typing import TYPE_CHECKING
11+
12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
14+
15+
from ._azure_stack_management_client import AzureStackManagementClient # 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
"AzureStackManagementClient",
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/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_azure_stack_management_client.py

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,19 @@
77
# --------------------------------------------------------------------------
88

99
from copy import deepcopy
10-
from typing import Any, 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 AzureStackManagementClientConfiguration
17-
from ._serialization import Deserializer, Serializer
22+
from ._utils.serialization import Deserializer, Serializer
1823
from .operations import (
1924
CloudManifestFileOperations,
2025
CustomerSubscriptionsOperations,
@@ -25,11 +30,10 @@
2530
)
2631

2732
if TYPE_CHECKING:
28-
# pylint: disable=unused-import,ungrouped-imports
2933
from azure.core.credentials import TokenCredential
3034

3135

32-
class AzureStackManagementClient: # pylint: disable=client-accepts-api-version-keyword
36+
class AzureStackManagementClient:
3337
"""Azure Stack.
3438
3539
:ivar operations: Operations operations
@@ -50,24 +54,44 @@ class AzureStackManagementClient: # pylint: disable=client-accepts-api-version-
5054
:param subscription_id: Subscription credentials that uniquely identify Microsoft Azure
5155
subscription. The subscription ID forms part of the URI for every service call. Required.
5256
:type subscription_id: str
53-
:param base_url: Service URL. Default value is "https://management.azure.com".
57+
:param base_url: Service URL. Default value is None.
5458
:type base_url: str
5559
:keyword api_version: Api Version. Default value is "2022-06-01". Note that overriding this
5660
default value may result in unsupported behavior.
5761
:paramtype api_version: str
5862
"""
5963

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

7296
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
7397
self._serialize = Serializer(client_models)
@@ -86,7 +110,7 @@ def __init__(
86110
self.products = ProductsOperations(self._client, self._config, self._serialize, self._deserialize)
87111
self.registrations = RegistrationsOperations(self._client, self._config, self._serialize, self._deserialize)
88112

89-
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
113+
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
90114
"""Runs the network request through the client's chained policies.
91115
92116
>>> from azure.core.rest import HttpRequest
@@ -106,14 +130,14 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
106130

107131
request_copy = deepcopy(request)
108132
request_copy.url = self._client.format_url(request_copy.url)
109-
return self._client.send_request(request_copy, **kwargs)
133+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
110134

111135
def close(self) -> None:
112136
self._client.close()
113137

114-
def __enter__(self) -> "AzureStackManagementClient":
138+
def __enter__(self) -> Self:
115139
self._client.__enter__()
116140
return self
117141

118-
def __exit__(self, *exc_details) -> None:
142+
def __exit__(self, *exc_details: Any) -> None:
119143
self._client.__exit__(*exc_details)

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

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,18 @@
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

12-
from azure.core.configuration import Configuration
1311
from azure.core.pipeline import policies
1412
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1513

1614
from ._version import VERSION
1715

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-
2316
if TYPE_CHECKING:
24-
# pylint: disable=unused-import,ungrouped-imports
2517
from azure.core.credentials import TokenCredential
2618

2719

28-
class AzureStackManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
20+
class AzureStackManagementClientConfiguration: # pylint: disable=too-many-instance-attributes
2921
"""Configuration for AzureStackManagementClient.
3022
3123
Note that all parameters used to create this instance are saved as instance
@@ -42,8 +34,7 @@ class AzureStackManagementClientConfiguration(Configuration): # pylint: disable
4234
"""
4335

4436
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
45-
super(AzureStackManagementClientConfiguration, self).__init__(**kwargs)
46-
api_version: Literal["2022-06-01"] = kwargs.pop("api_version", "2022-06-01")
37+
api_version: str = kwargs.pop("api_version", "2022-06-01")
4738

4839
if credential is None:
4940
raise ValueError("Parameter 'credential' must not be None.")
@@ -55,6 +46,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
5546
self.api_version = api_version
5647
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
5748
kwargs.setdefault("sdk_moniker", "mgmt-azurestack/{}".format(VERSION))
49+
self.polling_interval = kwargs.get("polling_interval", 30)
5850
self._configure(**kwargs)
5951

6052
def _configure(self, **kwargs: Any) -> None:
@@ -63,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None:
6355
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
6456
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
6557
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
66-
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
6758
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
6859
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
60+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
6961
self.authentication_policy = kwargs.get("authentication_policy")
7062
if self.credential and not self.authentication_policy:
7163
self.authentication_policy = ARMChallengeAuthenticationPolicy(
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# --------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
# Code generated by Microsoft (R) AutoRest Code Generator.
5+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
6+
# --------------------------------------------------------------------------

0 commit comments

Comments
 (0)