Skip to content

Commit ba81ffc

Browse files
author
SDKAuto
committed
CodeGen from PR 34242 in Azure/azure-rest-api-specs
Merge 8fbc11097a7044c1adc129e989a96f3988cf536d into 11059b2f00c7572b276dc9862c0b41db8702cc78
1 parent ebf29c4 commit ba81ffc

File tree

47 files changed

+5886
-6344
lines changed

Some content is hidden

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

47 files changed

+5886
-6344
lines changed

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

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

sdk/trustedsigning/azure-mgmt-trustedsigning/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 Trustedsigning 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: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
{
2-
"commit": "e6fde2ac19d0202f0e72217a3e0f9edb63dba273",
2+
"commit": "c908490d3d2b6fdd1a5dfa108a0f47183e4c06e0",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
44
"typespec_src": "specification/codesigning/CodeSigning.Management",
5-
"@azure-tools/typespec-python": "0.33.0"
5+
"@azure-tools/typespec-python": "0.33.0",
6+
"autorest": "3.10.2",
7+
"use": [
8+
"@autorest/[email protected]",
9+
"@autorest/[email protected]"
10+
],
11+
"autorest_command": "autorest specification/codesigning/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/[email protected] --use=@autorest/[email protected] --version=3.10.2 --version-tolerant=False",
12+
"readme": "specification/codesigning/resource-manager/readme.md"
613
}

sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/__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) Python Code Generator.
5+
# 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 ._client import TrustedSigningMgmtClient
10+
from typing import TYPE_CHECKING
11+
12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
14+
15+
from ._code_signing_management_client import CodeSigningManagementClient # 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-
"TrustedSigningMgmtClient",
28+
"CodeSigningManagementClient",
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/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/_client.py renamed to sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/_code_signing_management_client.py

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +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) Python Code Generator.
5+
# Code generated by Microsoft (R) AutoRest 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 ._configuration import TrustedSigningMgmtClientConfiguration
19-
from ._serialization import Deserializer, Serializer
20+
from . import models as _models
21+
from ._configuration import CodeSigningManagementClientConfiguration
22+
from ._utils.serialization import Deserializer, Serializer
2023
from .operations import CertificateProfilesOperations, CodeSigningAccountsOperations, Operations
2124

2225
if TYPE_CHECKING:
23-
# pylint: disable=unused-import,ungrouped-imports
2426
from azure.core.credentials import TokenCredential
2527

2628

27-
class TrustedSigningMgmtClient: # pylint: disable=client-accepts-api-version-keyword
29+
class CodeSigningManagementClient:
2830
"""Code Signing resource provider api.
2931
3032
:ivar operations: Operations operations
@@ -35,31 +37,31 @@ class TrustedSigningMgmtClient: # pylint: disable=client-accepts-api-version-ke
3537
:ivar certificate_profiles: CertificateProfilesOperations operations
3638
:vartype certificate_profiles:
3739
azure.mgmt.trustedsigning.operations.CertificateProfilesOperations
38-
:param credential: Credential used to authenticate requests to the service. Required.
40+
:param credential: Credential needed for the client to connect to Azure. Required.
3941
:type credential: ~azure.core.credentials.TokenCredential
4042
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
4143
:type subscription_id: str
42-
:param base_url: Service host. Default value is "https://management.azure.com".
44+
:param base_url: Service URL. Default value is None.
4345
:type base_url: str
44-
:keyword api_version: The API version to use for this operation. Default value is
45-
"2024-02-05-preview". Note that overriding this default value may result in unsupported
46-
behavior.
46+
:keyword api_version: Api Version. Default value is "2024-09-30-preview". Note that overriding
47+
this default value may result in unsupported behavior.
4748
:paramtype api_version: str
4849
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
4950
Retry-After header is present.
5051
"""
5152

