diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/_meta.json b/sdk/trustedsigning/azure-mgmt-trustedsigning/_meta.json index fde7aa5f8cd..2c02e13ed63 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/_meta.json +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/_meta.json @@ -1,6 +1,6 @@ { - "commit": "e6fde2ac19d0202f0e72217a3e0f9edb63dba273", + "commit": "676334a284e5136f0a0721d6ae844bb04332f579", "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" } \ No newline at end of file diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/apiview-properties.json b/sdk/trustedsigning/azure-mgmt-trustedsigning/apiview-properties.json new file mode 100644 index 00000000000..3508ccd6afa --- /dev/null +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/apiview-properties.json @@ -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" + } +} \ No newline at end of file diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/__init__.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/__init__.py index c873a5e57c0..641dd2bfe3e 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/__init__.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/__init__.py @@ -5,15 +5,21 @@ # 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 @@ -21,6 +27,6 @@ __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() diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/_client.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/_client.py index cfda86b3c57..6a43b796704 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/_client.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/_client.py @@ -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 @@ -42,7 +41,7 @@ class TrustedSigningMgmtClient: # pylint: disable=client-accepts-api-version-ke :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 + "2024-09-30-preview". 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 diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/_configuration.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/_configuration.py index d9b0d50c286..e18e24faac3 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/_configuration.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/_configuration.py @@ -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 @@ -31,7 +30,7 @@ class TrustedSigningMgmtClientConfiguration: # pylint: disable=too-many-instanc :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 + "2024-09-30-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -43,7 +42,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", "2024-09-30-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/_model_base.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/_model_base.py index 12ad7f29c71..3072ee252ed 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/_model_base.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/_model_base.py @@ -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 @@ -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: @@ -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 @@ -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) @@ -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' @@ -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__ @@ -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"]: @@ -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: @@ -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 @@ -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, @@ -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): @@ -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, diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/_serialization.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/_serialization.py index 01a226bd7f1..e2a20b1d534 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/_serialization.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/_serialization.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. @@ -48,9 +48,7 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, List, ) @@ -61,13 +59,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -185,73 +183,7 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0. - - :param datetime.datetime dt: The datetime - :returns: The offset - :rtype: datetime.timedelta - """ - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation. - - :param datetime.datetime dt: The datetime - :returns: The timestamp representation - :rtype: str - """ - return "Z" - - def dst(self, dt): - """No daylight saving for UTC. - - :param datetime.datetime dt: The datetime - :returns: The daylight saving time - :rtype: datetime.timedelta - """ - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset): - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -480,7 +412,7 @@ def from_dict( :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model :raises: DeserializationError if something went wrong - :rtype: ModelType + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -507,7 +439,6 @@ def _flatten_subtype(cls, key, objects): def _classify(cls, response, objects): """Check the class _subtype_map for any child classes. We want to ignore any inherited _subtype_maps. - Remove the polymorphic key from the initial data. :param dict response: The initial data :param dict objects: The class objects @@ -519,7 +450,7 @@ def _classify(cls, response, objects): if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) else: subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: @@ -564,7 +495,7 @@ def _decode_attribute_map_key(key): return key.replace("\\.", ".") -class Serializer(object): # pylint: disable=too-many-public-methods +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -599,7 +530,7 @@ class Serializer(object): # pylint: disable=too-many-public-methods "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -627,7 +558,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) @@ -737,8 +668,8 @@ def body(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized request body """ @@ -782,8 +713,8 @@ def url(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :rtype: str :returns: The serialized URL path - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -806,8 +737,8 @@ def query(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized query parameter """ try: @@ -836,8 +767,8 @@ def header(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized header """ try: @@ -856,9 +787,9 @@ def serialize_data(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. :returns: The serialized data. :rtype: str, int, float, bool, dict, list """ @@ -1193,7 +1124,7 @@ def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. :return: serialized rfc """ try: @@ -1219,7 +1150,7 @@ def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. :return: serialized iso """ if isinstance(attr, str): @@ -1252,7 +1183,7 @@ def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid :return: serialied unix """ if isinstance(attr, int): @@ -1430,7 +1361,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name ) ) @@ -1442,7 +1373,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1453,7 +1384,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1489,7 +1420,7 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1503,7 +1434,7 @@ def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1684,17 +1615,21 @@ def _instantiate_model(self, response, attrs, additional_properties=None): subtype = getattr(response, "_subtype_map", {}) try: readonly = [ - k for k, v in response._validation.items() if v.get("readonly") # pylint: disable=protected-access + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") ] const = [ - k for k, v in response._validation.items() if v.get("constant") # pylint: disable=protected-access + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") ] kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) if additional_properties: - response_obj.additional_properties = additional_properties + response_obj.additional_properties = additional_properties # type: ignore return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore @@ -1714,7 +1649,7 @@ def deserialize_data(self, data, data_type): # pylint: disable=too-many-return- :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1796,7 +1731,7 @@ def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return :param dict attr: Dictionary to be deserialized. :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1842,7 +1777,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :param str data_type: deserialization data type. :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1933,7 +1868,7 @@ def deserialize_bytearray(attr): :param str attr: response string to be deserialized. :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1946,7 +1881,7 @@ def deserialize_base64(attr): :param str attr: response string to be deserialized. :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1961,7 +1896,7 @@ def deserialize_decimal(attr): :param str attr: response string to be deserialized. :return: Deserialized decimal - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. :rtype: decimal """ if isinstance(attr, ET.Element): @@ -1979,7 +1914,7 @@ def deserialize_long(attr): :param str attr: response string to be deserialized. :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1992,7 +1927,7 @@ def deserialize_duration(attr): :param str attr: response string to be deserialized. :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2010,7 +1945,7 @@ def deserialize_date(attr): :param str attr: response string to be deserialized. :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2026,7 +1961,7 @@ def deserialize_time(attr): :param str attr: response string to be deserialized. :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2041,14 +1976,14 @@ def deserialize_rfc(attr): :param str attr: response string to be deserialized. :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -2064,7 +1999,7 @@ def deserialize_iso(attr): :param str attr: response string to be deserialized. :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2102,7 +2037,7 @@ def deserialize_unix(attr): :param int attr: Object to be serialized. :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/aio/__init__.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/aio/__init__.py index 6f788afcc13..f5f45083327 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/aio/__init__.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/aio/__init__.py @@ -5,12 +5,18 @@ # 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 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 @@ -18,6 +24,6 @@ __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() diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/aio/_client.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/aio/_client.py index 30a4f46b28d..586d42c2d28 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/aio/_client.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/aio/_client.py @@ -20,11 +20,10 @@ from .operations import CertificateProfilesOperations, CodeSigningAccountsOperations, Operations if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class TrustedSigningMgmtClient: # pylint: disable=client-accepts-api-version-keyword +class TrustedSigningMgmtClient: """Code Signing resource provider api. :ivar operations: Operations operations @@ -42,7 +41,7 @@ class TrustedSigningMgmtClient: # pylint: disable=client-accepts-api-version-ke :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 + "2024-09-30-preview". 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 diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/aio/_configuration.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/aio/_configuration.py index 5eedbe25918..8d3bdaf3fcd 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/aio/_configuration.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/aio/_configuration.py @@ -14,11 +14,10 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -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 @@ -31,7 +30,7 @@ class TrustedSigningMgmtClientConfiguration: # pylint: disable=too-many-instanc :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 + "2024-09-30-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -43,7 +42,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", "2024-09-30-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/aio/operations/__init__.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/aio/operations/__init__.py index 935a86f04db..2a2e3725423 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/aio/operations/__init__.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/aio/operations/__init__.py @@ -5,13 +5,19 @@ # 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 ._operations import Operations -from ._operations import CodeSigningAccountsOperations -from ._operations import CertificateProfilesOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._operations import CodeSigningAccountsOperations # type: ignore +from ._operations import CertificateProfilesOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -19,5 +25,5 @@ "CodeSigningAccountsOperations", "CertificateProfilesOperations", ] -__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() diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/aio/operations/_operations.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/aio/operations/_operations.py index a79891ffb7f..3aa6b8e4b57 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/aio/operations/_operations.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -9,23 +9,10 @@ from io import IOBase import json import sys -from typing import ( - Any, - AsyncIterable, - AsyncIterator, - Callable, - Dict, - IO, - List, - Optional, - Type, - TypeVar, - Union, - cast, - overload, -) +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -47,7 +34,8 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._model_base import SdkJSONEncoder, _deserialize +from ..._model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from ..._serialization import Deserializer, Serializer from ...operations._operations import ( build_certificate_profiles_create_request, build_certificate_profiles_delete_request, @@ -63,11 +51,12 @@ build_code_signing_accounts_update_request, build_operations_list_request, ) +from .._configuration import TrustedSigningMgmtClientConfiguration if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object @@ -85,10 +74,10 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: TrustedSigningMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -103,7 +92,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -166,7 +155,7 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -186,10 +175,10 @@ class CodeSigningAccountsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: TrustedSigningMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.CodeSigningAccount: @@ -204,7 +193,7 @@ async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.trustedsigning.models.CodeSigningAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -244,7 +233,7 @@ async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -264,7 +253,7 @@ async def _create_initial( resource: Union[_models.CodeSigningAccount, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -313,7 +302,7 @@ async def _create_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -497,7 +486,7 @@ async def _update_initial( properties: Union[_models.CodeSigningAccountPatch, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -546,7 +535,7 @@ async def _update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -726,7 +715,7 @@ def get_long_running_output(pipeline_response): ) async def _delete_initial(self, resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -765,7 +754,7 @@ async def _delete_initial(self, resource_group_name: str, account_name: str, **k except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -856,7 +845,7 @@ def list_by_resource_group( cls: ClsType[List[_models.CodeSigningAccount]] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -921,7 +910,7 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -942,7 +931,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.CodeSign cls: ClsType[List[_models.CodeSigningAccount]] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1006,7 +995,7 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1078,7 +1067,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.trustedsigning.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1126,7 +1115,7 @@ async def check_name_availability( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -1152,10 +1141,10 @@ class CertificateProfilesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: TrustedSigningMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( @@ -1174,7 +1163,7 @@ async def get( :rtype: ~azure.mgmt.trustedsigning.models.CertificateProfile :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1215,7 +1204,7 @@ async def get( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -1236,7 +1225,7 @@ async def _create_initial( resource: Union[_models.CertificateProfile, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1286,7 +1275,7 @@ async def _create_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1479,7 +1468,7 @@ def get_long_running_output(pipeline_response): async def _delete_initial( self, resource_group_name: str, account_name: str, profile_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1519,7 +1508,7 @@ async def _delete_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1617,7 +1606,7 @@ def list_by_code_signing_account( cls: ClsType[List[_models.CertificateProfile]] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1683,7 +1672,7 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1691,7 +1680,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @overload - async def revoke_certificate( # pylint: disable=inconsistent-return-statements + async def revoke_certificate( self, resource_group_name: str, account_name: str, @@ -1721,7 +1710,7 @@ async def revoke_certificate( # pylint: disable=inconsistent-return-statements """ @overload - async def revoke_certificate( # pylint: disable=inconsistent-return-statements + async def revoke_certificate( self, resource_group_name: str, account_name: str, @@ -1751,7 +1740,7 @@ async def revoke_certificate( # pylint: disable=inconsistent-return-statements """ @overload - async def revoke_certificate( # pylint: disable=inconsistent-return-statements + async def revoke_certificate( self, resource_group_name: str, account_name: str, @@ -1781,7 +1770,7 @@ async def revoke_certificate( # pylint: disable=inconsistent-return-statements """ @distributed_trace_async - async def revoke_certificate( # pylint: disable=inconsistent-return-statements + async def revoke_certificate( self, resource_group_name: str, account_name: str, @@ -1805,7 +1794,7 @@ async def revoke_certificate( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1851,7 +1840,7 @@ async def revoke_certificate( # pylint: disable=inconsistent-return-statements if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/models/__init__.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/models/__init__.py index 242fee9abd4..8194d8aacdc 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/models/__init__.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/models/__init__.py @@ -5,45 +5,58 @@ # 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 ._models import AccountSku -from ._models import Certificate -from ._models import CertificateProfile -from ._models import CertificateProfileProperties -from ._models import CheckNameAvailability -from ._models import CheckNameAvailabilityResult -from ._models import CodeSigningAccount -from ._models import CodeSigningAccountPatch -from ._models import CodeSigningAccountPatchProperties -from ._models import CodeSigningAccountProperties -from ._models import ErrorAdditionalInfo -from ._models import ErrorDetail -from ._models import ErrorResponse -from ._models import Operation -from ._models import OperationDisplay -from ._models import ProxyResource -from ._models import Resource -from ._models import Revocation -from ._models import RevokeCertificate -from ._models import SystemData -from ._models import TrackedResource +from typing import TYPE_CHECKING -from ._enums import ActionType -from ._enums import CertificateProfileStatus -from ._enums import CertificateStatus -from ._enums import CreatedByType -from ._enums import NameUnavailabilityReason -from ._enums import Origin -from ._enums import ProfileType -from ._enums import ProvisioningState -from ._enums import RevocationStatus -from ._enums import SkuName +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models import ( # type: ignore + AccountSku, + AccountSkuPatch, + Certificate, + CertificateProfile, + CertificateProfileProperties, + CheckNameAvailability, + CheckNameAvailabilityResult, + CodeSigningAccount, + CodeSigningAccountPatch, + CodeSigningAccountPatchProperties, + CodeSigningAccountProperties, + ErrorAdditionalInfo, + ErrorDetail, + ErrorResponse, + Operation, + OperationDisplay, + ProxyResource, + Resource, + Revocation, + RevokeCertificate, + SystemData, + TrackedResource, +) + +from ._enums import ( # type: ignore + ActionType, + CertificateProfileStatus, + CertificateStatus, + CreatedByType, + NameUnavailabilityReason, + Origin, + ProfileType, + ProvisioningState, + RevocationStatus, + SkuName, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ "AccountSku", + "AccountSkuPatch", "Certificate", "CertificateProfile", "CertificateProfileProperties", @@ -75,5 +88,5 @@ "RevocationStatus", "SkuName", ] -__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() diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/models/_models.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/models/_models.py index 9c3e111c0a6..c26a446b789 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/models/_models.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/models/_models.py @@ -1,11 +1,12 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 -# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=useless-super-delegation import datetime from typing import Any, Dict, List, Mapping, Optional, TYPE_CHECKING, Union, overload @@ -14,7 +15,6 @@ from .._model_base import rest_field if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -26,7 +26,7 @@ class AccountSku(_model_base.Model): :vartype name: str or ~azure.mgmt.trustedsigning.models.SkuName """ - name: Union[str, "_models.SkuName"] = rest_field() + name: Union[str, "_models.SkuName"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Name of the SKU. Required. Known values are: \"Basic\" and \"Premium\".""" @overload @@ -34,16 +34,46 @@ def __init__( self, *, name: Union[str, "_models.SkuName"], - ): ... + ) -> None: ... @overload - def __init__(self, mapping: Mapping[str, Any]): + def __init__(self, mapping: Mapping[str, Any]) -> None: """ :param mapping: raw JSON to initialize the model. :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AccountSkuPatch(_model_base.Model): + """SKU of the trusted signing account. + + :ivar name: Name of the SKU. Known values are: "Basic" and "Premium". + :vartype name: str or ~azure.mgmt.trustedsigning.models.SkuName + """ + + name: Optional[Union[str, "_models.SkuName"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Name of the SKU. Known values are: \"Basic\" and \"Premium\".""" + + @overload + def __init__( + self, + *, + name: Optional[Union[str, "_models.SkuName"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) @@ -52,6 +82,8 @@ class Certificate(_model_base.Model): :ivar serial_number: Serial number of the certificate. :vartype serial_number: str + :ivar enhanced_key_usage: Enhanced key usage of the certificate. + :vartype enhanced_key_usage: str :ivar subject_name: Subject name of the certificate. :vartype subject_name: str :ivar thumbprint: Thumbprint of the certificate. @@ -66,19 +98,33 @@ class Certificate(_model_base.Model): :vartype revocation: ~azure.mgmt.trustedsigning.models.Revocation """ - serial_number: Optional[str] = rest_field(name="serialNumber") + serial_number: Optional[str] = rest_field( + name="serialNumber", visibility=["read", "create", "update", "delete", "query"] + ) """Serial number of the certificate.""" - subject_name: Optional[str] = rest_field(name="subjectName") + enhanced_key_usage: Optional[str] = rest_field( + name="enhancedKeyUsage", visibility=["read", "create", "update", "delete", "query"] + ) + """Enhanced key usage of the certificate.""" + subject_name: Optional[str] = rest_field( + name="subjectName", visibility=["read", "create", "update", "delete", "query"] + ) """Subject name of the certificate.""" - thumbprint: Optional[str] = rest_field() + thumbprint: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Thumbprint of the certificate.""" - created_date: Optional[str] = rest_field(name="createdDate") + created_date: Optional[str] = rest_field( + name="createdDate", visibility=["read", "create", "update", "delete", "query"] + ) """Certificate created date.""" - expiry_date: Optional[str] = rest_field(name="expiryDate") + expiry_date: Optional[str] = rest_field( + name="expiryDate", visibility=["read", "create", "update", "delete", "query"] + ) """Certificate expiry date.""" - status: Optional[Union[str, "_models.CertificateStatus"]] = rest_field() + status: Optional[Union[str, "_models.CertificateStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """Status of the certificate. Known values are: \"Active\", \"Expired\", and \"Revoked\".""" - revocation: Optional["_models.Revocation"] = rest_field() + revocation: Optional["_models.Revocation"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Revocations history of a certificate.""" __flattened_items = ["requested_at", "effective_at", "reason", "remarks", "status", "failure_reason"] @@ -88,22 +134,23 @@ def __init__( self, *, serial_number: Optional[str] = None, + enhanced_key_usage: Optional[str] = None, subject_name: Optional[str] = None, thumbprint: Optional[str] = None, created_date: Optional[str] = None, expiry_date: Optional[str] = None, status: Optional[Union[str, "_models.CertificateStatus"]] = None, revocation: Optional["_models.Revocation"] = None, - ): ... + ) -> None: ... @overload - def __init__(self, mapping: Mapping[str, Any]): + def __init__(self, mapping: Mapping[str, Any]) -> None: """ :param mapping: raw JSON to initialize the model. :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) for k, v in _flattened_input.items(): @@ -131,7 +178,7 @@ class Resource(_model_base.Model): Readonly variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -145,7 +192,7 @@ class Resource(_model_base.Model): id: Optional[str] = rest_field(visibility=["read"]) """Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long""" + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" name: Optional[str] = rest_field(visibility=["read"]) """The name of the resource.""" type: Optional[str] = rest_field(visibility=["read"]) @@ -162,7 +209,7 @@ class ProxyResource(Resource): Readonly variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -181,7 +228,7 @@ class CertificateProfile(ProxyResource): Readonly variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -195,7 +242,9 @@ class CertificateProfile(ProxyResource): :vartype properties: ~azure.mgmt.trustedsigning.models.CertificateProfileProperties """ - properties: Optional["_models.CertificateProfileProperties"] = rest_field() + properties: Optional["_models.CertificateProfileProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The resource-specific properties for this resource.""" @overload @@ -203,20 +252,20 @@ def __init__( self, *, properties: Optional["_models.CertificateProfileProperties"] = None, - ): ... + ) -> None: ... @overload - def __init__(self, mapping: Mapping[str, Any]): + def __init__(self, mapping: Mapping[str, Any]) -> None: """ :param mapping: raw JSON to initialize the model. :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CertificateProfileProperties(_model_base.Model): # pylint: disable=too-many-instance-attributes +class CertificateProfileProperties(_model_base.Model): """Properties of the certificate profile. Readonly variables are only populated by the server, and will be ignored when sending a request. @@ -225,38 +274,21 @@ class CertificateProfileProperties(_model_base.Model): # pylint: disable=too-ma :ivar profile_type: Profile type of the certificate. Required. Known values are: "PublicTrust", "PrivateTrust", "PrivateTrustCIPolicy", "VBSEnclave", and "PublicTrustTest". :vartype profile_type: str or ~azure.mgmt.trustedsigning.models.ProfileType - :ivar common_name: Used as CN in the certificate subject name. - :vartype common_name: str - :ivar organization: Used as O in the certificate subject name. - :vartype organization: str - :ivar organization_unit: Used as OU in the private trust certificate subject name. - :vartype organization_unit: str - :ivar street_address: Used as STREET in the certificate subject name. - :vartype street_address: str :ivar include_street_address: Whether to include STREET in the certificate subject name. :vartype include_street_address: bool - :ivar city: Used as L in the certificate subject name. - :vartype city: str :ivar include_city: Whether to include L in the certificate subject name. Applicable only for private trust, private trust ci profile types. :vartype include_city: bool - :ivar state: Used as S in the certificate subject name. - :vartype state: str :ivar include_state: Whether to include S in the certificate subject name. Applicable only for private trust, private trust ci profile types. :vartype include_state: bool - :ivar country: Used as C in the certificate subject name. - :vartype country: str :ivar include_country: Whether to include C in the certificate subject name. Applicable only for private trust, private trust ci profile types. :vartype include_country: bool - :ivar postal_code: Used as PC in the certificate subject name. - :vartype postal_code: str :ivar include_postal_code: Whether to include PC in the certificate subject name. :vartype include_postal_code: bool - :ivar enhanced_key_usage: Enhanced key usage of the certificate. - :vartype enhanced_key_usage: str :ivar identity_validation_id: Identity validation id used for the certificate subject name. + Required. :vartype identity_validation_id: str :ivar provisioning_state: Status of the current operation on certificate profile. Known values are: "Succeeded", "Failed", "Canceled", "Updating", "Deleting", and "Accepted". @@ -268,42 +300,38 @@ class CertificateProfileProperties(_model_base.Model): # pylint: disable=too-ma :vartype certificates: list[~azure.mgmt.trustedsigning.models.Certificate] """ - profile_type: Union[str, "_models.ProfileType"] = rest_field(name="profileType") + profile_type: Union[str, "_models.ProfileType"] = rest_field( + name="profileType", visibility=["read", "create", "update", "delete", "query"] + ) """Profile type of the certificate. Required. Known values are: \"PublicTrust\", \"PrivateTrust\", \"PrivateTrustCIPolicy\", \"VBSEnclave\", and \"PublicTrustTest\".""" - common_name: Optional[str] = rest_field(name="commonName", visibility=["read"]) - """Used as CN in the certificate subject name.""" - organization: Optional[str] = rest_field(visibility=["read"]) - """Used as O in the certificate subject name.""" - organization_unit: Optional[str] = rest_field(name="organizationUnit", visibility=["read"]) - """Used as OU in the private trust certificate subject name.""" - street_address: Optional[str] = rest_field(name="streetAddress", visibility=["read"]) - """Used as STREET in the certificate subject name.""" - include_street_address: Optional[bool] = rest_field(name="includeStreetAddress") + include_street_address: Optional[bool] = rest_field( + name="includeStreetAddress", visibility=["read", "create", "update", "delete", "query"] + ) """Whether to include STREET in the certificate subject name.""" - city: Optional[str] = rest_field(visibility=["read"]) - """Used as L in the certificate subject name.""" - include_city: Optional[bool] = rest_field(name="includeCity") + include_city: Optional[bool] = rest_field( + name="includeCity", visibility=["read", "create", "update", "delete", "query"] + ) """Whether to include L in the certificate subject name. Applicable only for private trust, private trust ci profile types.""" - state: Optional[str] = rest_field(visibility=["read"]) - """Used as S in the certificate subject name.""" - include_state: Optional[bool] = rest_field(name="includeState") + include_state: Optional[bool] = rest_field( + name="includeState", visibility=["read", "create", "update", "delete", "query"] + ) """Whether to include S in the certificate subject name. Applicable only for private trust, private trust ci profile types.""" - country: Optional[str] = rest_field(visibility=["read"]) - """Used as C in the certificate subject name.""" - include_country: Optional[bool] = rest_field(name="includeCountry") + include_country: Optional[bool] = rest_field( + name="includeCountry", visibility=["read", "create", "update", "delete", "query"] + ) """Whether to include C in the certificate subject name. Applicable only for private trust, private trust ci profile types.""" - postal_code: Optional[str] = rest_field(name="postalCode", visibility=["read"]) - """Used as PC in the certificate subject name.""" - include_postal_code: Optional[bool] = rest_field(name="includePostalCode") + include_postal_code: Optional[bool] = rest_field( + name="includePostalCode", visibility=["read", "create", "update", "delete", "query"] + ) """Whether to include PC in the certificate subject name.""" - enhanced_key_usage: Optional[str] = rest_field(name="enhancedKeyUsage", visibility=["read"]) - """Enhanced key usage of the certificate.""" - identity_validation_id: Optional[str] = rest_field(name="identityValidationId") - """Identity validation id used for the certificate subject name.""" + identity_validation_id: str = rest_field( + name="identityValidationId", visibility=["read", "create", "update", "delete", "query"] + ) + """Identity validation id used for the certificate subject name. Required.""" provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( name="provisioningState", visibility=["read"] ) @@ -322,22 +350,22 @@ def __init__( self, *, profile_type: Union[str, "_models.ProfileType"], + identity_validation_id: str, include_street_address: Optional[bool] = None, include_city: Optional[bool] = None, include_state: Optional[bool] = None, include_country: Optional[bool] = None, include_postal_code: Optional[bool] = None, - identity_validation_id: Optional[str] = None, - ): ... + ) -> None: ... @overload - def __init__(self, mapping: Mapping[str, Any]): + def __init__(self, mapping: Mapping[str, Any]) -> None: """ :param mapping: raw JSON to initialize the model. :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) for k, v in _flattened_input.items(): @@ -368,7 +396,7 @@ class CheckNameAvailability(_model_base.Model): :vartype name: str """ - name: str = rest_field() + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Trusted signing account name. Required.""" @overload @@ -376,16 +404,16 @@ def __init__( self, *, name: str, - ): ... + ) -> None: ... @overload - def __init__(self, mapping: Mapping[str, Any]): + def __init__(self, mapping: Mapping[str, Any]) -> None: """ :param mapping: raw JSON to initialize the model. :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) @@ -425,7 +453,7 @@ class TrackedResource(Resource): :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -441,7 +469,7 @@ class TrackedResource(Resource): :vartype location: str """ - tags: Optional[Dict[str, str]] = rest_field() + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Resource tags.""" location: str = rest_field(visibility=["read", "create"]) """The geo-location where the resource lives. Required.""" @@ -452,16 +480,16 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - ): ... + ) -> None: ... @overload - def __init__(self, mapping: Mapping[str, Any]): + def __init__(self, mapping: Mapping[str, Any]) -> None: """ :param mapping: raw JSON to initialize the model. :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) @@ -472,7 +500,7 @@ class CodeSigningAccount(TrackedResource): :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -490,7 +518,9 @@ class CodeSigningAccount(TrackedResource): :vartype properties: ~azure.mgmt.trustedsigning.models.CodeSigningAccountProperties """ - properties: Optional["_models.CodeSigningAccountProperties"] = rest_field() + properties: Optional["_models.CodeSigningAccountProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The resource-specific properties for this resource.""" @overload @@ -500,16 +530,16 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, properties: Optional["_models.CodeSigningAccountProperties"] = None, - ): ... + ) -> None: ... @overload - def __init__(self, mapping: Mapping[str, Any]): + def __init__(self, mapping: Mapping[str, Any]) -> None: """ :param mapping: raw JSON to initialize the model. :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) @@ -522,9 +552,11 @@ class CodeSigningAccountPatch(_model_base.Model): :vartype properties: ~azure.mgmt.trustedsigning.models.CodeSigningAccountPatchProperties """ - tags: Optional[Dict[str, str]] = rest_field() + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Resource tags.""" - properties: Optional["_models.CodeSigningAccountPatchProperties"] = rest_field() + properties: Optional["_models.CodeSigningAccountPatchProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """Properties of the trusted signing account.""" __flattened_items = ["sku"] @@ -535,16 +567,16 @@ def __init__( *, tags: Optional[Dict[str, str]] = None, properties: Optional["_models.CodeSigningAccountPatchProperties"] = None, - ): ... + ) -> None: ... @overload - def __init__(self, mapping: Mapping[str, Any]): + def __init__(self, mapping: Mapping[str, Any]) -> None: """ :param mapping: raw JSON to initialize the model. :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) for k, v in _flattened_input.items(): @@ -570,27 +602,27 @@ class CodeSigningAccountPatchProperties(_model_base.Model): """Properties of the trusted signing account. :ivar sku: SKU of the trusted signing account. - :vartype sku: ~azure.mgmt.trustedsigning.models.AccountSku + :vartype sku: ~azure.mgmt.trustedsigning.models.AccountSkuPatch """ - sku: Optional["_models.AccountSku"] = rest_field() + sku: Optional["_models.AccountSkuPatch"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """SKU of the trusted signing account.""" @overload def __init__( self, *, - sku: Optional["_models.AccountSku"] = None, - ): ... + sku: Optional["_models.AccountSkuPatch"] = None, + ) -> None: ... @overload - def __init__(self, mapping: Mapping[str, Any]): + def __init__(self, mapping: Mapping[str, Any]) -> None: """ :param mapping: raw JSON to initialize the model. :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) @@ -610,7 +642,7 @@ class CodeSigningAccountProperties(_model_base.Model): account_uri: Optional[str] = rest_field(name="accountUri", visibility=["read"]) """The URI of the trusted signing account which is used during signing files.""" - sku: Optional["_models.AccountSku"] = rest_field() + sku: Optional["_models.AccountSku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """SKU of the trusted signing account.""" provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( name="provisioningState", visibility=["read"] @@ -623,16 +655,16 @@ def __init__( self, *, sku: Optional["_models.AccountSku"] = None, - ): ... + ) -> None: ... @overload - def __init__(self, mapping: Mapping[str, Any]): + def __init__(self, mapping: Mapping[str, Any]) -> None: """ :param mapping: raw JSON to initialize the model. :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) @@ -692,7 +724,7 @@ class ErrorResponse(_model_base.Model): :vartype error: ~azure.mgmt.trustedsigning.models.ErrorDetail """ - error: Optional["_models.ErrorDetail"] = rest_field() + error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The error object.""" @overload @@ -700,16 +732,16 @@ def __init__( self, *, error: Optional["_models.ErrorDetail"] = None, - ): ... + ) -> None: ... @overload - def __init__(self, mapping: Mapping[str, Any]): + def __init__(self, mapping: Mapping[str, Any]) -> None: """ :param mapping: raw JSON to initialize the model. :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) @@ -742,13 +774,15 @@ class Operation(_model_base.Model): is_data_action: Optional[bool] = rest_field(name="isDataAction", visibility=["read"]) """Whether the operation applies to data-plane. This is \"true\" for data-plane operations and \"false\" for Azure Resource Manager/control-plane operations.""" - display: Optional["_models.OperationDisplay"] = rest_field(visibility=["read"]) + display: Optional["_models.OperationDisplay"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """Localized display information for this particular operation.""" origin: Optional[Union[str, "_models.Origin"]] = rest_field(visibility=["read"]) """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is \"user,system\". Known values are: \"user\", \"system\", and \"user,system\".""" - action_type: Optional[Union[str, "_models.ActionType"]] = rest_field(name="actionType") + action_type: Optional[Union[str, "_models.ActionType"]] = rest_field(name="actionType", visibility=["read"]) """Extensible enum. Indicates the action type. \"Internal\" refers to actions that are for internal only APIs. \"Internal\"""" @@ -756,17 +790,17 @@ class Operation(_model_base.Model): def __init__( self, *, - action_type: Optional[Union[str, "_models.ActionType"]] = None, - ): ... + display: Optional["_models.OperationDisplay"] = None, + ) -> None: ... @overload - def __init__(self, mapping: Mapping[str, Any]): + def __init__(self, mapping: Mapping[str, Any]) -> None: """ :param mapping: raw JSON to initialize the model. :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) @@ -821,17 +855,25 @@ class Revocation(_model_base.Model): :vartype failure_reason: str """ - requested_at: Optional[datetime.datetime] = rest_field(name="requestedAt", format="rfc3339") + requested_at: Optional[datetime.datetime] = rest_field( + name="requestedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) """The timestamp when the revocation is requested.""" - effective_at: Optional[datetime.datetime] = rest_field(name="effectiveAt", format="rfc3339") + effective_at: Optional[datetime.datetime] = rest_field( + name="effectiveAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) """The timestamp when the revocation is effective.""" - reason: Optional[str] = rest_field() + reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Reason for revocation.""" - remarks: Optional[str] = rest_field() + remarks: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Remarks for the revocation.""" - status: Optional[Union[str, "_models.RevocationStatus"]] = rest_field() + status: Optional[Union[str, "_models.RevocationStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """Status of the revocation. Known values are: \"Succeeded\", \"InProgress\", and \"Failed\".""" - failure_reason: Optional[str] = rest_field(name="failureReason") + failure_reason: Optional[str] = rest_field( + name="failureReason", visibility=["read", "create", "update", "delete", "query"] + ) """Reason for the revocation failure.""" @overload @@ -844,16 +886,16 @@ def __init__( remarks: Optional[str] = None, status: Optional[Union[str, "_models.RevocationStatus"]] = None, failure_reason: Optional[str] = None, - ): ... + ) -> None: ... @overload - def __init__(self, mapping: Mapping[str, Any]): + def __init__(self, mapping: Mapping[str, Any]) -> None: """ :param mapping: raw JSON to initialize the model. :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) @@ -874,15 +916,17 @@ class RevokeCertificate(_model_base.Model): :vartype remarks: str """ - serial_number: str = rest_field(name="serialNumber") + serial_number: str = rest_field(name="serialNumber", visibility=["read", "create", "update", "delete", "query"]) """Serial number of the certificate. Required.""" - thumbprint: str = rest_field() + thumbprint: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Thumbprint of the certificate. Required.""" - effective_at: datetime.datetime = rest_field(name="effectiveAt", format="rfc3339") + effective_at: datetime.datetime = rest_field( + name="effectiveAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) """The timestamp when the revocation is effective. Required.""" - reason: str = rest_field() + reason: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Reason for the revocation. Required.""" - remarks: Optional[str] = rest_field() + remarks: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Remarks for the revocation.""" @overload @@ -894,16 +938,16 @@ def __init__( effective_at: datetime.datetime, reason: str, remarks: Optional[str] = None, - ): ... + ) -> None: ... @overload - def __init__(self, mapping: Mapping[str, Any]): + def __init__(self, mapping: Mapping[str, Any]) -> None: """ :param mapping: raw JSON to initialize the model. :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) @@ -926,19 +970,29 @@ class SystemData(_model_base.Model): :vartype last_modified_at: ~datetime.datetime """ - created_by: Optional[str] = rest_field(name="createdBy") + created_by: Optional[str] = rest_field(name="createdBy", visibility=["read", "create", "update", "delete", "query"]) """The identity that created the resource.""" - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field(name="createdByType") + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="createdByType", visibility=["read", "create", "update", "delete", "query"] + ) """The type of identity that created the resource. Known values are: \"User\", \"Application\", \"ManagedIdentity\", and \"Key\".""" - created_at: Optional[datetime.datetime] = rest_field(name="createdAt", format="rfc3339") + created_at: Optional[datetime.datetime] = rest_field( + name="createdAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) """The timestamp of resource creation (UTC).""" - last_modified_by: Optional[str] = rest_field(name="lastModifiedBy") + last_modified_by: Optional[str] = rest_field( + name="lastModifiedBy", visibility=["read", "create", "update", "delete", "query"] + ) """The identity that last modified the resource.""" - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field(name="lastModifiedByType") + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="lastModifiedByType", visibility=["read", "create", "update", "delete", "query"] + ) """The type of identity that last modified the resource. Known values are: \"User\", \"Application\", \"ManagedIdentity\", and \"Key\".""" - last_modified_at: Optional[datetime.datetime] = rest_field(name="lastModifiedAt", format="rfc3339") + last_modified_at: Optional[datetime.datetime] = rest_field( + name="lastModifiedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) """The timestamp of resource last modification (UTC).""" @overload @@ -951,14 +1005,14 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - ): ... + ) -> None: ... @overload - def __init__(self, mapping: Mapping[str, Any]): + def __init__(self, mapping: Mapping[str, Any]) -> None: """ :param mapping: raw JSON to initialize the model. :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/operations/__init__.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/operations/__init__.py index 935a86f04db..2a2e3725423 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/operations/__init__.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/operations/__init__.py @@ -5,13 +5,19 @@ # 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 ._operations import Operations -from ._operations import CodeSigningAccountsOperations -from ._operations import CertificateProfilesOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._operations import CodeSigningAccountsOperations # type: ignore +from ._operations import CertificateProfilesOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -19,5 +25,5 @@ "CodeSigningAccountsOperations", "CertificateProfilesOperations", ] -__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() diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/operations/_operations.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/operations/_operations.py index b2b4ecd8643..d6900beaee1 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/operations/_operations.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/azure/mgmt/trustedsigning/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -9,9 +9,10 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -32,13 +33,14 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._model_base import SdkJSONEncoder, _deserialize -from .._serialization import Serializer +from .._configuration import TrustedSigningMgmtClientConfiguration +from .._model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from .._serialization import Deserializer, Serializer if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object @@ -51,7 +53,7 @@ def build_operations_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-05-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-30-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,11 +74,11 @@ def build_code_signing_accounts_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-05-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-30-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -101,11 +103,11 @@ def build_code_signing_accounts_create_request( # pylint: disable=name-too-long _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-05-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-30-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -132,11 +134,11 @@ def build_code_signing_accounts_update_request( # pylint: disable=name-too-long _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-05-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-30-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -162,11 +164,11 @@ def build_code_signing_accounts_delete_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-05-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-30-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -190,11 +192,11 @@ def build_code_signing_accounts_list_by_resource_group_request( # pylint: disab _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-05-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-30-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -217,7 +219,7 @@ def build_code_signing_accounts_list_by_subscription_request( # pylint: disable _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-05-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-30-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -244,7 +246,7 @@ def build_code_signing_accounts_check_name_availability_request( # pylint: disa _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-05-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-30-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -272,11 +274,11 @@ def build_certificate_profiles_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-05-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-30-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -302,11 +304,11 @@ def build_certificate_profiles_create_request( # pylint: disable=name-too-long _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-05-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-30-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -333,11 +335,11 @@ def build_certificate_profiles_delete_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-05-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-30-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -362,11 +364,11 @@ def build_certificate_profiles_list_by_code_signing_account_request( # pylint: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-05-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-30-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -391,11 +393,11 @@ def build_certificate_profiles_revoke_certificate_request( # pylint: disable=na _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-05-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-30-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}/revokeCertificate" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}/revokeCertificate" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -428,10 +430,10 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: TrustedSigningMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -446,7 +448,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -509,7 +511,7 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -529,10 +531,10 @@ class CodeSigningAccountsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: TrustedSigningMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.CodeSigningAccount: @@ -547,7 +549,7 @@ def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _mo :rtype: ~azure.mgmt.trustedsigning.models.CodeSigningAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -587,7 +589,7 @@ def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _mo except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -607,7 +609,7 @@ def _create_initial( resource: Union[_models.CodeSigningAccount, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -656,7 +658,7 @@ def _create_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -836,7 +838,7 @@ def _update_initial( properties: Union[_models.CodeSigningAccountPatch, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -885,7 +887,7 @@ def _update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1061,7 +1063,7 @@ def get_long_running_output(pipeline_response): ) def _delete_initial(self, resource_group_name: str, account_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1100,7 +1102,7 @@ def _delete_initial(self, resource_group_name: str, account_name: str, **kwargs: except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1188,7 +1190,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite cls: ClsType[List[_models.CodeSigningAccount]] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1253,7 +1255,7 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1273,7 +1275,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.CodeSigningAc cls: ClsType[List[_models.CodeSigningAccount]] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1337,7 +1339,7 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1409,7 +1411,7 @@ def check_name_availability( :rtype: ~azure.mgmt.trustedsigning.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1457,7 +1459,7 @@ def check_name_availability( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -1483,10 +1485,10 @@ class CertificateProfilesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: TrustedSigningMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( @@ -1505,7 +1507,7 @@ def get( :rtype: ~azure.mgmt.trustedsigning.models.CertificateProfile :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1546,7 +1548,7 @@ def get( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -1567,7 +1569,7 @@ def _create_initial( resource: Union[_models.CertificateProfile, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1617,7 +1619,7 @@ def _create_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1806,7 +1808,7 @@ def get_long_running_output(pipeline_response): def _delete_initial( self, resource_group_name: str, account_name: str, profile_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1846,7 +1848,7 @@ def _delete_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1943,7 +1945,7 @@ def list_by_code_signing_account( cls: ClsType[List[_models.CertificateProfile]] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2009,7 +2011,7 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -2017,7 +2019,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @overload - def revoke_certificate( # pylint: disable=inconsistent-return-statements + def revoke_certificate( self, resource_group_name: str, account_name: str, @@ -2047,7 +2049,7 @@ def revoke_certificate( # pylint: disable=inconsistent-return-statements """ @overload - def revoke_certificate( # pylint: disable=inconsistent-return-statements + def revoke_certificate( self, resource_group_name: str, account_name: str, @@ -2077,7 +2079,7 @@ def revoke_certificate( # pylint: disable=inconsistent-return-statements """ @overload - def revoke_certificate( # pylint: disable=inconsistent-return-statements + def revoke_certificate( self, resource_group_name: str, account_name: str, @@ -2131,7 +2133,7 @@ def revoke_certificate( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2177,7 +2179,7 @@ def revoke_certificate( # pylint: disable=inconsistent-return-statements if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/certificate_profiles_create.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/certificate_profiles_create.py index 452f46c609b..0aacf102c0d 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/certificate_profiles_create.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/certificate_profiles_create.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: 2024-02-05-preview/CertificateProfiles_Create.json +# x-ms-original-file: 2024-09-30-preview/CertificateProfiles_Create.json if __name__ == "__main__": main() diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/certificate_profiles_delete.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/certificate_profiles_delete.py index 5bcb4e7ac48..aa89b0a989a 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/certificate_profiles_delete.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/certificate_profiles_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: 2024-02-05-preview/CertificateProfiles_Delete.json +# x-ms-original-file: 2024-09-30-preview/CertificateProfiles_Delete.json if __name__ == "__main__": main() diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/certificate_profiles_get.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/certificate_profiles_get.py index 0095591c96f..89e3a9d0379 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/certificate_profiles_get.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/certificate_profiles_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2024-02-05-preview/CertificateProfiles_Get.json +# x-ms-original-file: 2024-09-30-preview/CertificateProfiles_Get.json if __name__ == "__main__": main() diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/certificate_profiles_list_by_code_signing_account.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/certificate_profiles_list_by_code_signing_account.py index 823435168cd..ba62e0d3a6f 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/certificate_profiles_list_by_code_signing_account.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/certificate_profiles_list_by_code_signing_account.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: 2024-02-05-preview/CertificateProfiles_ListByCodeSigningAccount.json +# x-ms-original-file: 2024-09-30-preview/CertificateProfiles_ListByCodeSigningAccount.json if __name__ == "__main__": main() diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/certificate_profiles_revoke_certificate.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/certificate_profiles_revoke_certificate.py index c107c8a0f78..bf15f0ca384 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/certificate_profiles_revoke_certificate.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/certificate_profiles_revoke_certificate.py @@ -44,6 +44,6 @@ def main(): ) -# x-ms-original-file: 2024-02-05-preview/CertificateProfiles_RevokeCertificate.json +# x-ms-original-file: 2024-09-30-preview/CertificateProfiles_RevokeCertificate.json if __name__ == "__main__": main() diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/code_signing_accounts_check_name_availability.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/code_signing_accounts_check_name_availability.py index 550c3cc0d81..e07b71ed6f6 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/code_signing_accounts_check_name_availability.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/code_signing_accounts_check_name_availability.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: 2024-02-05-preview/CodeSigningAccounts_CheckNameAvailability.json +# x-ms-original-file: 2024-09-30-preview/CodeSigningAccounts_CheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/code_signing_accounts_create.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/code_signing_accounts_create.py index d6893a99986..e654a663b3c 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/code_signing_accounts_create.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/code_signing_accounts_create.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2024-02-05-preview/CodeSigningAccounts_Create.json +# x-ms-original-file: 2024-09-30-preview/CodeSigningAccounts_Create.json if __name__ == "__main__": main() diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/code_signing_accounts_delete.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/code_signing_accounts_delete.py index feea1b78a65..3e540a7d2b0 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/code_signing_accounts_delete.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/code_signing_accounts_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: 2024-02-05-preview/CodeSigningAccounts_Delete.json +# x-ms-original-file: 2024-09-30-preview/CodeSigningAccounts_Delete.json if __name__ == "__main__": main() diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/code_signing_accounts_get.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/code_signing_accounts_get.py index 9bb3b124c18..86f7988902f 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/code_signing_accounts_get.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/code_signing_accounts_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2024-02-05-preview/CodeSigningAccounts_Get.json +# x-ms-original-file: 2024-09-30-preview/CodeSigningAccounts_Get.json if __name__ == "__main__": main() diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/code_signing_accounts_list_by_resource_group.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/code_signing_accounts_list_by_resource_group.py index f9980b3f150..49ed87c4c1b 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/code_signing_accounts_list_by_resource_group.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/code_signing_accounts_list_by_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: 2024-02-05-preview/CodeSigningAccounts_ListByResourceGroup.json +# x-ms-original-file: 2024-09-30-preview/CodeSigningAccounts_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/code_signing_accounts_list_by_subscription.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/code_signing_accounts_list_by_subscription.py index 6be993764b5..415a3ab29ad 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/code_signing_accounts_list_by_subscription.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/code_signing_accounts_list_by_subscription.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: 2024-02-05-preview/CodeSigningAccounts_ListBySubscription.json +# x-ms-original-file: 2024-09-30-preview/CodeSigningAccounts_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/code_signing_accounts_update.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/code_signing_accounts_update.py index 59c51a2706b..07bc5a9297a 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/code_signing_accounts_update.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/code_signing_accounts_update.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2024-02-05-preview/CodeSigningAccounts_Update.json +# x-ms-original-file: 2024-09-30-preview/CodeSigningAccounts_Update.json if __name__ == "__main__": main() diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/operations_list.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/operations_list.py index 0a3aa8c103c..faeaf74087b 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/operations_list.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_samples/operations_list.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: 2024-02-05-preview/Operations_List.json +# x-ms-original-file: 2024-09-30-preview/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_tests/test_trusted_signing_mgmt_certificate_profiles_operations.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_tests/test_trusted_signing_mgmt_certificate_profiles_operations.py index ff713fa8d97..dabdfc944a4 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_tests/test_trusted_signing_mgmt_certificate_profiles_operations.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_tests/test_trusted_signing_mgmt_certificate_profiles_operations.py @@ -41,10 +41,12 @@ def test_certificate_profiles_begin_create(self, resource_group): "id": "str", "name": "str", "properties": { + "identityValidationId": "str", "profileType": "str", "certificates": [ { "createdDate": "str", + "enhancedKeyUsage": "str", "expiryDate": "str", "revocation": { "effectiveAt": "2020-02-20 00:00:00", @@ -60,23 +62,13 @@ def test_certificate_profiles_begin_create(self, resource_group): "thumbprint": "str", } ], - "city": "str", - "commonName": "str", - "country": "str", - "enhancedKeyUsage": "str", - "identityValidationId": "str", "includeCity": bool, "includeCountry": bool, "includePostalCode": bool, "includeState": bool, "includeStreetAddress": bool, - "organization": "str", - "organizationUnit": "str", - "postalCode": "str", "provisioningState": "str", - "state": "str", "status": "str", - "streetAddress": "str", }, "systemData": { "createdAt": "2020-02-20 00:00:00", diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_tests/test_trusted_signing_mgmt_certificate_profiles_operations_async.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_tests/test_trusted_signing_mgmt_certificate_profiles_operations_async.py index c2294933667..b00ef3d2f86 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_tests/test_trusted_signing_mgmt_certificate_profiles_operations_async.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/generated_tests/test_trusted_signing_mgmt_certificate_profiles_operations_async.py @@ -43,10 +43,12 @@ async def test_certificate_profiles_begin_create(self, resource_group): "id": "str", "name": "str", "properties": { + "identityValidationId": "str", "profileType": "str", "certificates": [ { "createdDate": "str", + "enhancedKeyUsage": "str", "expiryDate": "str", "revocation": { "effectiveAt": "2020-02-20 00:00:00", @@ -62,23 +64,13 @@ async def test_certificate_profiles_begin_create(self, resource_group): "thumbprint": "str", } ], - "city": "str", - "commonName": "str", - "country": "str", - "enhancedKeyUsage": "str", - "identityValidationId": "str", "includeCity": bool, "includeCountry": bool, "includePostalCode": bool, "includeState": bool, "includeStreetAddress": bool, - "organization": "str", - "organizationUnit": "str", - "postalCode": "str", "provisioningState": "str", - "state": "str", "status": "str", - "streetAddress": "str", }, "systemData": { "createdAt": "2020-02-20 00:00:00", diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/tests/test_trusted_signing_mgmt_code_signing_accounts_operations_async_test.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/tests/test_trusted_signing_mgmt_code_signing_accounts_operations_async_test.py index cf1fc68ae9d..bc951803a0a 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/tests/test_trusted_signing_mgmt_code_signing_accounts_operations_async_test.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/tests/test_trusted_signing_mgmt_code_signing_accounts_operations_async_test.py @@ -27,7 +27,6 @@ async def test_code_signing_accounts_list_by_resource_group(self, resource_group ) result = [r async for r in response] assert result == [] - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/tests/test_trusted_signing_mgmt_code_signing_accounts_operations_test.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/tests/test_trusted_signing_mgmt_code_signing_accounts_operations_test.py index c43053671d3..208341a6b20 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/tests/test_trusted_signing_mgmt_code_signing_accounts_operations_test.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/tests/test_trusted_signing_mgmt_code_signing_accounts_operations_test.py @@ -26,7 +26,6 @@ def test_code_signing_accounts_list_by_resource_group(self, resource_group): ) result = [r for r in response] assert result == [] - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -34,4 +33,3 @@ def test_code_signing_accounts_list_by_subscription(self, resource_group): response = self.client.code_signing_accounts.list_by_subscription() result = [r for r in response] assert response - \ No newline at end of file diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/tests/test_trusted_signing_mgmt_operations_async_test.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/tests/test_trusted_signing_mgmt_operations_async_test.py index 9a1e504e192..3c2ea6c7a82 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/tests/test_trusted_signing_mgmt_operations_async_test.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/tests/test_trusted_signing_mgmt_operations_async_test.py @@ -25,4 +25,3 @@ async def test_operations_list(self, resource_group): response = self.client.operations.list() result = [r async for r in response] assert result - diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/tests/test_trusted_signing_mgmt_operations_test.py b/sdk/trustedsigning/azure-mgmt-trustedsigning/tests/test_trusted_signing_mgmt_operations_test.py index da6e33b7236..d70823986d3 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/tests/test_trusted_signing_mgmt_operations_test.py +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/tests/test_trusted_signing_mgmt_operations_test.py @@ -24,4 +24,3 @@ def test_operations_list(self, resource_group): response = self.client.operations.list() result = [r for r in response] assert result - diff --git a/sdk/trustedsigning/azure-mgmt-trustedsigning/tsp-location.yaml b/sdk/trustedsigning/azure-mgmt-trustedsigning/tsp-location.yaml index 5b1fd4dd213..b33afb65df4 100644 --- a/sdk/trustedsigning/azure-mgmt-trustedsigning/tsp-location.yaml +++ b/sdk/trustedsigning/azure-mgmt-trustedsigning/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/codesigning/CodeSigning.Management -commit: e6fde2ac19d0202f0e72217a3e0f9edb63dba273 +commit: 676334a284e5136f0a0721d6ae844bb04332f579 repo: Azure/azure-rest-api-specs additionalDirectories: