Skip to content

Commit

Permalink
CodeGen from PR 32887 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 24a7bcc3e1f4a6419dba190f87aedc53b6e4e207 into 3af47defdafd8edfdea9e65bfa95505083558085
  • Loading branch information
SDKAuto committed Feb 27, 2025
1 parent 8694c6d commit 0355a05
Show file tree
Hide file tree
Showing 36 changed files with 611 additions and 1,056 deletions.
4 changes: 2 additions & 2 deletions sdk/trustedsigning/azure-mgmt-trustedsigning/_meta.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"commit": "e6fde2ac19d0202f0e72217a3e0f9edb63dba273",
"commit": "07684174944d1cf8fc532ce1b6367954f487f69b",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"typespec_src": "specification/codesigning/CodeSigning.Management",
"@azure-tools/typespec-python": "0.33.0"
"@azure-tools/typespec-python": "0.38.4"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"CrossLanguagePackageId": "Microsoft.CodeSigning",
"CrossLanguageDefinitionId": {
"azure.mgmt.trustedsigning.models.AccountSku": "Microsoft.CodeSigning.AccountSku",
"azure.mgmt.trustedsigning.models.AccountSkuPatch": "Microsoft.CodeSigning.AccountSkuPatch",
"azure.mgmt.trustedsigning.models.Certificate": "Microsoft.CodeSigning.Certificate",
"azure.mgmt.trustedsigning.models.Resource": "Azure.ResourceManager.CommonTypes.Resource",
"azure.mgmt.trustedsigning.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource",
"azure.mgmt.trustedsigning.models.CertificateProfile": "Microsoft.CodeSigning.CertificateProfile",
"azure.mgmt.trustedsigning.models.CertificateProfileProperties": "Microsoft.CodeSigning.CertificateProfileProperties",
"azure.mgmt.trustedsigning.models.CheckNameAvailability": "Microsoft.CodeSigning.CheckNameAvailability",
"azure.mgmt.trustedsigning.models.CheckNameAvailabilityResult": "Microsoft.CodeSigning.CheckNameAvailabilityResult",
"azure.mgmt.trustedsigning.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource",
"azure.mgmt.trustedsigning.models.CodeSigningAccount": "Microsoft.CodeSigning.CodeSigningAccount",
"azure.mgmt.trustedsigning.models.CodeSigningAccountPatch": "Microsoft.CodeSigning.CodeSigningAccountPatch",
"azure.mgmt.trustedsigning.models.CodeSigningAccountPatchProperties": "Microsoft.CodeSigning.CodeSigningAccountPatchProperties",
"azure.mgmt.trustedsigning.models.CodeSigningAccountProperties": "Microsoft.CodeSigning.CodeSigningAccountProperties",
"azure.mgmt.trustedsigning.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo",
"azure.mgmt.trustedsigning.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail",
"azure.mgmt.trustedsigning.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse",
"azure.mgmt.trustedsigning.models.Operation": "Azure.ResourceManager.CommonTypes.Operation",
"azure.mgmt.trustedsigning.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay",
"azure.mgmt.trustedsigning.models.Revocation": "Microsoft.CodeSigning.Revocation",
"azure.mgmt.trustedsigning.models.RevokeCertificate": "Microsoft.CodeSigning.RevokeCertificate",
"azure.mgmt.trustedsigning.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData",
"azure.mgmt.trustedsigning.models.Origin": "Azure.ResourceManager.CommonTypes.Origin",
"azure.mgmt.trustedsigning.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType",
"azure.mgmt.trustedsigning.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType",
"azure.mgmt.trustedsigning.models.SkuName": "Microsoft.CodeSigning.SkuName",
"azure.mgmt.trustedsigning.models.ProvisioningState": "Microsoft.CodeSigning.ProvisioningState",
"azure.mgmt.trustedsigning.models.NameUnavailabilityReason": "Microsoft.CodeSigning.NameUnavailabilityReason",
"azure.mgmt.trustedsigning.models.ProfileType": "Microsoft.CodeSigning.ProfileType",
"azure.mgmt.trustedsigning.models.CertificateProfileStatus": "Microsoft.CodeSigning.CertificateProfileStatus",
"azure.mgmt.trustedsigning.models.CertificateStatus": "Microsoft.CodeSigning.CertificateStatus",
"azure.mgmt.trustedsigning.models.RevocationStatus": "Microsoft.CodeSigning.RevocationStatus",
"azure.mgmt.trustedsigning.TrustedSigningMgmtClient.operations.list": "Azure.ResourceManager.Operations.list",
"azure.mgmt.trustedsigning.TrustedSigningMgmtClient.code_signing_accounts.get": "Microsoft.CodeSigning.CodeSigningAccounts.get",
"azure.mgmt.trustedsigning.TrustedSigningMgmtClient.code_signing_accounts.begin_create": "Microsoft.CodeSigning.CodeSigningAccounts.create",
"azure.mgmt.trustedsigning.TrustedSigningMgmtClient.code_signing_accounts.begin_update": "Microsoft.CodeSigning.CodeSigningAccounts.update",
"azure.mgmt.trustedsigning.TrustedSigningMgmtClient.code_signing_accounts.begin_delete": "Microsoft.CodeSigning.CodeSigningAccounts.delete",
"azure.mgmt.trustedsigning.TrustedSigningMgmtClient.code_signing_accounts.list_by_resource_group": "Microsoft.CodeSigning.CodeSigningAccounts.listByResourceGroup",
"azure.mgmt.trustedsigning.TrustedSigningMgmtClient.code_signing_accounts.list_by_subscription": "Microsoft.CodeSigning.CodeSigningAccounts.listBySubscription",
"azure.mgmt.trustedsigning.TrustedSigningMgmtClient.code_signing_accounts.check_name_availability": "Microsoft.CodeSigning.CodeSigningAccounts.checkNameAvailability",
"azure.mgmt.trustedsigning.TrustedSigningMgmtClient.certificate_profiles.get": "Microsoft.CodeSigning.CertificateProfiles.get",
"azure.mgmt.trustedsigning.TrustedSigningMgmtClient.certificate_profiles.begin_create": "Microsoft.CodeSigning.CertificateProfiles.create",
"azure.mgmt.trustedsigning.TrustedSigningMgmtClient.certificate_profiles.begin_delete": "Microsoft.CodeSigning.CertificateProfiles.delete",
"azure.mgmt.trustedsigning.TrustedSigningMgmtClient.certificate_profiles.list_by_code_signing_account": "Microsoft.CodeSigning.CertificateProfiles.listByCodeSigningAccount",
"azure.mgmt.trustedsigning.TrustedSigningMgmtClient.certificate_profiles.revoke_certificate": "Microsoft.CodeSigning.CertificateProfiles.revokeCertificate"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,28 @@
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wrong-import-position

from ._client import TrustedSigningMgmtClient
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ._patch import * # pylint: disable=unused-wildcard-import

from ._client import TrustedSigningMgmtClient # type: ignore
from ._version import VERSION

__version__ = VERSION

try:
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk

__all__ = [
"TrustedSigningMgmtClient",
]
__all__.extend([p for p in _patch_all if p not in __all__])
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore

_patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@
from .operations import CertificateProfilesOperations, CodeSigningAccountsOperations, Operations

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


class TrustedSigningMgmtClient: # pylint: disable=client-accepts-api-version-keyword
class TrustedSigningMgmtClient:
"""Code Signing resource provider api.
:ivar operations: Operations operations
Expand All @@ -41,9 +40,8 @@ class TrustedSigningMgmtClient: # pylint: disable=client-accepts-api-version-ke
:type subscription_id: str
:param base_url: Service host. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: The API version to use for this operation. Default value is
"2024-02-05-preview". Note that overriding this default value may result in unsupported
behavior.
:keyword api_version: The API version to use for this operation. Default value is "2025-03-30".
Note that overriding this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
from ._version import VERSION

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


class TrustedSigningMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
class TrustedSigningMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for TrustedSigningMgmtClient.
Note that all parameters used to create this instance are saved as instance
Expand All @@ -30,9 +29,8 @@ class TrustedSigningMgmtClientConfiguration: # pylint: disable=too-many-instanc
:type subscription_id: str
:param base_url: Service host. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: The API version to use for this operation. Default value is
"2024-02-05-preview". Note that overriding this default value may result in unsupported
behavior.
:keyword api_version: The API version to use for this operation. Default value is "2025-03-30".
Note that overriding this default value may result in unsupported behavior.
:paramtype api_version: str
"""

Expand All @@ -43,7 +41,7 @@ def __init__(
base_url: str = "https://management.azure.com",
**kwargs: Any
) -> None:
api_version: str = kwargs.pop("api_version", "2024-02-05-preview")
api_version: str = kwargs.pop("api_version", "2025-03-30")

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
# pylint: disable=protected-access, arguments-differ, signature-differs, broad-except, too-many-lines
# pylint: disable=protected-access, broad-except

import copy
import calendar
Expand Down Expand Up @@ -372,15 +373,34 @@ def __ne__(self, other: typing.Any) -> bool:
return not self.__eq__(other)

def keys(self) -> typing.KeysView[str]:
"""
:returns: a set-like object providing a view on D's keys
:rtype: ~typing.KeysView
"""
return self._data.keys()

def values(self) -> typing.ValuesView[typing.Any]:
"""
:returns: an object providing a view on D's values
:rtype: ~typing.ValuesView
"""
return self._data.values()

def items(self) -> typing.ItemsView[str, typing.Any]:
"""
:returns: set-like object providing a view on D's items
:rtype: ~typing.ItemsView
"""
return self._data.items()

def get(self, key: str, default: typing.Any = None) -> typing.Any:
"""
Get the value for key if key is in the dictionary, else default.
:param str key: The key to look up.
:param any default: The value to return if key is not in the dictionary. Defaults to None
:returns: D[k] if k in D, else d.
:rtype: any
"""
try:
return self[key]
except KeyError:
Expand All @@ -396,17 +416,38 @@ def pop(self, key: str, default: _T) -> _T: ...
def pop(self, key: str, default: typing.Any) -> typing.Any: ...

def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any:
"""
Removes specified key and return the corresponding value.
:param str key: The key to pop.
:param any default: The value to return if key is not in the dictionary
:returns: The value corresponding to the key.
:rtype: any
:raises KeyError: If key is not found and default is not given.
"""
if default is _UNSET:
return self._data.pop(key)
return self._data.pop(key, default)

def popitem(self) -> typing.Tuple[str, typing.Any]:
"""
Removes and returns some (key, value) pair
:returns: The (key, value) pair.
:rtype: tuple
:raises KeyError: if D is empty.
"""
return self._data.popitem()

def clear(self) -> None:
"""
Remove all items from D.
"""
self._data.clear()

def update(self, *args: typing.Any, **kwargs: typing.Any) -> None:
"""
Updates D from mapping/iterable E and F.
:param any args: Either a mapping object or an iterable of key-value pairs.
"""
self._data.update(*args, **kwargs)

@typing.overload
Expand All @@ -416,6 +457,13 @@ def setdefault(self, key: str, default: None = None) -> None: ...
def setdefault(self, key: str, default: typing.Any) -> typing.Any: ...

def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any:
"""
Same as calling D.get(k, d), and setting D[k]=d if k not found
:param str key: The key to look up.
:param any default: The value to set if key is not in the dictionary
:returns: D[k] if k in D, else d.
:rtype: any
"""
if default is _UNSET:
return self._data.setdefault(key)
return self._data.setdefault(key, default)
Expand Down Expand Up @@ -573,7 +621,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None:
def copy(self) -> "Model":
return Model(self.__dict__)

def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: # pylint: disable=unused-argument
def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self:
if f"{cls.__module__}.{cls.__qualname__}" not in cls._calculated:
# we know the last nine classes in mro are going to be 'Model', '_MyMutableMapping', 'MutableMapping',
# 'Mapping', 'Collection', 'Sized', 'Iterable', 'Container' and 'object'
Expand All @@ -584,8 +632,8 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: # pylint: di
annotations = {
k: v
for mro_class in mros
if hasattr(mro_class, "__annotations__") # pylint: disable=no-member
for k, v in mro_class.__annotations__.items() # pylint: disable=no-member
if hasattr(mro_class, "__annotations__")
for k, v in mro_class.__annotations__.items()
}
for attr, rf in attr_to_rest_field.items():
rf._module = cls.__module__
Expand All @@ -600,8 +648,8 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: # pylint: di

def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None:
for base in cls.__bases__:
if hasattr(base, "__mapping__"): # pylint: disable=no-member
base.__mapping__[discriminator or cls.__name__] = cls # type: ignore # pylint: disable=no-member
if hasattr(base, "__mapping__"):
base.__mapping__[discriminator or cls.__name__] = cls # type: ignore

@classmethod
def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]:
Expand All @@ -612,7 +660,7 @@ def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField

