Skip to content

Commit

Permalink
CodeGen from PR 32741 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 2834538e8e1e0d506e5a049326c175bb5dc4aa8e into 7438e68d87366629ddbfb3e4f3953672f0efb476
  • Loading branch information
SDKAuto committed Feb 22, 2025
1 parent af5efc9 commit 8d28413
Show file tree
Hide file tree
Showing 13 changed files with 280 additions and 171 deletions.
4 changes: 2 additions & 2 deletions sdk/terraform/azure-mgmt-terraform/_meta.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"commit": "ed3e7186654df4ec286c3d92f03dfa6c14b37279",
"commit": "47e1bfd985e1e04118d6e4b379011888a92cef8e",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"typespec_src": "specification/terraform/Microsoft.AzureTerraform.Management",
"@azure-tools/typespec-python": "0.36.1"
"@azure-tools/typespec-python": "0.38.4"
}
24 changes: 24 additions & 0 deletions sdk/terraform/azure-mgmt-terraform/apiview-properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"CrossLanguagePackageId": "Microsoft.AzureTerraform",
"CrossLanguageDefinitionId": {
"azure.mgmt.terraform.models.BaseExportModel": "Microsoft.AzureTerraform.BaseExportModel",
"azure.mgmt.terraform.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo",
"azure.mgmt.terraform.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail",
"azure.mgmt.terraform.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse",
"azure.mgmt.terraform.models.ExportQuery": "Microsoft.AzureTerraform.ExportQuery",
"azure.mgmt.terraform.models.ExportResource": "Microsoft.AzureTerraform.ExportResource",
"azure.mgmt.terraform.models.ExportResourceGroup": "Microsoft.AzureTerraform.ExportResourceGroup",
"azure.mgmt.terraform.models.ExportResult": "Microsoft.AzureTerraform.ExportResult",
"azure.mgmt.terraform.models.Operation": "Azure.ResourceManager.CommonTypes.Operation",
"azure.mgmt.terraform.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay",
"azure.mgmt.terraform.models.TerraformOperationStatus": "Microsoft.AzureTerraform.TerraformOperationStatus",
"azure.mgmt.terraform.models.Origin": "Azure.ResourceManager.CommonTypes.Origin",
"azure.mgmt.terraform.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType",
"azure.mgmt.terraform.models.ResourceProvisioningState": "Azure.ResourceManager.ResourceProvisioningState",
"azure.mgmt.terraform.models.Type": "Microsoft.AzureTerraform.Type",
"azure.mgmt.terraform.models.TargetProvider": "Microsoft.AzureTerraform.targetProvider",
"azure.mgmt.terraform.models.AuthorizationScopeFilter": "Microsoft.AzureTerraform.authorizationScopeFilter",
"azure.mgmt.terraform.TerraformMgmtClient.operations.list": "Azure.ResourceManager.Operations.list",
"azure.mgmt.terraform.TerraformMgmtClient.terraform.begin_export_terraform": "Microsoft.AzureTerraform.Terraform.exportTerraform"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -373,15 +373,34 @@ def __ne__(self, other: typing.Any) -> bool:
return not self.__eq__(other)

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

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

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

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

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

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

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

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

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

def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any:
"""
Same as calling D.get(k, d), and setting D[k]=d if k not found
:param str key: The key to look up.
:param any default: The value to set if key is not in the dictionary
:returns: D[k] if k in D, else d.
:rtype: any
"""
if default is _UNSET:
return self._data.setdefault(key)
return self._data.setdefault(key, default)
Expand Down Expand Up @@ -754,7 +801,7 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur
except AttributeError:
model_name = annotation
if module is not None:
annotation = _get_model(module, model_name)
annotation = _get_model(module, model_name) # type: ignore

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


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


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


class _RestField:
def __init__(
self,
Expand Down
Loading

0 comments on commit 8d28413

Please sign in to comment.