Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Release History

## 14.0.0 (2026-03-07)

### Features Added

- Enum `CertificatePermissions` added member `IMPORTEnum`
- Enum `JsonWebKeyOperation` added member `IMPORTEnum`
- Enum `KeyPermissions` added member `IMPORTEnum`

### Breaking Changes

- Deleted or renamed enum value `CertificatePermissions.IMPORT`
- Deleted or renamed enum value `JsonWebKeyOperation.IMPORT`
- Deleted or renamed enum value `KeyPermissions.IMPORT`
- Deleted or renamed model `ManagedHsmResource`

## 13.0.0 (2025-12-11)

### Features Added
Expand Down
9 changes: 6 additions & 3 deletions sdk/keyvault/azure-mgmt-keyvault/_metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"apiVersion": "2025-05-01",
"commit": "74db5e79837425a7723e81bca0b7576ab725c186",
"apiVersion": "2026-02-01",
"apiVersions": {
"Microsoft.KeyVault": "2026-02-01"
},
"commit": "74cc90c49189a079b3cc93fde9c9ad76742f0184",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"typespec_src": "specification/keyvault/KeyVault.Management",
"emitterVersion": "0.55.0"
"emitterVersion": "0.60.2"
}
3 changes: 1 addition & 2 deletions sdk/keyvault/azure-mgmt-keyvault/apiview-properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"azure.mgmt.keyvault.models.ManagedHsmKeyRotationPolicyAttributes": "Microsoft.KeyVault.ManagedHsmKeyRotationPolicyAttributes",
"azure.mgmt.keyvault.models.ManagedHsmLifetimeAction": "Microsoft.KeyVault.ManagedHsmLifetimeAction",
"azure.mgmt.keyvault.models.ManagedHsmProperties": "Microsoft.KeyVault.ManagedHsmProperties",
"azure.mgmt.keyvault.models.ManagedHsmResource": "Microsoft.KeyVault.ManagedHsmResource",
"azure.mgmt.keyvault.models.ManagedHsmRotationPolicy": "Microsoft.KeyVault.ManagedHsmRotationPolicy",
"azure.mgmt.keyvault.models.ManagedHSMSecurityDomainProperties": "Microsoft.KeyVault.ManagedHSMSecurityDomainProperties",
"azure.mgmt.keyvault.models.ManagedHsmSku": "Microsoft.KeyVault.ManagedHsmSku",
Expand All @@ -51,6 +50,7 @@
"azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection": "Microsoft.KeyVault.MhsmPrivateEndpointConnection",
"azure.mgmt.keyvault.models.MHSMPrivateEndpointConnectionItem": "Microsoft.KeyVault.MhsmPrivateEndpointConnectionItem",
"azure.mgmt.keyvault.models.MHSMPrivateEndpointConnectionProperties": "Microsoft.KeyVault.MhsmPrivateEndpointConnectionProperties",
"azure.mgmt.keyvault.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource",
"azure.mgmt.keyvault.models.MHSMPrivateLinkResource": "Microsoft.KeyVault.MhsmPrivateLinkResource",
"azure.mgmt.keyvault.models.MHSMPrivateLinkResourceListResult": "Microsoft.KeyVault.MhsmPrivateLinkResourceListResult",
"azure.mgmt.keyvault.models.MHSMPrivateLinkResourceProperties": "Microsoft.KeyVault.MhsmPrivateLinkResourceProperties",
Expand Down Expand Up @@ -80,7 +80,6 @@
"azure.mgmt.keyvault.models.ServiceSpecification": "Microsoft.KeyVault.ServiceSpecification",
"azure.mgmt.keyvault.models.Sku": "Microsoft.KeyVault.Sku",
"azure.mgmt.keyvault.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData",
"azure.mgmt.keyvault.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource",
"azure.mgmt.keyvault.models.Trigger": "Microsoft.KeyVault.Trigger",
"azure.mgmt.keyvault.models.UserAssignedIdentity": "Azure.ResourceManager.CommonTypes.UserAssignedIdentity",
"azure.mgmt.keyvault.models.Vault": "Microsoft.KeyVault.Vault",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ class KeyVaultManagementClient: # pylint: disable=too-many-instance-attributes
:keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is
None.
:paramtype cloud_setting: ~azure.core.AzureClouds
:keyword api_version: The API version to use for this operation. Default value is "2025-05-01".
Note that overriding this default value may result in unsupported behavior.
:keyword api_version: The API version to use for this operation. Known values are "2026-02-01"
and None. Default value is "2026-02-01". Note that overriding this default value may result in
unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ class KeyVaultManagementClientConfiguration: # pylint: disable=too-many-instanc
:param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is
None.
:type cloud_setting: ~azure.core.AzureClouds
:keyword api_version: The API version to use for this operation. Default value is "2025-05-01".
Note that overriding this default value may result in unsupported behavior.
:keyword api_version: The API version to use for this operation. Known values are "2026-02-01"
and None. Default value is "2026-02-01". Note that overriding this default value may result in
unsupported behavior.
:paramtype api_version: str
"""

Expand All @@ -46,7 +47,7 @@ def __init__(
cloud_setting: Optional["AzureClouds"] = None,
**kwargs: Any
) -> None:
api_version: str = kwargs.pop("api_version", "2025-05-01")
api_version: str = kwargs.pop("api_version", "2026-02-01")

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

TZ_UTC = timezone.utc
_T = typing.TypeVar("_T")
_NONE_TYPE = type(None)


def _timedelta_as_isostr(td: timedelta) -> str:
Expand Down Expand Up @@ -171,6 +172,21 @@ def default(self, o): # pylint: disable=too-many-return-statements
r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT"
)

_ARRAY_ENCODE_MAPPING = {
"pipeDelimited": "|",
"spaceDelimited": " ",
"commaDelimited": ",",
"newlineDelimited": "\n",
}


def _deserialize_array_encoded(delimit: str, attr):
if isinstance(attr, str):
if attr == "":
return []
return attr.split(delimit)
return attr


def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime:
"""Deserialize ISO-8601 formatted string into Datetime object.
Expand Down Expand Up @@ -202,7 +218,7 @@ def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime:
test_utc = date_obj.utctimetuple()
if test_utc.tm_year > 9999 or test_utc.tm_year < 1:
raise OverflowError("Hit max or min date")
return date_obj
return date_obj # type: ignore[no-any-return]


