Skip to content

Commit e674e4c

Browse files
author
SDKAuto
committed
CodeGen from PR 34278 in Azure/azure-rest-api-specs
Merge 86f28f32592b57efedac456837a8bf64888b271b into 761d8b58e465b26eddb8ad70dda3cde7b4228bdf
1 parent d6612d0 commit e674e4c

File tree

94 files changed

+12674
-11065
lines changed

Some content is hidden

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

94 files changed

+12674
-11065
lines changed

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

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

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

Lines changed: 3 additions & 3 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 Hardwaresecuritymodules Management Client Library.
4-
This package has been tested with Python 3.8+.
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.8+ 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.
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
2-
"commit": "66fefe4b93b3f1ab515757e48597a9205c924879",
2+
"commit": "e2be75ed1428d068d3ea9f08828e79308f31c4fe",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4-
"autorest": "3.10.2",
5-
"use": [
6-
"@autorest/[email protected]",
7-
"@autorest/[email protected]"
8-
],
9-
"autorest_command": "autorest specification/hardwaresecuritymodules/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/azure-sdk-for-python/sdk --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.10.2 --version-tolerant=False",
10-
"readme": "specification/hardwaresecuritymodules/resource-manager/readme.md"
4+
"typespec_src": "specification/hardwaresecuritymodules/HardwareSecurityModules.Management",
5+
"@azure-tools/typespec-python": "0.44.2"
116
}

sdk/hardwaresecuritymodules/azure-mgmt-hardwaresecuritymodules/apiview-properties.json

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

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

Lines changed: 11 additions & 5 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 ._hardware_security_modules_mgmt_client import HardwareSecurityModulesMgmtClient
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 HardwareSecurityModulesClient # 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__ = [
22-
"HardwareSecurityModulesMgmtClient",
28+
"HardwareSecurityModulesClient",
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: 45 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -2,89 +2,79 @@
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
# --------------------------------------------------------------------------
88

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

1313
from azure.core.pipeline import policies
1414
from azure.core.rest import HttpRequest, HttpResponse
15+
from azure.core.settings import settings
1516
from azure.mgmt.core import ARMPipelineClient
1617
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
18+
from azure.mgmt.core.tools import get_arm_endpoints
1719

18-
from . import models as _models
19-
from ._configuration import HardwareSecurityModulesMgmtClientConfiguration
20-
from ._serialization import Deserializer, Serializer
20+
from ._configuration import HardwareSecurityModulesClientConfiguration
21+
from ._utils.serialization import Deserializer, Serializer
2122
from .operations import (
22-
CloudHsmClusterBackupStatusOperations,
23-
CloudHsmClusterPrivateEndpointConnectionsOperations,
24-
CloudHsmClusterPrivateLinkResourcesOperations,
25-
CloudHsmClusterRestoreStatusOperations,
2623
CloudHsmClustersOperations,
27-
DedicatedHsmOperations,
24+
DedicatedHsmsOperations,
2825
Operations,
2926
PrivateEndpointConnectionsOperations,
3027
)
3128

3229
if TYPE_CHECKING:
33-
# pylint: disable=unused-import,ungrouped-imports
3430
from azure.core.credentials import TokenCredential
3531

3632

