Skip to content

Commit

Permalink
CodeGen from PR 25406 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
update typescript.md in resource (Azure#25406)

* update typescript.md in resource

* update
  • Loading branch information
SDKAuto committed Aug 28, 2023
1 parent 5484aa3 commit b5ec4cd
Show file tree
Hide file tree
Showing 351 changed files with 7,368 additions and 6,396 deletions.
64 changes: 58 additions & 6 deletions sdk/resources/azure-mgmt-resource/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,63 @@
{
"commit": "7211edbf5b76865549fcfaf35942cd50484fed74",
"commit": "48a17e12cda90cd680997c5d3b479369941840fc",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.2",
"autorest": "3.9.7",
"use": [
"@autorest/python@6.5.0",
"@autorest/modelerfour@4.24.3"
"@autorest/python@6.7.1",
"@autorest/modelerfour@4.26.2"
],
"autorest_command": "autorest specification/resources/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/resources/resource-manager/readme.md"
"autorest_command": "autorest specification/resources/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/resources/resource-manager/readme.md",
"package-privatelinks-2020-05": "2022-03-18 16:14:07 -0700 2c68b6f0c9566d97d9d590a31b0d46997622eef7 Microsoft.Authorization/stable/2020-05-01/privateLinks.json",
"package-features-2021-07": "2022-03-06 17:36:42 -0800 6a57e9cedc87cafd2dc9e4f3e8af62b5725e3d22 Microsoft.Features/stable/2021-07-01/features.json",
"package-features-2015-12": "2020-03-23 19:43:44 -0700 53dd5c1278de960b38ea5cbdf69be99d4d4bfd0f Microsoft.Features/stable/2015-12-01/features.json",
"package-links-2016-09": "2022-03-06 17:36:42 -0800 6a57e9cedc87cafd2dc9e4f3e8af62b5725e3d22 Microsoft.Resources/stable/2016-09-01/links.json",
"package-locks-2016-09": "2021-03-16 20:01:32 -0700 be1d938d548060ffe4dea422b32a6932b168ec18 Microsoft.Authorization/stable/2016-09-01/locks.json",
"package-locks-2015-01": "2018-06-04 10:10:25 -0700 a9675b1e5a9b0e694bea4e417365f74657b8903a Microsoft.Authorization/stable/2015-01-01/locks.json",
"package-managedapplications-2019-07": "2022-02-17 23:42:24 -0800 67223eb5be65114df664bb5ae28e6e14ff62e84f Microsoft.Solutions/stable/2019-07-01/managedapplications.json",
"package-policy-2022-08-preview-only": "2022-11-15 18:35:20 -0800 fa7609844bc20b126037dfb180ef7155c2174f7b Microsoft.Authorization/preview/2022-08-01-preview/policyVariables.json",
"package-policy-2022-07-preview-only": "2022-10-10 18:10:12 -0700 1cb05f075f2d061686fa8a9e45c72d1fafff9e3f Microsoft.Authorization/preview/2022-07-01-preview/policyExemptions.json",
"package-policy-2022-06-only": "2022-10-10 18:10:12 -0700 1cb05f075f2d061686fa8a9e45c72d1fafff9e3f Microsoft.Authorization/stable/2022-06-01/policyAssignments.json",
"package-policy-2021-06-only": "2022-11-15 18:35:20 -0800 fa7609844bc20b126037dfb180ef7155c2174f7b Microsoft.Authorization/stable/2021-06-01/policySetDefinitions.json",
"package-policy-2020-09-only": "2022-11-15 18:35:20 -0800 fa7609844bc20b126037dfb180ef7155c2174f7b Microsoft.Authorization/stable/2020-09-01/dataPolicyManifests.json",
"package-policy-2020-07-preview-only": "2021-02-01 17:30:20 -0800 76fb4a0f3187990b6cc487a9b45ce7e37dd479a6 Microsoft.Authorization/preview/2020-07-01-preview/policyExemptions.json",
"package-policy-2019-09": "2020-01-12 18:45:11 -0800 d960c6cfad5edcd47d7573d935ff0bd7f6bdfe04 Microsoft.Authorization/stable/2019-09-01/policyAssignments.json",
"package-policy-2019-06": "2019-08-28 02:16:00 -0400 35b484b592948aa81f9c95d2ec7425cf08fd15a2 Microsoft.Authorization/stable/2019-06-01/policyAssignments.json",
"package-policy-2019-01": "2019-07-11 14:36:23 -0400 568b944dd2b19b35b7c06f917d0166c046a85851 Microsoft.Authorization/stable/2019-01-01/policySetDefinitions.json",
"package-policy-2018-05": "2019-07-04 18:31:46 -0700 f6e96392dd7f1069b6d600cfda549bf786d009b0 Microsoft.Authorization/stable/2018-05-01/policyAssignments.json",
"package-policy-2018-03": "2019-07-04 18:31:46 -0700 f6e96392dd7f1069b6d600cfda549bf786d009b0 Microsoft.Authorization/stable/2018-03-01/policyAssignments.json",
"package-policy-2017-06-preview-only": "2019-06-12 19:24:50 -0400 c7a6b470d7bb65a240739e99a4d123ed1a3ca7e9 Microsoft.Authorization/preview/2017-06-01-preview/policySetDefinitions.json",
"package-policy-2016-12": "2019-06-12 19:24:50 -0400 c7a6b470d7bb65a240739e99a4d123ed1a3ca7e9 Microsoft.Authorization/stable/2016-12-01/policyAssignments.json",
"package-policy-2016-04": "2018-12-10 12:22:37 -0500 3a0278ee2f92ca2fbb5c6bedf54607133bd4f8be Microsoft.Authorization/stable/2016-04-01/policy.json",
"package-policy-2015-10": "2018-12-10 12:22:37 -0500 3a0278ee2f92ca2fbb5c6bedf54607133bd4f8be Microsoft.Authorization/preview/2015-10-01-preview/policy.json",
"package-resources-2022-09": "2023-06-14 18:50:13 -0700 49401294370eed6ed25de57fce89ac901c671cf4 Microsoft.Resources/stable/2022-09-01/resources.json",
"package-resources-2021-04": "2022-08-21 21:31:53 -0700 81cd88a080c4bf4bb251afbe62892a6e220cb2b4 Microsoft.Resources/stable/2021-04-01/resources.json",
"package-resources-2021-01": "2021-12-05 18:06:52 -0800 3b2f85d320fac5b282bc80240f9e5c2c57753bad Microsoft.Resources/stable/2021-01-01/resources.json",
"package-resources-2020-10": "2021-10-07 18:41:27 -0700 23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5 Microsoft.Resources/stable/2020-10-01/resources.json",
"package-resources-2020-06": "2022-03-06 17:36:42 -0800 6a57e9cedc87cafd2dc9e4f3e8af62b5725e3d22 Microsoft.Resources/stable/2020-06-01/resources.json",
"package-resources-2019-10": "2021-10-07 18:41:27 -0700 23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5 Microsoft.Resources/stable/2019-10-01/resources.json",
"package-resources-2019-08": "2022-03-31 18:32:58 -0700 d55f30f41f04e712de101fc9c17a591ca410bfed Microsoft.Resources/stable/2019-08-01/resources.json",
"package-resources-2019-07": "2022-03-31 18:32:58 -0700 d55f30f41f04e712de101fc9c17a591ca410bfed Microsoft.Resources/stable/2019-07-01/resources.json",
"package-resources-2019-0510": "2022-03-31 18:32:58 -0700 d55f30f41f04e712de101fc9c17a591ca410bfed Microsoft.Resources/stable/2019-05-10/resources.json",
"package-resources-2019-05": "2022-03-31 18:32:58 -0700 d55f30f41f04e712de101fc9c17a591ca410bfed Microsoft.Resources/stable/2019-05-10/resources.json",
"package-resources-2019-03": "2022-03-31 18:32:58 -0700 d55f30f41f04e712de101fc9c17a591ca410bfed Microsoft.Resources/stable/2019-03-01/resources.json",
"package-resources-2018-05": "2022-03-31 18:32:58 -0700 d55f30f41f04e712de101fc9c17a591ca410bfed Microsoft.Resources/stable/2018-05-01/resources.json",
"package-resources-2018-02": "2022-03-31 18:32:58 -0700 d55f30f41f04e712de101fc9c17a591ca410bfed Microsoft.Resources/stable/2018-02-01/resources.json",
"package-resources-2017-05": "2022-03-31 18:32:58 -0700 d55f30f41f04e712de101fc9c17a591ca410bfed Microsoft.Resources/stable/2017-05-10/resources.json",
"package-resources-2016-09": "2022-03-31 18:32:58 -0700 d55f30f41f04e712de101fc9c17a591ca410bfed Microsoft.Resources/stable/2016-09-01/resources.json",
"package-resources-2016-02": "2022-03-31 18:32:58 -0700 d55f30f41f04e712de101fc9c17a591ca410bfed Microsoft.Resources/stable/2016-02-01/resources.json",
"package-subscriptions-2022-12": "2023-05-23 14:08:27 +0800 c183bb012de8e9e1d0d2e67a0994748df4747d2c Microsoft.Resources/stable/2022-12-01/subscriptions.json",
"package-subscriptions-2021-01": "2022-03-06 17:36:42 -0800 6a57e9cedc87cafd2dc9e4f3e8af62b5725e3d22 Microsoft.Resources/stable/2021-01-01/subscriptions.json",
"package-subscriptions-2019-11": "2022-01-11 17:53:40 -0800 5d117a8c7686fe2b2940114f6866a3958ccca6e0 Microsoft.Resources/stable/2019-11-01/subscriptions.json",
"package-subscriptions-2019-06": "2022-01-11 17:53:40 -0800 5d117a8c7686fe2b2940114f6866a3958ccca6e0 Microsoft.Resources/stable/2019-06-01/subscriptions.json",
"package-subscriptions-2018-06": "2022-01-11 17:53:40 -0800 5d117a8c7686fe2b2940114f6866a3958ccca6e0 Microsoft.Resources/stable/2018-06-01/subscriptions.json",
"package-subscriptions-2016-06": "2022-01-11 17:53:40 -0800 5d117a8c7686fe2b2940114f6866a3958ccca6e0 Microsoft.Resources/stable/2016-06-01/subscriptions.json",
"package-deploymentscripts-2020-10": "2022-03-06 17:36:42 -0800 6a57e9cedc87cafd2dc9e4f3e8af62b5725e3d22 Microsoft.Resources/stable/2020-10-01/deploymentScripts.json",
"package-deploymentscripts-2019-10-preview": "2021-03-02 01:33:38 -0800 61fa39c7434b2058085bd10c4d66877db5d7f5c7 Microsoft.Resources/preview/2019-10-01-preview/deploymentScripts.json",
"package-templatespecs-2022-02": "2022-04-18 03:28:00 -0700 f5b15e812e6e5228eaebf3b629a682a088afebd6 Microsoft.Resources/stable/2022-02-01/templateSpecs.json",
"package-templatespecs-2021-05": "2022-03-06 17:36:42 -0800 6a57e9cedc87cafd2dc9e4f3e8af62b5725e3d22 Microsoft.Resources/stable/2021-05-01/templateSpecs.json",
"package-templatespecs-2021-03-preview": "2021-04-08 22:14:47 -0700 02014ccbf8f7e4ae156713583252c9492b540527 Microsoft.Resources/preview/2021-03-01-preview/templateSpecs.json",
"package-templatespecs-2019-06-preview": "2020-10-19 17:06:28 -0700 86d04dae5f34cbe19217e546cbc14d67664c7124 Microsoft.Resources/preview/2019-06-01-preview/templateSpecs.json",
"package-deploymentstacks-2022-08-preview": "2023-05-30 01:27:13 -0400 13bf172f804ad5546ad3ccdf0c785777d4f15825 Microsoft.Resources/preview/2022-08-01-preview/deploymentStacks.json",
"package-changes-2022-05": "2022-04-24 21:43:30 -0700 91b36e26db23dffc149d968333c29f9a2f131702 Microsoft.Resources/stable/2022-05-01/changes.json"
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ def __init__(
profile: KnownProfiles=KnownProfiles.default,
**kwargs: Any
):
if api_version:
kwargs.setdefault('api_version', api_version)
self._config = ChangesClientConfiguration(credential, subscription_id, **kwargs)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
super(ChangesClient, self).__init__(
Expand Down Expand Up @@ -104,7 +106,7 @@ def changes(self):
else:
raise ValueError("API version {} does not have operation group 'changes'".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 @@ -70,6 +70,8 @@ def __init__(
profile: KnownProfiles = KnownProfiles.default,
**kwargs: Any
) -> None:
if api_version:
kwargs.setdefault('api_version', api_version)
self._config = ChangesClientConfiguration(credential, subscription_id, **kwargs)
self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
super(ChangesClient, self).__init__(
Expand Down Expand Up @@ -104,7 +106,7 @@ def changes(self):
else:
raise ValueError("API version {} does not have operation group 'changes'".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
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.changes = ChangesOperations(self._client, self._config, self._serialize, self._deserialize)
self.changes = ChangesOperations(self._client, self._config, self._serialize, self._deserialize, "2022-05-01")

def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import List, cast

from azure.core.pipeline.transport import HttpRequest


Expand All @@ -16,15 +14,3 @@ def _convert_request(request, files=None):
if files:
request.set_formdata_body(files)
return request


def _format_url_section(template, **kwargs):
components = template.split("/")
while components:
try:
return template.format(**kwargs)
except KeyError as key:
# Need the cast, as for some reasons "split" is typed as list[str | Any]
formatted_components = cast(List[str], template.split("/"))
components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
template = "/".join(components)
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

VERSION = "23.1.0b2"
VERSION = "1.0.0b1"
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.changes = ChangesOperations(self._client, self._config, self._serialize, self._deserialize)
self.changes = ChangesOperations(self._client, self._config, self._serialize, self._deserialize, "2022-05-01")

def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
"""Runs the network request through the client's chained policies.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None:
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._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")

@distributed_trace
def list(
Expand Down Expand Up @@ -88,7 +89,7 @@ def list(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[_models.ChangeResourceListResult] = kwargs.pop("cls", None)

error_map = {
Expand Down Expand Up @@ -203,7 +204,7 @@ async def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[_models.ChangeResourceResult] = kwargs.pop("cls", None)

request = build_changes_get_request(
Expand Down
Loading

0 comments on commit b5ec4cd

Please sign in to comment.