Skip to content
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

[AutoPR track2_azure-mgmt-network] NetworkWatcher resolve swagger model validation error (LRO) in example files for pipeline run failure. #5100

Closed
wants to merge 1 commit 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
3 changes: 0 additions & 3 deletions sdk/network/azure-mgmt-network/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,3 @@ Code samples for this package can be found at:
If you encounter any bugs or have suggestions, please file an issue in the
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
section of the project.


![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-network%2FREADME.png)
6 changes: 3 additions & 3 deletions sdk/network/azure-mgmt-network/_meta.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"commit": "acf24167b5174d88f36302e243c883f2e63eec52",
"commit": "ed72cb0be24fd8432a8f8a063b447b310f27444e",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.7",
"use": [
"@autorest/[email protected]",
"@autorest/[email protected]"
],
"autorest_command": "autorest specification/network/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.7 --version-tolerant=False",
"autorest_command": "autorest specification/network/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/network/resource-manager/readme.md",
"package-2023-02": "2023-06-19 07:26:19 +0530 0b4a0a3f4bfc198df608f373784505e42e248c2c Microsoft.Network/stable/2023-02-01/networkVirtualAppliance.json",
"package-2021-02": "2021-09-14 19:30:27 -0700 54f1c87938269d4706629dc04c26ee1f3634585a Microsoft.Network/stable/2021-02-01/privateLinkService.json",
"package-2021-02-preview-only": "2023-07-28 22:13:42 +0530 1fbe3900e67f81f96ec4bcf8e5065f8486225035 Microsoft.Network/preview/2021-02-01-preview/networkSecurityPerimeter.json",
"package-2021-02-preview-only": "2023-10-12 23:38:35 +0530 dac9f85a47b0e4e759593f3a19968a732b911b47 Microsoft.Network/preview/2021-02-01-preview/networkSecurityPerimeter.json",
"package-2020-11": "2022-06-05 17:57:39 -0700 afd092f0148242079f0206329e4964407fe9e5b5 Microsoft.Network/stable/2020-11-01/loadBalancer.json",
"package-2020-08": "2021-05-11 02:02:27 -0700 e729721df20047dcb4fdb675d234b6821f1a4f81 Microsoft.Network/stable/2020-08-01/applicationGateway.json",
"package-2020-07": "2021-05-11 02:02:27 -0700 e729721df20047dcb4fdb675d234b6821f1a4f81 Microsoft.Network/stable/2020-07-01/applicationGateway.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,7 @@
from ...operations._operations import build_network_security_perimeters_get_request
from ...operations._operations import build_network_security_perimeters_list_request
from ...operations._operations import build_network_security_perimeters_list_by_subscription_request
from ...operations._operations import build_network_security_perimeters_patch_request
from ...operations._operations import build_nsp_access_rules_create_or_update_request
from ...operations._operations import build_nsp_access_rules_delete_request
from ...operations._operations import build_nsp_access_rules_get_request
Expand Down Expand Up @@ -66375,6 +66376,91 @@ async def get_next(next_link=None):

list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkSecurityPerimeters'}