37-
class HardwareSecurityModulesMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
38-
"""The Azure management API provides a RESTful set of web services that interact with Azure HSM
39-
RP.
33+
class HardwareSecurityModulesClient:
34+
"""The Azure management API provides a RESTful set of web services that interact with Hardware
35+
Security Modules.
4036
37+
:ivar operations: Operations operations
38+
:vartype operations: azure.mgmt.hardwaresecuritymodules.operations.Operations
4139
:ivar cloud_hsm_clusters: CloudHsmClustersOperations operations
4240
:vartype cloud_hsm_clusters:
4341
azure.mgmt.hardwaresecuritymodules.operations.CloudHsmClustersOperations
44-
:ivar cloud_hsm_cluster_private_link_resources: CloudHsmClusterPrivateLinkResourcesOperations
45-
operations
46-
:vartype cloud_hsm_cluster_private_link_resources:
47-
azure.mgmt.hardwaresecuritymodules.operations.CloudHsmClusterPrivateLinkResourcesOperations
48-
:ivar cloud_hsm_cluster_private_endpoint_connections:
49-
CloudHsmClusterPrivateEndpointConnectionsOperations operations
50-
:vartype cloud_hsm_cluster_private_endpoint_connections:
51-
azure.mgmt.hardwaresecuritymodules.operations.CloudHsmClusterPrivateEndpointConnectionsOperations
5242
:ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
5343
:vartype private_endpoint_connections:
5444
azure.mgmt.hardwaresecuritymodules.operations.PrivateEndpointConnectionsOperations
55-
:ivar cloud_hsm_cluster_backup_status: CloudHsmClusterBackupStatusOperations operations
56-
:vartype cloud_hsm_cluster_backup_status:
57-
azure.mgmt.hardwaresecuritymodules.operations.CloudHsmClusterBackupStatusOperations
58-
:ivar cloud_hsm_cluster_restore_status: CloudHsmClusterRestoreStatusOperations operations
59-
:vartype cloud_hsm_cluster_restore_status:
60-
azure.mgmt.hardwaresecuritymodules.operations.CloudHsmClusterRestoreStatusOperations
61-
:ivar dedicated_hsm: DedicatedHsmOperations operations
62-
:vartype dedicated_hsm: azure.mgmt.hardwaresecuritymodules.operations.DedicatedHsmOperations
63-
:ivar operations: Operations operations
64-
:vartype operations: azure.mgmt.hardwaresecuritymodules.operations.Operations
65-
:param credential: Credential needed for the client to connect to Azure. Required.
45+
:ivar dedicated_hsms: DedicatedHsmsOperations operations
46+
:vartype dedicated_hsms: azure.mgmt.hardwaresecuritymodules.operations.DedicatedHsmsOperations
47+
:param credential: Credential used to authenticate requests to the service. Required.
6648
:type credential: ~azure.core.credentials.TokenCredential
6749
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
6850
:type subscription_id: str
69-
:param base_url: Service URL. Default value is "https://management.azure.com".
51+
:param base_url: Service host. Default value is None.
7052
:type base_url: str
71-
:keyword api_version: Api Version. Default value is "2024-06-30-preview". Note that overriding
72-
this default value may result in unsupported behavior.
53+
:keyword api_version: The API version to use for this operation. Default value is
54+
"2024-06-30-preview". Note that overriding this default value may result in unsupported
55+
behavior.
7356
:paramtype api_version: str
7457
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
7558
Retry-After header is present.
7659
"""
7760

7861
def __init__(
79-
self,
80-
credential: "TokenCredential",
81-
subscription_id: str,
82-
base_url: str = "https://management.azure.com",
83-
**kwargs: Any
62+
self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any
8463
) -> None:
85-
self._config = HardwareSecurityModulesMgmtClientConfiguration(
86-
credential=credential, subscription_id=subscription_id, **kwargs
64+
_endpoint = "{endpoint}"
65+
_cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore
66+
_endpoints = get_arm_endpoints(_cloud)
67+
if not base_url:
68+
base_url = _endpoints["resource_manager"]
69+
credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"])
70+
self._config = HardwareSecurityModulesClientConfiguration(
71+
credential=credential,
72+
subscription_id=subscription_id,
73+
base_url=cast(str, base_url),
74+
credential_scopes=credential_scopes,
75+
**kwargs
8776
)
77+
8878
_policies = kwargs.pop("policies", None)
8979
if _policies is None:
9080
_policies = [
@@ -103,40 +93,27 @@ def __init__(
10393
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
10494
self._config.http_logging_policy,
10595
]
106-
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
96+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, _endpoint), policies=_policies, **kwargs)
10797

108-
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
109-
self._serialize = Serializer(client_models)
110-
self._deserialize = Deserializer(client_models)
98+
self._serialize = Serializer()
99+
self._deserialize = Deserializer()
111100
self._serialize.client_side_validation = False
101+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
112102
self.cloud_hsm_clusters = CloudHsmClustersOperations(
113103
self._client, self._config, self._serialize, self._deserialize
114104
)
115-
self.cloud_hsm_cluster_private_link_resources = CloudHsmClusterPrivateLinkResourcesOperations(
116-
self._client, self._config, self._serialize, self._deserialize
117-
)
118-
self.cloud_hsm_cluster_private_endpoint_connections = CloudHsmClusterPrivateEndpointConnectionsOperations(
119-
self._client, self._config, self._serialize, self._deserialize
120-
)
121105
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(
122106
self._client, self._config, self._serialize, self._deserialize
123107
)
124-
self.cloud_hsm_cluster_backup_status = CloudHsmClusterBackupStatusOperations(
125-
self._client, self._config, self._serialize, self._deserialize
126-
)
127-
self.cloud_hsm_cluster_restore_status = CloudHsmClusterRestoreStatusOperations(
128-
self._client, self._config, self._serialize, self._deserialize
129-
)
130-
self.dedicated_hsm = DedicatedHsmOperations(self._client, self._config, self._serialize, self._deserialize)
131-
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
108+
self.dedicated_hsms = DedicatedHsmsOperations(self._client, self._config, self._serialize, self._deserialize)
132109

133-
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
110+
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
134111
"""Runs the network request through the client's chained policies.
135112
136113
>>> from azure.core.rest import HttpRequest
137114
>>> request = HttpRequest("GET", "https://www.example.org/")
138115
<HttpRequest [GET], url: 'https://www.example.org/'>
139-
>>> response = client._send_request(request)
116+
>>> response = client.send_request(request)
140117
<HttpResponse: 200 OK>
141118
142119
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
@@ -149,7 +126,11 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
149126
"""
150127

151128
request_copy = deepcopy(request)
152-
request_copy.url = self._client.format_url(request_copy.url)
129+
path_format_arguments = {
130+
"endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
131+
}
132+
133+
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
153134
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
154135

155136
def close(self) -> None:

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

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
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
# --------------------------------------------------------------------------
88

@@ -14,26 +14,34 @@
1414
from ._version import VERSION
1515

1616
if TYPE_CHECKING:
17-
# pylint: disable=unused-import,ungrouped-imports
1817
from azure.core.credentials import TokenCredential
1918

2019

21-
class HardwareSecurityModulesMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
22-
"""Configuration for HardwareSecurityModulesMgmtClient.
20+
class HardwareSecurityModulesClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
21+
"""Configuration for HardwareSecurityModulesClient.
2322
2423
Note that all parameters used to create this instance are saved as instance
2524
attributes.
2625
27-
:param credential: Credential needed for the client to connect to Azure. Required.
26+
:param credential: Credential used to authenticate requests to the service. Required.
2827
:type credential: ~azure.core.credentials.TokenCredential
2928
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
3029
:type subscription_id: str
31-
:keyword api_version: Api Version. Default value is "2024-06-30-preview". Note that overriding
32-
this default value may result in unsupported behavior.
30+
:param base_url: Service host. Default value is "https://management.azure.com".
31+
:type base_url: str
32+
:keyword api_version: The API version to use for this operation. Default value is
33+
"2024-06-30-preview". Note that overriding this default value may result in unsupported
34+
behavior.
3335
:paramtype api_version: str
3436
"""
3537

36-
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
38+
def __init__(
39+
self,
40+
credential: "TokenCredential",
41+
subscription_id: str,
42+
base_url: str = "https://management.azure.com",
43+
**kwargs: Any
44+
) -> None:
3745
api_version: str = kwargs.pop("api_version", "2024-06-30-preview")
3846

3947
if credential is None:
@@ -43,6 +51,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
4351

4452
self.credential = credential
4553
self.subscription_id = subscription_id
54+
self.base_url = base_url
4655
self.api_version = api_version
4756
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
4857
kwargs.setdefault("sdk_moniker", "mgmt-hardwaresecuritymodules/{}".format(VERSION))

sdk/hardwaresecuritymodules/azure-mgmt-hardwaresecuritymodules/azure/mgmt/hardwaresecuritymodules/_patch.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
# ------------------------------------
2-
# Copyright (c) Microsoft Corporation.
3-
# Licensed under the MIT License.
4-
# ------------------------------------
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+
# --------------------------------------------------------------------------
56
"""Customize generated code here.
67
78
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
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) Python Code Generator.
5+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
6+
# --------------------------------------------------------------------------

0 commit comments

Comments
 (0)