5253
def __init__(
53-
self,
54-
credential: "TokenCredential",
55-
subscription_id: str,
56-
base_url: str = "https://management.azure.com",
57-
**kwargs: Any
54+
self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any
5855
) -> None:
59-
_endpoint = "{endpoint}"
60-
self._config = TrustedSigningMgmtClientConfiguration(
61-
credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs
56+
_cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore
57+
_endpoints = get_arm_endpoints(_cloud)
58+
if not base_url:
59+
base_url = _endpoints["resource_manager"]
60+
credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"])
61+
self._config = CodeSigningManagementClientConfiguration(
62+
credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs
6263
)
64+
6365
_policies = kwargs.pop("policies", None)
6466
if _policies is None:
6567
_policies = [
@@ -78,10 +80,11 @@ def __init__(
7880
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
7981
self._config.http_logging_policy,
8082
]
81-
self._client: ARMPipelineClient = ARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
83+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs)
8284

83-
self._serialize = Serializer()
84-
self._deserialize = Deserializer()
85+
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
86+
self._serialize = Serializer(client_models)
87+
self._deserialize = Deserializer(client_models)
8588
self._serialize.client_side_validation = False
8689
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
8790
self.code_signing_accounts = CodeSigningAccountsOperations(
@@ -91,13 +94,13 @@ def __init__(
9194
self._client, self._config, self._serialize, self._deserialize
9295
)
9396

94-
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
97+
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
9598
"""Runs the network request through the client's chained policies.
9699
97100
>>> from azure.core.rest import HttpRequest
98101
>>> request = HttpRequest("GET", "https://www.example.org/")
99102
<HttpRequest [GET], url: 'https://www.example.org/'>
100-
>>> response = client.send_request(request)
103+
>>> response = client._send_request(request)
101104
<HttpResponse: 200 OK>
102105
103106
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
@@ -110,11 +113,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
110113
"""
111114

112115
request_copy = deepcopy(request)
113-
path_format_arguments = {
114-
"endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
115-
}
116-
117-
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
116+
request_copy.url = self._client.format_url(request_copy.url)
118117
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
119118

120119
def close(self) -> None:

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

Lines changed: 8 additions & 19 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) Python Code Generator.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

@@ -14,36 +14,26 @@
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 TrustedSigningMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
22-
"""Configuration for TrustedSigningMgmtClient.
20+
class CodeSigningManagementClientConfiguration: # pylint: disable=too-many-instance-attributes
21+
"""Configuration for CodeSigningManagementClient.
2322
2423
Note that all parameters used to create this instance are saved as instance
2524
attributes.
2625
27-
:param credential: Credential used to authenticate requests to the service. Required.
26+
:param credential: Credential needed for the client to connect to Azure. 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-
:param base_url: Service host. Default value is "https://management.azure.com".
32-
:type base_url: str
33-
:keyword api_version: The API version to use for this operation. Default value is
34-
"2024-02-05-preview". Note that overriding this default value may result in unsupported
35-
behavior.
30+
:keyword api_version: Api Version. Default value is "2024-09-30-preview". Note that overriding
31+
this default value may result in unsupported behavior.
3632
:paramtype api_version: str
3733
"""
3834

39-
def __init__(
40-
self,
41-
credential: "TokenCredential",
42-
subscription_id: str,
43-
base_url: str = "https://management.azure.com",
44-
**kwargs: Any
45-
) -> None:
46-
api_version: str = kwargs.pop("api_version", "2024-02-05-preview")
35+
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
36+
api_version: str = kwargs.pop("api_version", "2024-09-30-preview")
4737

4838
if credential is None:
4939
raise ValueError("Parameter 'credential' must not be None.")
@@ -52,7 +42,6 @@ def __init__(
5242

5343
self.credential = credential
5444
self.subscription_id = subscription_id
55-
self.base_url = base_url
5645
self.api_version = api_version
5746
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
5847
kwargs.setdefault("sdk_moniker", "mgmt-trustedsigning/{}".format(VERSION))

0 commit comments

Comments
 (0)