Skip to content

[AutoPR track2_azure-mgmt-authorization] [Test] Delete a input file #1781

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
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
28 changes: 21 additions & 7 deletions sdk/authorization/azure-mgmt-authorization/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
{
"commit": "1af2861030243b06ee35172c95899f4809eedfc7",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.2",
"commit": "8580fb1de1cc58a85ce41100f0f2235be12a4f53",
"repository_url": "https://github.com/openapi-env-test/azure-rest-api-specs",
"autorest": "3.9.7",
"use": [
"@autorest/python@6.6.0",
"@autorest/modelerfour@4.24.3"
"@autorest/python@6.7.1",
"@autorest/modelerfour@4.26.2"
],
"autorest_command": "autorest specification/authorization/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/authorization/resource-manager/readme.md"
"autorest_command": "autorest specification/authorization/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/authorization/resource-manager/readme.md",
"package-2021-12-01-preview-only": "2022-06-29 21:34:39 -0700 a4d7a85899e7b980990870106224524ec6438c8a Microsoft.Authorization/preview/2021-12-01-preview/authorization-AccessReviewCalls.json",
"package-2021-07-01-preview-only": "2021-07-29 01:50:48 -0700 74dbcfee45a6634d0043e478aba324796d98940c Microsoft.Authorization/preview/2021-07-01-preview/authorization-AccessReviewCalls.json",
"package-2021-03-01-preview-only": "2021-04-21 00:47:59 -0700 890f0755f2a973edadc31c78d7a74f5e283f6c3d Microsoft.Authorization/preview/2021-03-01-preview/authorization-AccessReviewCalls.json",
"package-2021-01-01-preview-only": "2021-02-18 00:34:14 -0800 c740df72bd77fd8c6a822bbd1ad8d366a31dc2b3 Microsoft.Authorization/preview/2021-01-01-preview/authorization-RoleAssignmentApprovalCalls.json",
"package-2020-10-01-only": "2022-03-31 17:46:02 -0700 95a128e006b4478203e188c9bf8896ffe9900998 Microsoft.Authorization/stable/2020-10-01/common-types.json",
"package-2020-10-01-preview-only": "2022-02-10 03:42:48 +0100 47c12e21d06ca29be0579880585fc883bd6e6055 Microsoft.Authorization/preview/2020-10-01-preview/RoleManagementPolicy.json",
"package-2020-04-01-preview-only": "2021-11-03 18:26:47 -0700 42c2ad511bc23ece4f224a67eb35c598280c6dcf Microsoft.Authorization/preview/2020-04-01-preview/authorization-RoleAssignmentsCalls.json",
"package-2019-08-01-preview-only": "2021-08-31 20:25:39 -0700 4dc391780cb36a5c8c5632f5baec0cb8f255fa71 Microsoft.Authorization/preview/2019-08-01-preview/authorization-UsageMetricsCalls.json",
"package-2018-09-01-preview-only": "2021-11-03 18:26:47 -0700 42c2ad511bc23ece4f224a67eb35c598280c6dcf Microsoft.Authorization/preview/2018-09-01-preview/authorization-RoleAssignmentsCalls.json",
"package-2018-07-01-preview-only": "2022-02-10 03:42:48 +0100 47c12e21d06ca29be0579880585fc883bd6e6055 Microsoft.Authorization/preview/2018-07-01-preview/authorization-DenyAssignmentGetCalls.json",
"package-2018-05-01-preview": "2022-02-10 03:42:48 +0100 47c12e21d06ca29be0579880585fc883bd6e6055 Microsoft.Authorization/preview/2018-05-01-preview/authorization-AccessReviewCalls.json",
"package-2018-01-01-preview-only": "2022-02-10 03:42:48 +0100 47c12e21d06ca29be0579880585fc883bd6e6055 Microsoft.Authorization/preview/2018-01-01-preview/authorization-RoleDefinitionsCalls.json",
"package-2015-07-01": "2022-06-01 00:48:33 -0700 688cfd36391115f70ea9276a8e526caea6a5c8ad Microsoft.Authorization/stable/2015-07-01/authorization-ElevateAccessCalls.json",
"package-2015-06-01-preview": "2021-08-31 20:25:39 -0700 4dc391780cb36a5c8c5632f5baec0cb8f255fa71 Microsoft.Authorization/preview/2015-06-01/authorization-ClassicAdminCalls.json"
}
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 @@ -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 = "4.0.0"
VERSION = "1.0.0b1"
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