@distributed_trace_async
async def patch(
self,
resource_group_name: str,
network_security_perimeter_name: str,
parameters: Union[_models.UpdateTagsRequest, IO],
**kwargs: Any
) -> _models.NetworkSecurityPerimeter:
"""Patch Tags for a Network Security Perimeter.

:param resource_group_name: The name of the resource group. Required.
:type resource_group_name: str
:param network_security_perimeter_name: The name of the network security perimeter. Required.
:type network_security_perimeter_name: str
:param parameters: Parameter supplied to the network security perimeter. Is either a
UpdateTagsRequest type or a IO type. Required.
:type parameters: ~azure.mgmt.network.models.UpdateTagsRequest or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: NetworkSecurityPerimeter or the result of cls(response)
:rtype: ~azure.mgmt.network.models.NetworkSecurityPerimeter
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})

_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.NetworkSecurityPerimeter] = kwargs.pop("cls", None)

content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "UpdateTagsRequest")

request = build_network_security_perimeters_patch_request(
resource_group_name=resource_group_name,
network_security_perimeter_name=network_security_perimeter_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.patch.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)

_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)

response = pipeline_response.http_response

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)

deserialized = self._deserialize("NetworkSecurityPerimeter", pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {})

return deserialized

patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}'}

class NspAccessRulesOperations:
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,7 @@
SecurityConfigurationListResult,
SubscriptionId,
SystemData,
UpdateTagsRequest,
UserRule,
UserRuleListResult,
Action,
Expand Down Expand Up @@ -1666,6 +1667,7 @@
"SecurityConfigurationListResult",
"SubscriptionId",
"SystemData",
"UpdateTagsRequest",
"UserRule",
"UserRuleListResult",
"Action",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37468,6 +37468,35 @@ def __init__(
self.last_modified_by_type = last_modified_by_type
self.last_modified_at = last_modified_at

class UpdateTagsRequest(_serialization.Model):
"""Update tags request.

Variables are only populated by the server, and will be ignored when sending a request.

:ivar id: Network security perimeter identifier.
:vartype id: str
:ivar tags: List of tags for Network Security Perimeter.
:vartype tags: dict[str, str]
"""

_validation = {
"id": {"readonly": True},
}

_attribute_map = {
"id": {"key": "id", "type": "str"},
"tags": {"key": "tags", "type": "{str}"},
}

def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None:
"""
:keyword tags: List of tags for Network Security Perimeter.
:paramtype tags: dict[str, str]
"""
super().__init__(**kwargs)
self.id = None
self.tags = tags

class UserRule(BaseUserRule): # pylint: disable=too-many-instance-attributes
"""Network security user rule.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84922,6 +84922,41 @@ def build_network_security_perimeters_list_by_subscription_request(

return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)

def build_network_security_perimeters_patch_request(
resource_group_name: str, network_security_perimeter_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")

# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"),
"networkSecurityPerimeterName": _SERIALIZER.url(
"network_security_perimeter_name", network_security_perimeter_name, "str"
),
}

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

# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")

# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")

return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)

class NetworkSecurityPerimetersOperations:
"""

Expand Down Expand Up @@ -85348,6 +85383,91 @@ def get_next(next_link=None):

list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkSecurityPerimeters'}

@distributed_trace
def patch(
self,
resource_group_name: str,
network_security_perimeter_name: str,
parameters: Union[_models.UpdateTagsRequest, IO],
**kwargs: Any
) -> _models.NetworkSecurityPerimeter:
"""Patch Tags for a Network Security Perimeter.

:param resource_group_name: The name of the resource group. Required.
:type resource_group_name: str
:param network_security_perimeter_name: The name of the network security perimeter. Required.
:type network_security_perimeter_name: str
:param parameters: Parameter supplied to the network security perimeter. Is either a
UpdateTagsRequest type or a IO type. Required.
:type parameters: ~azure.mgmt.network.models.UpdateTagsRequest or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: NetworkSecurityPerimeter or the result of cls(response)
:rtype: ~azure.mgmt.network.models.NetworkSecurityPerimeter
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})

_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.NetworkSecurityPerimeter] = kwargs.pop("cls", None)

content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "UpdateTagsRequest")

request = build_network_security_perimeters_patch_request(
resource_group_name=resource_group_name,
network_security_perimeter_name=network_security_perimeter_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.patch.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)

_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)

response = pipeline_response.http_response

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)

deserialized = self._deserialize("NetworkSecurityPerimeter", pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {})

return deserialized

patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}'}

def build_nsp_access_rules_create_or_update_request(
resource_group_name: str,
network_security_perimeter_name: str,
Expand Down
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 = "25.1.0"
VERSION = "1.0.0b1"
Loading