diff --git a/doc/sphinx/python_mgmt_migration_guide.rst b/doc/sphinx/python_mgmt_migration_guide.rst index 1856a17a3908..95154db61470 100644 --- a/doc/sphinx/python_mgmt_migration_guide.rst +++ b/doc/sphinx/python_mgmt_migration_guide.rst @@ -102,7 +102,7 @@ To the show the code snippets for the change: from azure.identity import ClientSecretCredential credential = ClientSecretCredential( - client_secret=client_secret, + tenant_id=tenant_id, client_id=client_id, client_secret=client_secret ) diff --git a/eng/common/pipelines/templates/steps/sparse-checkout.yml b/eng/common/pipelines/templates/steps/sparse-checkout.yml index 448cb2c2e313..1f5e3fc375f7 100644 --- a/eng/common/pipelines/templates/steps/sparse-checkout.yml +++ b/eng/common/pipelines/templates/steps/sparse-checkout.yml @@ -17,7 +17,10 @@ steps: - checkout: none - task: PowerShell@2 - displayName: 'Sparse checkout repositories' + ${{ if eq(length(parameters.Repositories), 1) }}: + displayName: 'Sparse checkout ${{ parameters.Repositories[0].Name }}' + ${{ else }}: + displayName: 'Sparse checkout repositories' inputs: targetType: inline # Define this inline, because of the chicken/egg problem with loading a script when nothing diff --git a/sdk/network/azure-mgmt-network/README.md b/sdk/network/azure-mgmt-network/README.md index d65e355c8f0a..41a1a4c77465 100644 --- a/sdk/network/azure-mgmt-network/README.md +++ b/sdk/network/azure-mgmt-network/README.md @@ -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) diff --git a/sdk/network/azure-mgmt-network/_meta.json b/sdk/network/azure-mgmt-network/_meta.json index 08f8c40c1196..0591dc626289 100644 --- a/sdk/network/azure-mgmt-network/_meta.json +++ b/sdk/network/azure-mgmt-network/_meta.json @@ -1,16 +1,16 @@ { - "commit": "acf24167b5174d88f36302e243c883f2e63eec52", + "commit": "c1a3788ea146859fb6dcc1e982b02d96707a98cb", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.7", "use": [ "@autorest/python@6.7.1", "@autorest/modelerfour@4.26.2" ], - "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/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --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/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --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 10:56:49 -0700 c1a3788ea146859fb6dcc1e982b02d96707a98cb 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", diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/aio/operations/_operations.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/aio/operations/_operations.py index fc5e4a4051b0..7c4c4f2d5d8b 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/aio/operations/_operations.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/aio/operations/_operations.py @@ -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 @@ -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: """ diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/models/__init__.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/models/__init__.py index 86c2234d8888..8171d6cc57b6 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/models/__init__.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/models/__init__.py @@ -661,6 +661,7 @@ SecurityConfigurationListResult, SubscriptionId, SystemData, + UpdateTagsRequest, UserRule, UserRuleListResult, Action, @@ -1666,6 +1667,7 @@ "SecurityConfigurationListResult", "SubscriptionId", "SystemData", + "UpdateTagsRequest", "UserRule", "UserRuleListResult", "Action", diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/models/_models.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/models/_models.py index 1d0032bce2ba..b787aae3757d 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/models/_models.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/models/_models.py @@ -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. diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/operations/_operations.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/operations/_operations.py index bd956d5b1f45..c04cf163a81d 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/operations/_operations.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/operations/_operations.py @@ -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: """ @@ -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, diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2021_02_01_preview/_version.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2021_02_01_preview/_version.py index 351bc2d5e43d..e5754a47ce68 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2021_02_01_preview/_version.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2021_02_01_preview/_version.py @@ -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" diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2021_02_01_preview/aio/operations/_operations.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2021_02_01_preview/aio/operations/_operations.py index a3daa3a291e1..fd08826eb9b3 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2021_02_01_preview/aio/operations/_operations.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2021_02_01_preview/aio/operations/_operations.py @@ -69,6 +69,7 @@ build_network_security_perimeters_get_request, build_network_security_perimeters_list_by_subscription_request, build_network_security_perimeters_list_request, + build_network_security_perimeters_patch_request, build_nsp_access_rules_create_or_update_request, build_nsp_access_rules_delete_request, build_nsp_access_rules_get_request, @@ -6112,6 +6113,147 @@ async def delete( # pylint: disable=inconsistent-return-statements "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}" } + @overload + async def patch( + self, + resource_group_name: str, + network_security_perimeter_name: str, + parameters: _models.UpdateTagsRequest, + *, + content_type: str = "application/json", + **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. Required. + :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.UpdateTagsRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :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.v2021_02_01_preview.models.NetworkSecurityPerimeter + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def patch( + self, + resource_group_name: str, + network_security_perimeter_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **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. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :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.v2021_02_01_preview.models.NetworkSecurityPerimeter + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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.v2021_02_01_preview.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.v2021_02_01_preview.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}" + } + @distributed_trace def list_by_subscription( self, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2021_02_01_preview/models/__init__.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2021_02_01_preview/models/__init__.py index 4878c84d2fe0..b0b6add5b570 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2021_02_01_preview/models/__init__.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2021_02_01_preview/models/__init__.py @@ -76,6 +76,7 @@ from ._models_py3 import SubscriptionId from ._models_py3 import SystemData from ._models_py3 import TagsObject +from ._models_py3 import UpdateTagsRequest from ._models_py3 import UserRule from ._models_py3 import UserRuleListResult @@ -179,6 +180,7 @@ "SubscriptionId", "SystemData", "TagsObject", + "UpdateTagsRequest", "UserRule", "UserRuleListResult", "AccessRuleDirection", diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2021_02_01_preview/models/_models_py3.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2021_02_01_preview/models/_models_py3.py index be77789c345b..111b71d6a927 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2021_02_01_preview/models/_models_py3.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2021_02_01_preview/models/_models_py3.py @@ -4606,6 +4606,36 @@ def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> N self.tags = tags +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. diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2021_02_01_preview/operations/_operations.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2021_02_01_preview/operations/_operations.py index 2eea6724f342..75ef4c1087fe 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2021_02_01_preview/operations/_operations.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2021_02_01_preview/operations/_operations.py @@ -1887,6 +1887,42 @@ def build_network_security_perimeters_delete_request( return HttpRequest(method="DELETE", 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) + + def build_network_security_perimeters_list_by_subscription_request( subscription_id: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: @@ -8825,6 +8861,147 @@ def delete( # pylint: disable=inconsistent-return-statements "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}" } + @overload + def patch( + self, + resource_group_name: str, + network_security_perimeter_name: str, + parameters: _models.UpdateTagsRequest, + *, + content_type: str = "application/json", + **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. Required. + :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.UpdateTagsRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :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.v2021_02_01_preview.models.NetworkSecurityPerimeter + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def patch( + self, + resource_group_name: str, + network_security_perimeter_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **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. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :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.v2021_02_01_preview.models.NetworkSecurityPerimeter + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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.v2021_02_01_preview.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.v2021_02_01_preview.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}" + } + @distributed_trace def list_by_subscription( self, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any