Skip to content

Commit

Permalink
[Key Vault] Generate Secrets code for 7.6-preview.1, add basic support (
Browse files Browse the repository at this point in the history
Azure#35467)

* Regen on 8af9817

* Support new version; update metadata

* Update tests, recordings
  • Loading branch information
mccoyp authored May 9, 2024
1 parent e0f0a8c commit 8c0e3cd
Show file tree
Hide file tree
Showing 15 changed files with 148 additions and 155 deletions.
4 changes: 3 additions & 1 deletion sdk/keyvault/azure-keyvault-secrets/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Release History

## 4.8.1 (Unreleased)
## 4.9.0b1 (Unreleased)

### Features Added
- Added support for service API version `7.6-preview.1`

### Breaking Changes

Expand All @@ -11,6 +12,7 @@
([#34744](https://github.com/Azure/azure-sdk-for-python/issues/34744))

### Other Changes
- Key Vault API version `7.6-preview.1` is now the default

## 4.8.0 (2024-02-22)

Expand Down
2 changes: 1 addition & 1 deletion sdk/keyvault/azure-keyvault-secrets/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "python",
"TagPrefix": "python/keyvault/azure-keyvault-secrets",
"Tag": "python/keyvault/azure-keyvault-secrets_e959803e9e"
"Tag": "python/keyvault/azure-keyvault-secrets_ffad208c83"
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-a
"""The key vault client performs cryptographic key operations and vault operations against the Key
Vault service.
:keyword api_version: Api Version. Default value is "7.5". Note that overriding this default
value may result in unsupported behavior.
:keyword api_version: Api Version. Default value is "7.6-preview.1". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ class KeyVaultClientConfiguration: # pylint: disable=too-many-instance-attribut
Note that all parameters used to create this instance are saved as instance
attributes.
:keyword api_version: Api Version. Default value is "7.5". Note that overriding this default
value may result in unsupported behavior.
:keyword api_version: Api Version. Default value is "7.6-preview.1". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(self, **kwargs: Any) -> None:
api_version: str = kwargs.pop("api_version", "7.5")
api_version: str = kwargs.pop("api_version", "7.6-preview.1")

self.api_version = api_version
kwargs.setdefault("sdk_moniker", "keyvault/{}".format(VERSION))
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]],
return None


try:
basestring # type: ignore
unicode_str = unicode # type: ignore
except NameError:
basestring = str
unicode_str = str

_LOGGER = logging.getLogger(__name__)

try:
Expand Down Expand Up @@ -545,7 +538,7 @@ class Serializer(object):
"multiple": lambda x, y: x % y != 0,
}

def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None):
def __init__(self, classes: Optional[Mapping[str, type]] = None):
self.serialize_type = {
"iso-8601": Serializer.serialize_iso,
"rfc-1123": Serializer.serialize_rfc,
Expand All @@ -561,7 +554,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None):
"[]": self.serialize_iter,
"{}": self.serialize_dict,
}
self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {}
self.dependencies: Dict[str, type] = dict(classes) if classes else {}
self.key_transformer = full_restapi_key_transformer
self.client_side_validation = True

Expand Down Expand Up @@ -649,7 +642,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
else: # That's a basic type
# Integrate namespace if necessary
local_node = _create_xml_node(xml_name, xml_prefix, xml_ns)
local_node.text = unicode_str(new_attr)
local_node.text = str(new_attr)
serialized.append(local_node) # type: ignore
else: # JSON
for k in reversed(keys): # type: ignore
Expand Down Expand Up @@ -994,7 +987,7 @@ def serialize_object(self, attr, **kwargs):
return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs)
if obj_type is _long_type:
return self.serialize_long(attr)
if obj_type is unicode_str:
if obj_type is str:
return self.serialize_unicode(attr)
if obj_type is datetime.datetime:
return self.serialize_iso(attr)
Expand Down Expand Up @@ -1370,7 +1363,7 @@ class Deserializer(object):

valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?")

def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None):
def __init__(self, classes: Optional[Mapping[str, type]] = None):
self.deserialize_type = {
"iso-8601": Deserializer.deserialize_iso,
"rfc-1123": Deserializer.deserialize_rfc,
Expand All @@ -1390,7 +1383,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None):
"duration": (isodate.Duration, datetime.timedelta),
"iso-8601": (datetime.datetime),
}
self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {}
self.dependencies: Dict[str, type] = dict(classes) if classes else {}
self.key_extractors = [rest_key_extractor, xml_key_extractor]
# Additional properties only works if the "rest_key_extractor" is used to
# extract the keys. Making it to work whatever the key extractor is too much
Expand Down Expand Up @@ -1443,7 +1436,7 @@ def _deserialize(self, target_obj, data):

response, class_name = self._classify_target(target_obj, data)

if isinstance(response, basestring):
if isinstance(response, str):
return self.deserialize_data(data, response)
elif isinstance(response, type) and issubclass(response, Enum):
return self.deserialize_enum(data, response)
Expand Down Expand Up @@ -1514,14 +1507,14 @@ def _classify_target(self, target, data):
if target is None:
return None, None

if isinstance(target, basestring):
if isinstance(target, str):
try:
target = self.dependencies[target]
except KeyError:
return target, target

try:
target = target._classify(data, self.dependencies)
target = target._classify(data, self.dependencies) # type: ignore
except AttributeError:
pass # Target is not a Model, no classify
return target, target.__class__.__name__ # type: ignore
Expand Down Expand Up @@ -1577,7 +1570,7 @@ def _unpack_content(raw_data, content_type=None):
if hasattr(raw_data, "_content_consumed"):
return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers)

if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"):
if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"):
return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore
return raw_data

Expand Down Expand Up @@ -1699,7 +1692,7 @@ def deserialize_object(self, attr, **kwargs):
if isinstance(attr, ET.Element):
# Do no recurse on XML, just return the tree as-is
return attr
if isinstance(attr, basestring):
if isinstance(attr, str):
return self.deserialize_basic(attr, "str")
obj_type = type(attr)
if obj_type in self.basic_types:
Expand Down Expand Up @@ -1756,7 +1749,7 @@ def deserialize_basic(self, attr, data_type):
if data_type == "bool":
if attr in [True, False, 1, 0]:
return bool(attr)
elif isinstance(attr, basestring):
elif isinstance(attr, str):
if attr.lower() in ["true", "1"]:
return True
elif attr.lower() in ["false", "0"]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-a
"""The key vault client performs cryptographic key operations and vault operations against the Key
Vault service.
:keyword api_version: Api Version. Default value is "7.5". Note that overriding this default
value may result in unsupported behavior.
:keyword api_version: Api Version. Default value is "7.6-preview.1". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ class KeyVaultClientConfiguration: # pylint: disable=too-many-instance-attribut
Note that all parameters used to create this instance are saved as instance
attributes.
:keyword api_version: Api Version. Default value is "7.5". Note that overriding this default
value may result in unsupported behavior.
:keyword api_version: Api Version. Default value is "7.6-preview.1". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(self, **kwargs: Any) -> None:
api_version: str = kwargs.pop("api_version", "7.5")
api_version: str = kwargs.pop("api_version", "7.6-preview.1")

self.api_version = api_version
kwargs.setdefault("sdk_moniker", "keyvault/{}".format(VERSION))
Expand Down
Loading

0 comments on commit 8c0e3cd

Please sign in to comment.