def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime:
Expand Down Expand Up @@ -256,7 +272,7 @@ def _deserialize_time(attr: typing.Union[str, time]) -> time:
"""
if isinstance(attr, time):
return attr
return isodate.parse_time(attr)
return isodate.parse_time(attr) # type: ignore[no-any-return]


def _deserialize_bytes(attr):
Expand Down Expand Up @@ -315,6 +331,8 @@ def _deserialize_int_as_str(attr):
def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None):
if annotation is int and rf and rf._format == "str":
return _deserialize_int_as_str
if annotation is str and rf and rf._format in _ARRAY_ENCODE_MAPPING:
return functools.partial(_deserialize_array_encoded, _ARRAY_ENCODE_MAPPING[rf._format])
if rf and rf._format:
return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format)
return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore
Expand Down Expand Up @@ -353,9 +371,39 @@ def __contains__(self, key: typing.Any) -> bool:
return key in self._data

def __getitem__(self, key: str) -> typing.Any:
# If this key has been deserialized (for mutable types), we need to handle serialization
if hasattr(self, "_attr_to_rest_field"):
cache_attr = f"_deserialized_{key}"
if hasattr(self, cache_attr):
rf = _get_rest_field(getattr(self, "_attr_to_rest_field"), key)
if rf:
value = self._data.get(key)
if isinstance(value, (dict, list, set)):
# For mutable types, serialize and return
# But also update _data with serialized form and clear flag
# so mutations via this returned value affect _data
serialized = _serialize(value, rf._format)
# If serialized form is same type (no transformation needed),
# return _data directly so mutations work
if isinstance(serialized, type(value)) and serialized == value:
return self._data.get(key)
# Otherwise return serialized copy and clear flag
try:
object.__delattr__(self, cache_attr)
except AttributeError:
pass
# Store serialized form back
self._data[key] = serialized
return serialized
return self._data.__getitem__(key)

def __setitem__(self, key: str, value: typing.Any) -> None:
# Clear any cached deserialized value when setting through dictionary access
cache_attr = f"_deserialized_{key}"
try:
object.__delattr__(self, cache_attr)
except AttributeError:
pass
self._data.__setitem__(key, value)

def __delitem__(self, key: str) -> None:
Expand Down Expand Up @@ -467,6 +515,8 @@ def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any:
return self._data.setdefault(key, default)

def __eq__(self, other: typing.Any) -> bool:
if isinstance(other, _MyMutableMapping):
return self._data == other._data
try:
other_model = self.__class__(other)
except Exception:
Expand All @@ -483,6 +533,8 @@ def _is_model(obj: typing.Any) -> bool:

def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements
if isinstance(o, list):
if format in _ARRAY_ENCODE_MAPPING and all(isinstance(x, str) for x in o):
return _ARRAY_ENCODE_MAPPING[format].join(o)
return [_serialize(x, format) for x in o]
if isinstance(o, dict):
return {k: _serialize(v, format) for k, v in o.items()}
Expand Down Expand Up @@ -772,6 +824,14 @@ def _deserialize_multiple_sequence(
return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers))


def _is_array_encoded_deserializer(deserializer: functools.partial) -> bool:
return (
isinstance(deserializer, functools.partial)
and isinstance(deserializer.args[0], functools.partial)
and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable
)


def _deserialize_sequence(
deserializer: typing.Optional[typing.Callable],
module: typing.Optional[str],
Expand All @@ -781,6 +841,19 @@ def _deserialize_sequence(
return obj
if isinstance(obj, ET.Element):
obj = list(obj)

# encoded string may be deserialized to sequence
if isinstance(obj, str) and isinstance(deserializer, functools.partial):
# for list[str]
if _is_array_encoded_deserializer(deserializer):
return deserializer(obj)

# for list[Union[...]]
if isinstance(deserializer.args[0], list):
for sub_deserializer in deserializer.args[0]:
if _is_array_encoded_deserializer(sub_deserializer):
return sub_deserializer(obj)

return type(obj)(_deserialize(deserializer, entry, module) for entry in obj)


Expand Down Expand Up @@ -831,16 +904,16 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur

# is it optional?
try:
if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore
if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore
if len(annotation.__args__) <= 2: # pyright: ignore
if_obj_deserializer = _get_deserialize_callable_from_annotation(
next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore
next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore
)

return functools.partial(_deserialize_with_optional, if_obj_deserializer)
# the type is Optional[Union[...]], we need to remove the None type from the Union
annotation_copy = copy.copy(annotation)
annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore
annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a is not _NONE_TYPE] # pyright: ignore
return _get_deserialize_callable_from_annotation(annotation_copy, module, rf)
except AttributeError:
pass
Expand Down Expand Up @@ -924,16 +997,20 @@ def _deserialize_with_callable(
return float(value.text) if value.text else None
if deserializer is bool:
return value.text == "true" if value.text else None
if deserializer and deserializer in _DESERIALIZE_MAPPING.values():
return deserializer(value.text) if value.text else None
if deserializer and deserializer in _DESERIALIZE_MAPPING_WITHFORMAT.values():
return deserializer(value.text) if value.text else None
if deserializer is None:
return value
if deserializer in [int, float, bool]:
return deserializer(value)
if isinstance(deserializer, CaseInsensitiveEnumMeta):
try:
return deserializer(value)
return deserializer(value.text if isinstance(value, ET.Element) else value)
except ValueError:
# for unknown value, return raw value
return value
return value.text if isinstance(value, ET.Element) else value
if isinstance(deserializer, type) and issubclass(deserializer, Model):
return deserializer._deserialize(value, [])
return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value)
Expand Down Expand Up @@ -966,7 +1043,7 @@ def _failsafe_deserialize(
) -> typing.Any:
try:
return _deserialize(deserializer, response.json(), module, rf, format)
except DeserializationError:
except Exception: # pylint: disable=broad-except
_LOGGER.warning(
"Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True
)
Expand All @@ -979,7 +1056,7 @@ def _failsafe_deserialize_xml(
) -> typing.Any:
try:
return _deserialize_xml(deserializer, response.text())
except DeserializationError:
except Exception: # pylint: disable=broad-except
_LOGGER.warning(
"Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True
)
Expand Down Expand Up @@ -1030,14 +1107,37 @@ def _rest_name(self) -> str:
def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin
# by this point, type and rest_name will have a value bc we default
# them in __new__ of the Model class
item = obj.get(self._rest_name)
# Use _data.get() directly to avoid triggering __getitem__ which clears the cache
item = obj._data.get(self._rest_name)
if item is None:
return item
if self._is_model:
return item
return _deserialize(self._type, _serialize(item, self._format), rf=self)

# For mutable types, we want mutations to directly affect _data
# Check if we've already deserialized this value
cache_attr = f"_deserialized_{self._rest_name}"
if hasattr(obj, cache_attr):
# Return the value from _data directly (it's been deserialized in place)
return obj._data.get(self._rest_name)

deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self)

# For mutable types, store the deserialized value back in _data
# so mutations directly affect _data
if isinstance(deserialized, (dict, list, set)):
obj._data[self._rest_name] = deserialized
object.__setattr__(obj, cache_attr, True) # Mark as deserialized
return deserialized

return deserialized

def __set__(self, obj: Model, value) -> None:
# Clear the cached deserialized object when setting a new value
cache_attr = f"_deserialized_{self._rest_name}"
if hasattr(obj, cache_attr):
object.__delattr__(obj, cache_attr)

if value is None:
# we want to wipe out entries if users set attr to None
try:
Expand Down Expand Up @@ -1207,7 +1307,7 @@ def _get_wrapped_element(
_get_element(v, exclude_readonly, meta, wrapped_element)
else:
wrapped_element.text = _get_primitive_type_value(v)
return wrapped_element
return wrapped_element # type: ignore[no-any-return]


def _get_primitive_type_value(v) -> str:
Expand All @@ -1220,7 +1320,9 @@ def _get_primitive_type_value(v) -> str:
return str(v)


def _create_xml_element(tag, prefix=None, ns=None):
def _create_xml_element(
tag: typing.Any, prefix: typing.Optional[str] = None, ns: typing.Optional[str] = None
) -> ET.Element:
if prefix and ns:
ET.register_namespace(prefix, ns)
if ns:
Expand Down
Loading
Loading