Skip to content

Commit

Permalink
CodeGen from PR 24475 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 26f65e63ddd7740b3ca09944e3cb8a14da682a6a into eaaa0d77e4033ebf60e7dd77eec56f4160b95cf4
  • Loading branch information
SDKAuto committed Aug 23, 2023
1 parent 11a6c8f commit c2de14a
Show file tree
Hide file tree
Showing 193 changed files with 2,012 additions and 1,344 deletions.
21 changes: 15 additions & 6 deletions sdk/keyvault/azure-mgmt-keyvault/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
{
"commit": "3c2bb08d44536eecec0a8624587776a05692031c",
"commit": "4c799d900652a9cdaf2225c4ee3507ebf326db87",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.2",
"autorest": "3.9.7",
"use": [
"@autorest/python@6.4.12",
"@autorest/modelerfour@4.24.3"
"@autorest/python@6.7.1",
"@autorest/modelerfour@4.26.2"
],
"autorest_command": "autorest specification/keyvault/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.9.2 --version-tolerant=False",
"readme": "specification/keyvault/resource-manager/readme.md"
"autorest_command": "autorest specification/keyvault/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.9.7 --version-tolerant=False",
"readme": "specification/keyvault/resource-manager/readme.md",
"package-2019-09": "2021-07-15 01:23:27 -0700 4fe5435a25386ee460ba89817465c7deba818284 Microsoft.KeyVault/stable/2019-09-01/keyvault.json",
"package-2018-02": "2020-11-03 15:27:00 -0500 111dab2fbec96b208a78b36bb8dcefd958036476 Microsoft.KeyVault/preview/2018-02-14-preview/keyvault.json",
"package-2016-10": "2020-11-03 15:27:00 -0500 111dab2fbec96b208a78b36bb8dcefd958036476 Microsoft.KeyVault/stable/2016-10-01/keyvault.json",
"package-preview-2020-04-full": "2023-04-10 18:34:42 -0700 33f06ff82a4c751bcbc842b7ed4da2e81b0717b6 Microsoft.KeyVault/preview/2020-04-01-preview/managedHsm.json",
"package-preview-2021-04": "2023-04-10 18:34:42 -0700 33f06ff82a4c751bcbc842b7ed4da2e81b0717b6 Microsoft.KeyVault/preview/2021-04-01-preview/managedHsm.json",
"package-preview-2021-06": "2023-06-15 17:17:26 -0700 5a6aba4027f3ebe09efdfe9fc151ea166f8c900c Microsoft.KeyVault/preview/2021-06-01-preview/keys.json",
"package-2021-10": "2023-04-10 18:34:42 -0700 33f06ff82a4c751bcbc842b7ed4da2e81b0717b6 Microsoft.KeyVault/stable/2021-10-01/managedHsm.json",
"package-2022-07": "2023-06-15 17:17:26 -0700 5a6aba4027f3ebe09efdfe9fc151ea166f8c900c Microsoft.KeyVault/stable/2022-07-01/keys.json",
"package-2023-02": "2023-06-15 17:17:26 -0700 5a6aba4027f3ebe09efdfe9fc151ea166f8c900c Microsoft.KeyVault/stable/2023-02-01/keysManagedHsm.json"
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ def __init__(
profile: KnownProfiles=KnownProfiles.default,
**kwargs: Any
):
if api_version:
kwargs.setdefault('api_version', api_version)
self._config = KeyVaultManagementClientConfiguration(credential, subscription_id, **kwargs)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
super(KeyVaultManagementClient, self).__init__(
Expand Down Expand Up @@ -152,7 +154,7 @@ def keys(self):
else:
raise ValueError("API version {} does not have operation group 'keys'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def managed_hsm_keys(self):
Expand All @@ -166,7 +168,7 @@ def managed_hsm_keys(self):
else:
raise ValueError("API version {} does not have operation group 'managed_hsm_keys'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def managed_hsms(self):
Expand Down Expand Up @@ -195,7 +197,7 @@ def managed_hsms(self):
else:
raise ValueError("API version {} does not have operation group 'managed_hsms'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def mhsm_private_endpoint_connections(self):
Expand All @@ -221,7 +223,7 @@ def mhsm_private_endpoint_connections(self):
else:
raise ValueError("API version {} does not have operation group 'mhsm_private_endpoint_connections'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def mhsm_private_link_resources(self):
Expand All @@ -247,7 +249,7 @@ def mhsm_private_link_resources(self):
else:
raise ValueError("API version {} does not have operation group 'mhsm_private_link_resources'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def mhsm_regions(self):
Expand All @@ -261,7 +263,7 @@ def mhsm_regions(self):
else:
raise ValueError("API version {} does not have operation group 'mhsm_regions'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def operations(self):
Expand Down Expand Up @@ -299,7 +301,7 @@ def operations(self):
else:
raise ValueError("API version {} does not have operation group 'operations'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def private_endpoint_connections(self):
Expand Down Expand Up @@ -334,7 +336,7 @@ def private_endpoint_connections(self):
else:
raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def private_link_resources(self):
Expand Down Expand Up @@ -369,7 +371,7 @@ def private_link_resources(self):
else:
raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def secrets(self):
Expand All @@ -395,7 +397,7 @@ def secrets(self):
else:
raise ValueError("API version {} does not have operation group 'secrets'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def vaults(self):
Expand Down Expand Up @@ -433,7 +435,7 @@ def vaults(self):
else:
raise ValueError("API version {} does not have operation group 'vaults'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

def close(self):
self._client.close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -664,8 +664,9 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
_serialized.update(_new_attr) # type: ignore
_new_attr = _new_attr[k] # type: ignore
_serialized = _serialized[k]
except ValueError:
continue
except ValueError as err:
if isinstance(err, SerializationError):
raise

except (AttributeError, KeyError, TypeError) as err:
msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj))
Expand Down Expand Up @@ -743,6 +744,8 @@ def query(self, name, data, data_type, **kwargs):
:param data: The data to be serialized.
:param str data_type: The type to be serialized from.
:keyword bool skip_quote: Whether to skip quote the serialized result.
Defaults to False.
:rtype: str
:raises: TypeError if serialization fails.
:raises: ValueError if data is None
Expand All @@ -751,10 +754,8 @@ def query(self, name, data, data_type, **kwargs):
# Treat the list aside, since we don't want to encode the div separator
if data_type.startswith("["):
internal_data_type = data_type[1:-1]
data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data]
if not kwargs.get("skip_quote", False):
data = [quote(str(d), safe="") for d in data]
return str(self.serialize_iter(data, internal_data_type, **kwargs))
do_quote = not kwargs.get('skip_quote', False)
return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs))

# Not a list, regular serialization
output = self.serialize_data(data, data_type, **kwargs)
Expand Down Expand Up @@ -893,6 +894,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
not be None or empty.
:param str div: If set, this str will be used to combine the elements
in the iterable into a combined string. Default is 'None'.
:keyword bool do_quote: Whether to quote the serialized result of each iterable element.
Defaults to False.
:rtype: list, str
"""
if isinstance(data, str):
Expand All @@ -905,9 +908,18 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
for d in data:
try:
serialized.append(self.serialize_data(d, iter_type, **kwargs))
except ValueError:
except ValueError as err:
if isinstance(err, SerializationError):
raise
serialized.append(None)

if kwargs.get('do_quote', False):
serialized = [
'' if s is None else quote(str(s), safe='')
for s
in serialized
]

if div:
serialized = ["" if s is None else str(s) for s in serialized]
serialized = div.join(serialized)
Expand Down Expand Up @@ -952,7 +964,9 @@ def serialize_dict(self, attr, dict_type, **kwargs):
for key, value in attr.items():
try:
serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs)
except ValueError:
except ValueError as err:
if isinstance(err, SerializationError):
raise
serialized[self.serialize_unicode(key)] = None

if "xml" in serialization_ctxt:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ def __init__(
profile: KnownProfiles = KnownProfiles.default,
**kwargs: Any
) -> None:
if api_version:
kwargs.setdefault('api_version', api_version)
self._config = KeyVaultManagementClientConfiguration(credential, subscription_id, **kwargs)
self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
super(KeyVaultManagementClient, self).__init__(
Expand Down Expand Up @@ -152,7 +154,7 @@ def keys(self):
else:
raise ValueError("API version {} does not have operation group 'keys'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def managed_hsm_keys(self):
Expand All @@ -166,7 +168,7 @@ def managed_hsm_keys(self):
else:
raise ValueError("API version {} does not have operation group 'managed_hsm_keys'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def managed_hsms(self):
Expand Down Expand Up @@ -195,7 +197,7 @@ def managed_hsms(self):
else:
raise ValueError("API version {} does not have operation group 'managed_hsms'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def mhsm_private_endpoint_connections(self):
Expand All @@ -221,7 +223,7 @@ def mhsm_private_endpoint_connections(self):
else:
raise ValueError("API version {} does not have operation group 'mhsm_private_endpoint_connections'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def mhsm_private_link_resources(self):
Expand All @@ -247,7 +249,7 @@ def mhsm_private_link_resources(self):
else:
raise ValueError("API version {} does not have operation group 'mhsm_private_link_resources'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def mhsm_regions(self):
Expand All @@ -261,7 +263,7 @@ def mhsm_regions(self):
else:
raise ValueError("API version {} does not have operation group 'mhsm_regions'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def operations(self):
Expand Down Expand Up @@ -299,7 +301,7 @@ def operations(self):
else:
raise ValueError("API version {} does not have operation group 'operations'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def private_endpoint_connections(self):
Expand Down Expand Up @@ -334,7 +336,7 @@ def private_endpoint_connections(self):
else:
raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def private_link_resources(self):
Expand Down Expand Up @@ -369,7 +371,7 @@ def private_link_resources(self):
else:
raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def secrets(self):
Expand All @@ -395,7 +397,7 @@ def secrets(self):
else:
raise ValueError("API version {} does not have operation group 'secrets'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def vaults(self):
Expand Down Expand Up @@ -433,7 +435,7 @@ def vaults(self):
else:
raise ValueError("API version {} does not have operation group 'vaults'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

async def close(self):
await self._client.close()
Expand Down
Loading

0 comments on commit c2de14a

Please sign in to comment.