from .. import models as _models
from ..._serialization import Serializer
from .._vendor import _convert_request, _format_url_section
from .._vendor import _convert_request

T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
Expand All @@ -51,7 +51,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest:
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}

_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
_url: str = _url.format(**path_format_arguments) # type: ignore

# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
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 = "4.0.0"
VERSION = "1.0.0b1"
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

from .. import models as _models
from ..._serialization import Serializer
from .._vendor import _convert_request, _format_url_section
from .._vendor import _convert_request

T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
Expand All @@ -51,7 +51,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest:
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}

_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
_url: str = _url.format(**path_format_arguments) # type: ignore

# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

from .. import models as _models
from ..._serialization import Serializer
from .._vendor import _convert_request, _format_url_section
from .._vendor import _convert_request

T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
Expand Down Expand Up @@ -55,7 +55,7 @@ def build_list_for_resource_group_request(resource_group_name: str, subscription
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}

_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
_url: str = _url.format(**path_format_arguments) # type: ignore

# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
Expand Down Expand Up @@ -97,7 +97,7 @@ def build_list_for_resource_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}

_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
_url: str = _url.format(**path_format_arguments) # type: ignore

# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

from .. import models as _models
from ..._serialization import Serializer
from .._vendor import _convert_request, _format_url_section
from .._vendor import _convert_request

T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
Expand All @@ -51,7 +51,7 @@ def build_get_request(resource_provider_namespace: str, *, expand: str = "resour
"resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"),
}

_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
_url: str = _url.format(**path_format_arguments) # type: ignore

# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

from .. import models as _models
from ..._serialization import Serializer
from .._vendor import _convert_request, _format_url_section
from .._vendor import _convert_request

T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
Expand Down Expand Up @@ -70,7 +70,7 @@ def build_list_for_resource_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}

_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
_url: str = _url.format(**path_format_arguments) # type: ignore

# Construct parameters
if filter is not None:
Expand Down Expand Up @@ -104,7 +104,7 @@ def build_list_for_resource_group_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}

_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
_url: str = _url.format(**path_format_arguments) # type: ignore

# Construct parameters
if filter is not None:
Expand All @@ -131,7 +131,7 @@ def build_delete_request(scope: str, role_assignment_name: str, **kwargs: Any) -
"roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"),
}

_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
_url: str = _url.format(**path_format_arguments) # type: ignore

# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
Expand All @@ -157,7 +157,7 @@ def build_create_request(scope: str, role_assignment_name: str, **kwargs: Any) -
"roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"),
}

_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
_url: str = _url.format(**path_format_arguments) # type: ignore

# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
Expand All @@ -184,7 +184,7 @@ def build_get_request(scope: str, role_assignment_name: str, **kwargs: Any) -> H
"roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"),
}

_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
_url: str = _url.format(**path_format_arguments) # type: ignore

# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
Expand All @@ -208,7 +208,7 @@ def build_delete_by_id_request(role_assignment_id: str, **kwargs: Any) -> HttpRe
"roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True),
}

_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
_url: str = _url.format(**path_format_arguments) # type: ignore

# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
Expand All @@ -233,7 +233,7 @@ def build_create_by_id_request(role_assignment_id: str, **kwargs: Any) -> HttpRe
"roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True),
}

_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
_url: str = _url.format(**path_format_arguments) # type: ignore

# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
Expand All @@ -259,7 +259,7 @@ def build_get_by_id_request(role_assignment_id: str, **kwargs: Any) -> HttpReque
"roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True),
}

_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
_url: str = _url.format(**path_format_arguments) # type: ignore

# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
Expand All @@ -285,7 +285,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, **
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}

_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
_url: str = _url.format(**path_format_arguments) # type: ignore

# Construct parameters
if filter is not None:
Expand All @@ -311,7 +311,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, **
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}

_url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
_url: str = _url.format(**path_format_arguments) # type: ignore

# Construct parameters
if filter is not None:
Expand Down
Loading