@classmethod
def _deserialize(cls, data, exist_discriminators):
if not hasattr(cls, "__mapping__"): # pylint: disable=no-member
if not hasattr(cls, "__mapping__"):
return cls(data)
discriminator = cls._get_discriminator(exist_discriminators)
if discriminator is None:
Expand All @@ -632,11 +680,11 @@ def _deserialize(cls, data, exist_discriminators):
discriminator_value = data.find(xml_name).text # pyright: ignore
else:
discriminator_value = data.get(discriminator._rest_name)
mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member
mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore
return mapped_cls._deserialize(data, exist_discriminators)

def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing.Any]:
"""Return a dict that can be JSONify using json.dump.
"""Return a dict that can be turned into json using json.dump.
:keyword bool exclude_readonly: Whether to remove the readonly properties.
:returns: A dict JSON compatible object
Expand Down Expand Up @@ -733,7 +781,7 @@ def _sorted_annotations(types: typing.List[typing.Any]) -> typing.List[typing.An
)


def _get_deserialize_callable_from_annotation( # pylint: disable=R0911, R0915, R0912
def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-branches
annotation: typing.Any,
module: typing.Optional[str],
rf: typing.Optional["_RestField"] = None,
Expand All @@ -753,7 +801,7 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=R0911, R0915,
except AttributeError:
model_name = annotation
if module is not None:
annotation = _get_model(module, model_name)
annotation = _get_model(module, model_name) # type: ignore

try:
if module and _is_model(annotation):
Expand Down Expand Up @@ -893,6 +941,35 @@ def _deserialize(
return _deserialize_with_callable(deserializer, value)


def _failsafe_deserialize(
deserializer: typing.Any,
value: typing.Any,
module: typing.Optional[str] = None,
rf: typing.Optional["_RestField"] = None,
format: typing.Optional[str] = None,
) -> typing.Any:
try:
return _deserialize(deserializer, value, module, rf, format)
except DeserializationError:
_LOGGER.warning(
"Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True
)
return None


def _failsafe_deserialize_xml(
deserializer: typing.Any,
value: typing.Any,
) -> typing.Any:
try:
return _deserialize_xml(deserializer, value)
except DeserializationError:
_LOGGER.warning(
"Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True
)
return None


class _RestField:
def __init__(
self,
Expand Down
Loading

0 comments on commit 0355a05

Please sign in to comment.