diff --git a/sdk/nginx/azure-mgmt-nginx/CHANGELOG.md b/sdk/nginx/azure-mgmt-nginx/CHANGELOG.md index a8be3c65efde..15d84c09a0ad 100644 --- a/sdk/nginx/azure-mgmt-nginx/CHANGELOG.md +++ b/sdk/nginx/azure-mgmt-nginx/CHANGELOG.md @@ -1,5 +1,59 @@ # Release History +## 3.1.0b3 (2025-05-12) + +### Features Added + + - Client `NginxManagementClient` added operation group `waf_policy` + - Client `NginxManagementClient` added operation group `default_waf_policy` + - Model `AnalysisCreate` added property `root_file` + - Model `AnalysisCreate` added property `files` + - Model `AnalysisCreate` added property `protected_files` + - Model `AnalysisCreate` added property `package` + - Model `AnalysisResult` added property `errors` + - Model `AnalysisResult` added property `diagnostics` + - Model `NginxDeploymentApiKeyRequest` added property `system_data` + - Model `NginxDeploymentApiKeyResponse` added property `system_data` + - Model `NginxDeploymentProperties` added property `web_application_firewall_settings` + - Model `NginxDeploymentProperties` added property `web_application_firewall_status` + - Model `NginxDeploymentUpdateProperties` added property `web_application_firewall_settings` + - Model `ScaleProfile` added property `min` + - Model `ScaleProfile` added property `max` + - Model `WebApplicationFirewallStatus` added property `waf_release` + - Added enum `ActionType` + - Added model `NginxDeploymentDefaultWafPolicyListResponse` + - Added model `NginxDeploymentDefaultWafPolicyProperties` + - Added model `NginxDeploymentWafPolicy` + - Added model `NginxDeploymentWafPolicyApplyingStatus` + - Added enum `NginxDeploymentWafPolicyApplyingStatusCode` + - Added model `NginxDeploymentWafPolicyCompilingStatus` + - Added enum `NginxDeploymentWafPolicyCompilingStatusCode` + - Added model `NginxDeploymentWafPolicyListResponse` + - Added model `NginxDeploymentWafPolicyMetadata` + - Added model `NginxDeploymentWafPolicyMetadataProperties` + - Added model `NginxDeploymentWafPolicyProperties` + - Added model `Operation` + - Added model `OperationDisplayAutoGenerated` + - Added enum `Origin` + - Added model `DefaultWafPolicyOperations` + - Added model `WafPolicyOperations` + - Method `WafPolicyOperations.begin_create` has a new overload `def begin_create(self: None, resource_group_name: str, deployment_name: str, waf_policy_name: str, body: Optional[NginxDeploymentWafPolicy], content_type: str)` + - Method `WafPolicyOperations.begin_create` has a new overload `def begin_create(self: None, resource_group_name: str, deployment_name: str, waf_policy_name: str, body: Optional[IO[bytes]], content_type: str)` + +### Breaking Changes + + - Model `AnalysisCreate` deleted or renamed its instance variable `config` + - Model `AnalysisResult` deleted or renamed its instance variable `data` + - Model `NginxCertificate` deleted or renamed its instance variable `location` + - Model `NginxDeploymentProperties` deleted or renamed its instance variable `nginx_app_protect` + - Model `NginxDeploymentUpdateProperties` deleted or renamed its instance variable `nginx_app_protect` + - Model `ScaleProfile` deleted or renamed its instance variable `capacity` + - Deleted or renamed model `AnalysisCreateConfig` + - Deleted or renamed model `AnalysisResultData` + - Deleted or renamed model `NginxDeploymentPropertiesNginxAppProtect` + - Deleted or renamed model `NginxDeploymentUpdatePropertiesNginxAppProtect` + - Deleted or renamed model `ScaleProfileCapacity` + ## 3.1.0b2 (2025-02-23) ### Features Added diff --git a/sdk/nginx/azure-mgmt-nginx/README.md b/sdk/nginx/azure-mgmt-nginx/README.md index 2c66b7bf631c..77365a5e04a4 100644 --- a/sdk/nginx/azure-mgmt-nginx/README.md +++ b/sdk/nginx/azure-mgmt-nginx/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Nginx Management Client Library. -This package has been tested with Python 3.8+. +This package has been tested with Python 3.9+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.8+ is required to use this package. +- Python 3.9+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -24,7 +24,7 @@ pip install azure-identity ### Authentication -By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. diff --git a/sdk/nginx/azure-mgmt-nginx/_meta.json b/sdk/nginx/azure-mgmt-nginx/_meta.json index db32155549ec..d0b1409ca29a 100644 --- a/sdk/nginx/azure-mgmt-nginx/_meta.json +++ b/sdk/nginx/azure-mgmt-nginx/_meta.json @@ -1,11 +1,11 @@ { - "commit": "198ffdb2b788b49be283a388ad9735b0cfad1be1", + "commit": "6d1096f0adac674f2cfd8627e24f0354a4fa4308", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.27.4", + "@autorest/python@6.34.1", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/nginx/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.27.4 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "autorest_command": "autorest specification/nginx/resource-manager/readme.md --generate-sample=True --generate-test=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.34.1 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/nginx/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_configuration.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_configuration.py index 56f0a070f8e5..12ae670d9ea3 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_configuration.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_configuration.py @@ -27,13 +27,13 @@ class NginxManagementClientConfiguration: # pylint: disable=too-many-instance-a :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-11-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2025-03-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-11-01-preview") + api_version: str = kwargs.pop("api_version", "2025-03-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_nginx_management_client.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_nginx_management_client.py index bad67fdda2bf..5886c6b60094 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_nginx_management_client.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_nginx_management_client.py @@ -7,30 +7,34 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from ._configuration import NginxManagementClientConfiguration -from ._serialization import Deserializer, Serializer +from ._utils.serialization import Deserializer, Serializer from .operations import ( ApiKeysOperations, CertificatesOperations, ConfigurationsOperations, + DefaultWafPolicyOperations, DeploymentsOperations, Operations, + WafPolicyOperations, ) if TYPE_CHECKING: from azure.core.credentials import TokenCredential -class NginxManagementClient: +class NginxManagementClient: # pylint: disable=too-many-instance-attributes """NginxManagementClient. :ivar api_keys: ApiKeysOperations operations @@ -41,15 +45,19 @@ class NginxManagementClient: :vartype configurations: azure.mgmt.nginx.operations.ConfigurationsOperations :ivar deployments: DeploymentsOperations operations :vartype deployments: azure.mgmt.nginx.operations.DeploymentsOperations + :ivar waf_policy: WafPolicyOperations operations + :vartype waf_policy: azure.mgmt.nginx.operations.WafPolicyOperations + :ivar default_waf_policy: DefaultWafPolicyOperations operations + :vartype default_waf_policy: azure.mgmt.nginx.operations.DefaultWafPolicyOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.nginx.operations.Operations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2024-11-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2025-03-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -57,15 +65,17 @@ class NginxManagementClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = NginxManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -84,7 +94,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -94,6 +104,10 @@ def __init__( self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) self.configurations = ConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.waf_policy = WafPolicyOperations(self._client, self._config, self._serialize, self._deserialize) + self.default_waf_policy = DefaultWafPolicyOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_utils/__init__.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_utils/__init__.py new file mode 100644 index 000000000000..0af9b28f6607 --- /dev/null +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_utils/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_serialization.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_utils/serialization.py similarity index 94% rename from sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_serialization.py rename to sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_utils/serialization.py index b24ab2885450..f5187701d7be 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_serialization.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_utils/serialization.py @@ -1,28 +1,10 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- -# # Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pyright: reportUnnecessaryTypeIgnoreComment=false @@ -48,9 +30,7 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, List, ) @@ -61,13 +41,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -185,73 +165,7 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0. - - :param datetime.datetime dt: The datetime - :returns: The offset - :rtype: datetime.timedelta - """ - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation. - - :param datetime.datetime dt: The datetime - :returns: The timestamp representation - :rtype: str - """ - return "Z" - - def dst(self, dt): - """No daylight saving for UTC. - - :param datetime.datetime dt: The datetime - :returns: The daylight saving time - :rtype: datetime.timedelta - """ - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset) -> None: - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -479,8 +393,8 @@ def from_dict( :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -626,7 +540,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) @@ -736,8 +650,8 @@ def body(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized request body """ @@ -781,8 +695,8 @@ def url(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :rtype: str :returns: The serialized URL path - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -805,8 +719,8 @@ def query(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized query parameter """ try: @@ -835,8 +749,8 @@ def header(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized header """ try: @@ -855,9 +769,9 @@ def serialize_data(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. :returns: The serialized data. :rtype: str, int, float, bool, dict, list """ @@ -1192,7 +1106,7 @@ def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. :return: serialized rfc """ try: @@ -1218,7 +1132,7 @@ def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. :return: serialized iso """ if isinstance(attr, str): @@ -1251,7 +1165,7 @@ def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid :return: serialied unix """ if isinstance(attr, int): @@ -1429,7 +1343,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name ) ) @@ -1488,7 +1402,7 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1502,7 +1416,7 @@ def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1717,7 +1631,7 @@ def deserialize_data(self, data, data_type): # pylint: disable=too-many-return- :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1799,7 +1713,7 @@ def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return :param dict attr: Dictionary to be deserialized. :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1845,7 +1759,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :param str data_type: deserialization data type. :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1936,7 +1850,7 @@ def deserialize_bytearray(attr): :param str attr: response string to be deserialized. :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1949,7 +1863,7 @@ def deserialize_base64(attr): :param str attr: response string to be deserialized. :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1964,7 +1878,7 @@ def deserialize_decimal(attr): :param str attr: response string to be deserialized. :return: Deserialized decimal - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. :rtype: decimal """ if isinstance(attr, ET.Element): @@ -1982,7 +1896,7 @@ def deserialize_long(attr): :param str attr: response string to be deserialized. :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1995,7 +1909,7 @@ def deserialize_duration(attr): :param str attr: response string to be deserialized. :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2013,7 +1927,7 @@ def deserialize_date(attr): :param str attr: response string to be deserialized. :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2029,7 +1943,7 @@ def deserialize_time(attr): :param str attr: response string to be deserialized. :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2044,14 +1958,14 @@ def deserialize_rfc(attr): :param str attr: response string to be deserialized. :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -2067,7 +1981,7 @@ def deserialize_iso(attr): :param str attr: response string to be deserialized. :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2105,7 +2019,7 @@ def deserialize_unix(attr): :param int attr: Object to be serialized. :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_version.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_version.py index d5129bebc550..fd73c4a4b3d0 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_version.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0b2" +VERSION = "3.1.0b3" diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_configuration.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_configuration.py index 4f3d3d8449a9..a6bc8658d4b4 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_configuration.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_configuration.py @@ -27,13 +27,13 @@ class NginxManagementClientConfiguration: # pylint: disable=too-many-instance-a :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-11-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2025-03-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-11-01-preview") + api_version: str = kwargs.pop("api_version", "2025-03-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_nginx_management_client.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_nginx_management_client.py index 059f95c1db19..bfad2ea6a680 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_nginx_management_client.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_nginx_management_client.py @@ -7,30 +7,34 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models -from .._serialization import Deserializer, Serializer +from .._utils.serialization import Deserializer, Serializer from ._configuration import NginxManagementClientConfiguration from .operations import ( ApiKeysOperations, CertificatesOperations, ConfigurationsOperations, + DefaultWafPolicyOperations, DeploymentsOperations, Operations, + WafPolicyOperations, ) if TYPE_CHECKING: from azure.core.credentials_async import AsyncTokenCredential -class NginxManagementClient: +class NginxManagementClient: # pylint: disable=too-many-instance-attributes """NginxManagementClient. :ivar api_keys: ApiKeysOperations operations @@ -41,15 +45,19 @@ class NginxManagementClient: :vartype configurations: azure.mgmt.nginx.aio.operations.ConfigurationsOperations :ivar deployments: DeploymentsOperations operations :vartype deployments: azure.mgmt.nginx.aio.operations.DeploymentsOperations + :ivar waf_policy: WafPolicyOperations operations + :vartype waf_policy: azure.mgmt.nginx.aio.operations.WafPolicyOperations + :ivar default_waf_policy: DefaultWafPolicyOperations operations + :vartype default_waf_policy: azure.mgmt.nginx.aio.operations.DefaultWafPolicyOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.nginx.aio.operations.Operations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2024-11-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2025-03-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -57,15 +65,17 @@ class NginxManagementClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = NginxManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -84,7 +94,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -94,6 +106,10 @@ def __init__( self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) self.configurations = ConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.waf_policy = WafPolicyOperations(self._client, self._config, self._serialize, self._deserialize) + self.default_waf_policy = DefaultWafPolicyOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) def _send_request( diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/__init__.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/__init__.py index bf1dfbd4df3e..b4a11f8b05d4 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/__init__.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/__init__.py @@ -16,6 +16,8 @@ from ._certificates_operations import CertificatesOperations # type: ignore from ._configurations_operations import ConfigurationsOperations # type: ignore from ._deployments_operations import DeploymentsOperations # type: ignore +from ._waf_policy_operations import WafPolicyOperations # type: ignore +from ._default_waf_policy_operations import DefaultWafPolicyOperations # type: ignore from ._operations import Operations # type: ignore from ._patch import __all__ as _patch_all @@ -27,6 +29,8 @@ "CertificatesOperations", "ConfigurationsOperations", "DeploymentsOperations", + "WafPolicyOperations", + "DefaultWafPolicyOperations", "Operations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_api_keys_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_api_keys_operations.py index 70d285bb6b1b..b93f4de5da80 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_api_keys_operations.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_api_keys_operations.py @@ -5,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,17 +28,15 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._api_keys_operations import ( build_create_or_update_request, build_delete_request, build_get_request, build_list_request, ) +from .._configuration import NginxManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,10 +55,10 @@ class ApiKeysOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - 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._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload async def create_or_update( diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_certificates_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_certificates_operations.py index 5314cc4dac6f..87cadbce2cc4 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_certificates_operations.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_certificates_operations.py @@ -5,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,17 +32,15 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._certificates_operations import ( build_create_or_update_request, build_delete_request, build_get_request, build_list_request, ) +from .._configuration import NginxManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,10 +59,10 @@ class CertificatesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - 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._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( @@ -381,7 +380,7 @@ async def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -390,10 +389,18 @@ async def _delete_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Operation-Location"] = self._deserialize( + "str", response.headers.get("Operation-Location") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_configurations_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_configurations_operations.py index d5422b33ca06..5218b3f245ff 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_configurations_operations.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_configurations_operations.py @@ -5,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,6 +32,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._configurations_operations import ( build_analysis_request, build_create_or_update_request, @@ -38,11 +40,8 @@ build_get_request, build_list_request, ) +from .._configuration import NginxManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -61,10 +60,10 @@ class ConfigurationsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - 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._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -474,7 +473,7 @@ async def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -483,10 +482,18 @@ async def _delete_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Operation-Location"] = self._deserialize( + "str", response.headers.get("Operation-Location") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_default_waf_policy_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_default_waf_policy_operations.py new file mode 100644 index 000000000000..7f3ff52b45df --- /dev/null +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_default_waf_policy_operations.py @@ -0,0 +1,112 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer +from ...operations._default_waf_policy_operations import build_list_request +from .._configuration import NginxManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DefaultWafPolicyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.nginx.aio.NginxManagementClient`'s + :attr:`default_waf_policy` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def list( + self, resource_group_name: str, deployment_name: str, **kwargs: Any + ) -> _models.NginxDeploymentDefaultWafPolicyListResponse: + """Get the Nginx Waf Policy of given Nginx deployment. + + Get the Nginx Waf Policy of given Nginx deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :return: NginxDeploymentDefaultWafPolicyListResponse or the result of cls(response) + :rtype: ~azure.mgmt.nginx.models.NginxDeploymentDefaultWafPolicyListResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NginxDeploymentDefaultWafPolicyListResponse] = kwargs.pop("cls", None) + + _request = build_list_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NginxDeploymentDefaultWafPolicyListResponse", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_deployments_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_deployments_operations.py index 7936214168b3..06696278b5a7 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_deployments_operations.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_deployments_operations.py @@ -5,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,6 +32,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._deployments_operations import ( build_create_or_update_request, build_delete_request, @@ -39,11 +41,8 @@ build_list_request, build_update_request, ) +from .._configuration import NginxManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -62,10 +61,10 @@ class DeploymentsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - 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._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get(self, resource_group_name: str, deployment_name: str, **kwargs: Any) -> _models.NginxDeployment: @@ -214,7 +213,7 @@ async def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of targeted NGINX deployment. Required. :type deployment_name: str - :param body: Default value is None. + :param body: The Nginx deployment. Default value is None. :type body: ~azure.mgmt.nginx.models.NginxDeployment :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -244,7 +243,7 @@ async def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of targeted NGINX deployment. Required. :type deployment_name: str - :param body: Default value is None. + :param body: The Nginx deployment. Default value is None. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -272,7 +271,8 @@ async def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of targeted NGINX deployment. Required. :type deployment_name: str - :param body: Is either a NginxDeployment type or a IO[bytes] type. Default value is None. + :param body: The Nginx deployment. Is either a NginxDeployment type or a IO[bytes] type. + Default value is None. :type body: ~azure.mgmt.nginx.models.NginxDeployment or IO[bytes] :return: An instance of AsyncLROPoller that returns either NginxDeployment or the result of cls(response) @@ -383,7 +383,7 @@ async def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -392,10 +392,18 @@ async def _update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Operation-Location"] = self._deserialize( + "str", response.headers.get("Operation-Location") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -418,7 +426,7 @@ async def begin_update( :type resource_group_name: str :param deployment_name: The name of targeted NGINX deployment. Required. :type deployment_name: str - :param body: Default value is None. + :param body: The Nginx deployment update parameters. Default value is None. :type body: ~azure.mgmt.nginx.models.NginxDeploymentUpdateParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -448,7 +456,7 @@ async def begin_update( :type resource_group_name: str :param deployment_name: The name of targeted NGINX deployment. Required. :type deployment_name: str - :param body: Default value is None. + :param body: The Nginx deployment update parameters. Default value is None. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -476,8 +484,8 @@ async def begin_update( :type resource_group_name: str :param deployment_name: The name of targeted NGINX deployment. Required. :type deployment_name: str - :param body: Is either a NginxDeploymentUpdateParameters type or a IO[bytes] type. Default - value is None. + :param body: The Nginx deployment update parameters. Is either a + NginxDeploymentUpdateParameters type or a IO[bytes] type. Default value is None. :type body: ~azure.mgmt.nginx.models.NginxDeploymentUpdateParameters or IO[bytes] :return: An instance of AsyncLROPoller that returns either NginxDeployment or the result of cls(response) @@ -515,7 +523,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -566,7 +577,7 @@ async def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -575,10 +586,18 @@ async def _delete_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Operation-Location"] = self._deserialize( + "str", response.headers.get("Operation-Location") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_operations.py index c945da5d2cef..df5ff15e01d6 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_operations.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_operations.py @@ -5,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,12 +26,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._operations import build_list_request +from .._configuration import NginxManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -49,19 +48,19 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - 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._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationResult"]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: """List all operations provided by Nginx.NginxPlus for the 2024-11-01-preview api version. List all operations provided by Nginx.NginxPlus for the 2024-11-01-preview api version. - :return: An iterator like instance of either OperationResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.nginx.models.OperationResult] + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.nginx.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_waf_policy_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_waf_policy_operations.py new file mode 100644 index 000000000000..2185b514491d --- /dev/null +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_waf_policy_operations.py @@ -0,0 +1,560 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer +from ...operations._waf_policy_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_request, +) +from .._configuration import NginxManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class WafPolicyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.nginx.aio.NginxManagementClient`'s + :attr:`waf_policy` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, deployment_name: str, waf_policy_name: str, **kwargs: Any + ) -> _models.NginxDeploymentWafPolicy: + """Get the Nginx Waf Policy of given Nginx deployment. + + Get the Nginx Waf Policy of given Nginx deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param waf_policy_name: The name of Waf Policy. Required. + :type waf_policy_name: str + :return: NginxDeploymentWafPolicy or the result of cls(response) + :rtype: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NginxDeploymentWafPolicy] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + waf_policy_name=waf_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NginxDeploymentWafPolicy", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + deployment_name: str, + waf_policy_name: str, + body: Optional[Union[_models.NginxDeploymentWafPolicy, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 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._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "NginxDeploymentWafPolicy") + else: + _json = None + + _request = build_create_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + waf_policy_name=waf_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + 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, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Operation-Location"] = self._deserialize( + "str", response.headers.get("Operation-Location") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + deployment_name: str, + waf_policy_name: str, + body: Optional[_models.NginxDeploymentWafPolicy] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NginxDeploymentWafPolicy]: + """Create or update the Nginx Waf Policy for given Nginx deployment. + + Create or update the Nginx Waf Policy for given Nginx deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param waf_policy_name: The name of Waf Policy. Required. + :type waf_policy_name: str + :param body: The Nginx Deployment Waf Policy. Default value is None. + :type body: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either NginxDeploymentWafPolicy or the + result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxDeploymentWafPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + deployment_name: str, + waf_policy_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NginxDeploymentWafPolicy]: + """Create or update the Nginx Waf Policy for given Nginx deployment. + + Create or update the Nginx Waf Policy for given Nginx deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param waf_policy_name: The name of Waf Policy. Required. + :type waf_policy_name: str + :param body: The Nginx Deployment Waf Policy. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either NginxDeploymentWafPolicy or the + result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxDeploymentWafPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + deployment_name: str, + waf_policy_name: str, + body: Optional[Union[_models.NginxDeploymentWafPolicy, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.NginxDeploymentWafPolicy]: + """Create or update the Nginx Waf Policy for given Nginx deployment. + + Create or update the Nginx Waf Policy for given Nginx deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param waf_policy_name: The name of Waf Policy. Required. + :type waf_policy_name: str + :param body: The Nginx Deployment Waf Policy. Is either a NginxDeploymentWafPolicy type or a + IO[bytes] type. Default value is None. + :type body: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicy or IO[bytes] + :return: An instance of AsyncLROPoller that returns either NginxDeploymentWafPolicy or the + result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxDeploymentWafPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _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._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NginxDeploymentWafPolicy] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + waf_policy_name=waf_policy_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NginxDeploymentWafPolicy", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.NginxDeploymentWafPolicy].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.NginxDeploymentWafPolicy]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, deployment_name: str, waf_policy_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + waf_policy_name=waf_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + 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 [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Operation-Location"] = self._deserialize( + "str", response.headers.get("Operation-Location") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, deployment_name: str, waf_policy_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Nginx Waf Policy of given Nginx deployment to default. + + Reset the Nginx Waf Policy of given Nginx deployment to default. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param waf_policy_name: The name of Waf Policy. Required. + :type waf_policy_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + waf_policy_name=waf_policy_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, deployment_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NginxDeploymentWafPolicyMetadata"]: + """List Waf Policies of given Nginx deployment. + + List Waf Policies of given Nginx deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :return: An iterator like instance of either NginxDeploymentWafPolicyMetadata or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.nginx.models.NginxDeploymentWafPolicyMetadata] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NginxDeploymentWafPolicyListResponse] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NginxDeploymentWafPolicyListResponse", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/__init__.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/__init__.py index 159f89a3eaec..795e1fcc1637 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/__init__.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/__init__.py @@ -15,10 +15,8 @@ from ._models_py3 import ( # type: ignore AnalysisCreate, - AnalysisCreateConfig, AnalysisDiagnostic, AnalysisResult, - AnalysisResultData, AutoUpgradeProfile, DiagnosticItem, ErrorAdditionalInfo, @@ -44,14 +42,21 @@ NginxDeploymentApiKeyRequestProperties, NginxDeploymentApiKeyResponse, NginxDeploymentApiKeyResponseProperties, + NginxDeploymentDefaultWafPolicyListResponse, + NginxDeploymentDefaultWafPolicyProperties, NginxDeploymentListResponse, NginxDeploymentProperties, - NginxDeploymentPropertiesNginxAppProtect, NginxDeploymentScalingProperties, NginxDeploymentUpdateParameters, NginxDeploymentUpdateProperties, - NginxDeploymentUpdatePropertiesNginxAppProtect, NginxDeploymentUserProfile, + NginxDeploymentWafPolicy, + NginxDeploymentWafPolicyApplyingStatus, + NginxDeploymentWafPolicyCompilingStatus, + NginxDeploymentWafPolicyListResponse, + NginxDeploymentWafPolicyMetadata, + NginxDeploymentWafPolicyMetadataProperties, + NginxDeploymentWafPolicyProperties, NginxFrontendIPConfiguration, NginxLogging, NginxNetworkInterfaceConfiguration, @@ -59,12 +64,13 @@ NginxPrivateIPAddress, NginxPublicIPAddress, NginxStorageAccount, + Operation, OperationDisplay, + OperationDisplayAutoGenerated, OperationListResult, OperationResult, ResourceSku, ScaleProfile, - ScaleProfileCapacity, SystemData, UserIdentityProperties, WebApplicationFirewallComponentVersions, @@ -74,11 +80,15 @@ ) from ._nginx_management_client_enums import ( # type: ignore + ActionType, ActivationState, CreatedByType, IdentityType, Level, + NginxDeploymentWafPolicyApplyingStatusCode, + NginxDeploymentWafPolicyCompilingStatusCode, NginxPrivateIPAllocationMethod, + Origin, ProvisioningState, ) from ._patch import __all__ as _patch_all @@ -87,10 +97,8 @@ __all__ = [ "AnalysisCreate", - "AnalysisCreateConfig", "AnalysisDiagnostic", "AnalysisResult", - "AnalysisResultData", "AutoUpgradeProfile", "DiagnosticItem", "ErrorAdditionalInfo", @@ -116,14 +124,21 @@ "NginxDeploymentApiKeyRequestProperties", "NginxDeploymentApiKeyResponse", "NginxDeploymentApiKeyResponseProperties", + "NginxDeploymentDefaultWafPolicyListResponse", + "NginxDeploymentDefaultWafPolicyProperties", "NginxDeploymentListResponse", "NginxDeploymentProperties", - "NginxDeploymentPropertiesNginxAppProtect", "NginxDeploymentScalingProperties", "NginxDeploymentUpdateParameters", "NginxDeploymentUpdateProperties", - "NginxDeploymentUpdatePropertiesNginxAppProtect", "NginxDeploymentUserProfile", + "NginxDeploymentWafPolicy", + "NginxDeploymentWafPolicyApplyingStatus", + "NginxDeploymentWafPolicyCompilingStatus", + "NginxDeploymentWafPolicyListResponse", + "NginxDeploymentWafPolicyMetadata", + "NginxDeploymentWafPolicyMetadataProperties", + "NginxDeploymentWafPolicyProperties", "NginxFrontendIPConfiguration", "NginxLogging", "NginxNetworkInterfaceConfiguration", @@ -131,23 +146,28 @@ "NginxPrivateIPAddress", "NginxPublicIPAddress", "NginxStorageAccount", + "Operation", "OperationDisplay", + "OperationDisplayAutoGenerated", "OperationListResult", "OperationResult", "ResourceSku", "ScaleProfile", - "ScaleProfileCapacity", "SystemData", "UserIdentityProperties", "WebApplicationFirewallComponentVersions", "WebApplicationFirewallPackage", "WebApplicationFirewallSettings", "WebApplicationFirewallStatus", + "ActionType", "ActivationState", "CreatedByType", "IdentityType", "Level", + "NginxDeploymentWafPolicyApplyingStatusCode", + "NginxDeploymentWafPolicyCompilingStatusCode", "NginxPrivateIPAllocationMethod", + "Origin", "ProvisioningState", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/_models_py3.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/_models_py3.py index d050ced9d383..1ebaeef53afe 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/_models_py3.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/_models_py3.py @@ -10,7 +10,7 @@ import datetime from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union -from .. import _serialization +from .._utils import serialization as _serialization if TYPE_CHECKING: from .. import models as _models @@ -19,32 +19,6 @@ class AnalysisCreate(_serialization.Model): """The request body for creating an analysis for an NGINX configuration. - All required parameters must be populated in order to send to server. - - :ivar config: Required. - :vartype config: ~azure.mgmt.nginx.models.AnalysisCreateConfig - """ - - _validation = { - "config": {"required": True}, - } - - _attribute_map = { - "config": {"key": "config", "type": "AnalysisCreateConfig"}, - } - - def __init__(self, *, config: "_models.AnalysisCreateConfig", **kwargs: Any) -> None: - """ - :keyword config: Required. - :paramtype config: ~azure.mgmt.nginx.models.AnalysisCreateConfig - """ - super().__init__(**kwargs) - self.config = config - - -class AnalysisCreateConfig(_serialization.Model): - """AnalysisCreateConfig. - :ivar root_file: The root file of the NGINX config file(s). It must match one of the files' filepath. :vartype root_file: str @@ -52,15 +26,15 @@ class AnalysisCreateConfig(_serialization.Model): :vartype files: list[~azure.mgmt.nginx.models.NginxConfigurationFile] :ivar protected_files: :vartype protected_files: list[~azure.mgmt.nginx.models.NginxConfigurationProtectedFileRequest] - :ivar package: + :ivar package: Nginx Configuration Package. :vartype package: ~azure.mgmt.nginx.models.NginxConfigurationPackage """ _attribute_map = { - "root_file": {"key": "rootFile", "type": "str"}, - "files": {"key": "files", "type": "[NginxConfigurationFile]"}, - "protected_files": {"key": "protectedFiles", "type": "[NginxConfigurationProtectedFileRequest]"}, - "package": {"key": "package", "type": "NginxConfigurationPackage"}, + "root_file": {"key": "config.rootFile", "type": "str"}, + "files": {"key": "config.files", "type": "[NginxConfigurationFile]"}, + "protected_files": {"key": "config.protectedFiles", "type": "[NginxConfigurationProtectedFileRequest]"}, + "package": {"key": "config.package", "type": "NginxConfigurationPackage"}, } def __init__( @@ -81,7 +55,7 @@ def __init__( :keyword protected_files: :paramtype protected_files: list[~azure.mgmt.nginx.models.NginxConfigurationProtectedFileRequest] - :keyword package: + :keyword package: Nginx Configuration Package. :paramtype package: ~azure.mgmt.nginx.models.NginxConfigurationPackage """ super().__init__(**kwargs) @@ -176,8 +150,10 @@ class AnalysisResult(_serialization.Model): :ivar status: The status of the analysis. Required. :vartype status: str - :ivar data: - :vartype data: ~azure.mgmt.nginx.models.AnalysisResultData + :ivar errors: + :vartype errors: list[~azure.mgmt.nginx.models.AnalysisDiagnostic] + :ivar diagnostics: + :vartype diagnostics: list[~azure.mgmt.nginx.models.DiagnosticItem] """ _validation = { @@ -186,49 +162,28 @@ class AnalysisResult(_serialization.Model): _attribute_map = { "status": {"key": "status", "type": "str"}, - "data": {"key": "data", "type": "AnalysisResultData"}, - } - - def __init__(self, *, status: str, data: Optional["_models.AnalysisResultData"] = None, **kwargs: Any) -> None: - """ - :keyword status: The status of the analysis. Required. - :paramtype status: str - :keyword data: - :paramtype data: ~azure.mgmt.nginx.models.AnalysisResultData - """ - super().__init__(**kwargs) - self.status = status - self.data = data - - -class AnalysisResultData(_serialization.Model): - """AnalysisResultData. - - :ivar errors: - :vartype errors: list[~azure.mgmt.nginx.models.AnalysisDiagnostic] - :ivar diagnostics: - :vartype diagnostics: list[~azure.mgmt.nginx.models.DiagnosticItem] - """ - - _attribute_map = { - "errors": {"key": "errors", "type": "[AnalysisDiagnostic]"}, - "diagnostics": {"key": "diagnostics", "type": "[DiagnosticItem]"}, + "errors": {"key": "data.errors", "type": "[AnalysisDiagnostic]"}, + "diagnostics": {"key": "data.diagnostics", "type": "[DiagnosticItem]"}, } def __init__( self, *, + status: str, errors: Optional[List["_models.AnalysisDiagnostic"]] = None, diagnostics: Optional[List["_models.DiagnosticItem"]] = None, **kwargs: Any ) -> None: """ + :keyword status: The status of the analysis. Required. + :paramtype status: str :keyword errors: :paramtype errors: list[~azure.mgmt.nginx.models.AnalysisDiagnostic] :keyword diagnostics: :paramtype diagnostics: list[~azure.mgmt.nginx.models.DiagnosticItem] """ super().__init__(**kwargs) + self.status = status self.errors = errors self.diagnostics = diagnostics @@ -377,8 +332,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorDetail(_serialization.Model): @@ -417,11 +372,11 @@ class ErrorDetail(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorDetail"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ErrorResponse(_serialization.Model): @@ -446,7 +401,7 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: A class IdentityProperties(_serialization.Model): - """IdentityProperties. + """Identity Properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -454,8 +409,8 @@ class IdentityProperties(_serialization.Model): :vartype principal_id: str :ivar tenant_id: :vartype tenant_id: str - :ivar type: Known values are: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", - and "None". + :ivar type: Identity Type. Known values are: "SystemAssigned", "UserAssigned", "SystemAssigned, + UserAssigned", and "None". :vartype type: str or ~azure.mgmt.nginx.models.IdentityType :ivar user_assigned_identities: Dictionary of :code:``. :vartype user_assigned_identities: dict[str, ~azure.mgmt.nginx.models.UserIdentityProperties] @@ -481,21 +436,21 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword type: Known values are: "SystemAssigned", "UserAssigned", "SystemAssigned, - UserAssigned", and "None". + :keyword type: Identity Type. Known values are: "SystemAssigned", "UserAssigned", + "SystemAssigned, UserAssigned", and "None". :paramtype type: str or ~azure.mgmt.nginx.models.IdentityType :keyword user_assigned_identities: Dictionary of :code:``. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.nginx.models.UserIdentityProperties] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.user_assigned_identities = user_assigned_identities class NginxCertificate(_serialization.Model): - """NginxCertificate. + """Nginx Certificate. Variables are only populated by the server, and will be ignored when sending a request. @@ -505,10 +460,8 @@ class NginxCertificate(_serialization.Model): :vartype name: str :ivar type: :vartype type: str - :ivar properties: + :ivar properties: Nginx Certificate Properties. :vartype properties: ~azure.mgmt.nginx.models.NginxCertificateProperties - :ivar location: - :vartype location: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.nginx.models.SystemData """ @@ -525,34 +478,24 @@ class NginxCertificate(_serialization.Model): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "properties": {"key": "properties", "type": "NginxCertificateProperties"}, - "location": {"key": "location", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__( - self, - *, - properties: Optional["_models.NginxCertificateProperties"] = None, - location: Optional[str] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, properties: Optional["_models.NginxCertificateProperties"] = None, **kwargs: Any) -> None: """ - :keyword properties: + :keyword properties: Nginx Certificate Properties. :paramtype properties: ~azure.mgmt.nginx.models.NginxCertificateProperties - :keyword location: - :paramtype location: str """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.properties = properties - self.location = location - self.system_data = None + self.system_data: Optional["_models.SystemData"] = None class NginxCertificateErrorResponseBody(_serialization.Model): - """NginxCertificateErrorResponseBody. + """Nginx Certificate Error Response Body. :ivar code: :vartype code: str @@ -578,7 +521,7 @@ def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, class NginxCertificateListResponse(_serialization.Model): - """NginxCertificateListResponse. + """Nginx Certificate List Response. :ivar value: :vartype value: list[~azure.mgmt.nginx.models.NginxCertificate] @@ -610,12 +553,12 @@ def __init__( class NginxCertificateProperties(_serialization.Model): - """NginxCertificateProperties. + """Nginx Certificate Properties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: Known values are: "Accepted", "Creating", "Updating", "Deleting", - "Succeeded", "Failed", "Canceled", "Deleted", and "NotSpecified". + :ivar provisioning_state: Provisioning State. Known values are: "Accepted", "Creating", + "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", and "NotSpecified". :vartype provisioning_state: str or ~azure.mgmt.nginx.models.ProvisioningState :ivar key_virtual_path: :vartype key_virtual_path: str @@ -629,7 +572,7 @@ class NginxCertificateProperties(_serialization.Model): :vartype key_vault_secret_version: str :ivar key_vault_secret_created: :vartype key_vault_secret_created: ~datetime.datetime - :ivar certificate_error: + :ivar certificate_error: Nginx Certificate Error Response Body. :vartype certificate_error: ~azure.mgmt.nginx.models.NginxCertificateErrorResponseBody """ @@ -667,22 +610,22 @@ def __init__( :paramtype certificate_virtual_path: str :keyword key_vault_secret_id: :paramtype key_vault_secret_id: str - :keyword certificate_error: + :keyword certificate_error: Nginx Certificate Error Response Body. :paramtype certificate_error: ~azure.mgmt.nginx.models.NginxCertificateErrorResponseBody """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None self.key_virtual_path = key_virtual_path self.certificate_virtual_path = certificate_virtual_path self.key_vault_secret_id = key_vault_secret_id - self.sha1_thumbprint = None - self.key_vault_secret_version = None - self.key_vault_secret_created = None + self.sha1_thumbprint: Optional[str] = None + self.key_vault_secret_version: Optional[str] = None + self.key_vault_secret_created: Optional[datetime.datetime] = None self.certificate_error = certificate_error class NginxConfigurationFile(_serialization.Model): - """NginxConfigurationFile. + """Nginx Configuration File. :ivar content: :vartype content: str @@ -740,7 +683,7 @@ def __init__( class NginxConfigurationPackage(_serialization.Model): - """NginxConfigurationPackage. + """Nginx Configuration Package. :ivar data: :vartype data: str @@ -768,7 +711,7 @@ def __init__( class NginxConfigurationProtectedFileRequest(_serialization.Model): - """NginxConfigurationProtectedFileRequest. + """Nginx Configuration Protected File Request. :ivar content: The content of the protected file. This value is a PUT only value. If you perform a GET request on this value, it will be empty because it is a protected file. @@ -811,7 +754,7 @@ def __init__( class NginxConfigurationProtectedFileResponse(_serialization.Model): - """NginxConfigurationProtectedFileResponse. + """Nginx Configuration Protected File Response. :ivar virtual_path: The virtual path of the protected file. :vartype virtual_path: str @@ -841,7 +784,7 @@ def __init__( class NginxConfigurationRequest(_serialization.Model): - """NginxConfigurationRequest. + """Nginx Configuration Request. Variables are only populated by the server, and will be ignored when sending a request. @@ -851,7 +794,7 @@ class NginxConfigurationRequest(_serialization.Model): :vartype name: str :ivar type: :vartype type: str - :ivar properties: + :ivar properties: Nginx Configuration Request Properties. :vartype properties: ~azure.mgmt.nginx.models.NginxConfigurationRequestProperties :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.nginx.models.SystemData @@ -876,30 +819,30 @@ def __init__( self, *, properties: Optional["_models.NginxConfigurationRequestProperties"] = None, **kwargs: Any ) -> None: """ - :keyword properties: + :keyword properties: Nginx Configuration Request Properties. :paramtype properties: ~azure.mgmt.nginx.models.NginxConfigurationRequestProperties """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.properties = properties - self.system_data = None + self.system_data: Optional["_models.SystemData"] = None class NginxConfigurationRequestProperties(_serialization.Model): - """NginxConfigurationRequestProperties. + """Nginx Configuration Request Properties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: Known values are: "Accepted", "Creating", "Updating", "Deleting", - "Succeeded", "Failed", "Canceled", "Deleted", and "NotSpecified". + :ivar provisioning_state: Provisioning State. Known values are: "Accepted", "Creating", + "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", and "NotSpecified". :vartype provisioning_state: str or ~azure.mgmt.nginx.models.ProvisioningState :ivar files: :vartype files: list[~azure.mgmt.nginx.models.NginxConfigurationFile] :ivar protected_files: :vartype protected_files: list[~azure.mgmt.nginx.models.NginxConfigurationProtectedFileRequest] - :ivar package: + :ivar package: Nginx Configuration Package. :vartype package: ~azure.mgmt.nginx.models.NginxConfigurationPackage :ivar root_file: :vartype root_file: str @@ -932,13 +875,13 @@ def __init__( :keyword protected_files: :paramtype protected_files: list[~azure.mgmt.nginx.models.NginxConfigurationProtectedFileRequest] - :keyword package: + :keyword package: Nginx Configuration Package. :paramtype package: ~azure.mgmt.nginx.models.NginxConfigurationPackage :keyword root_file: :paramtype root_file: str """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None self.files = files self.protected_files = protected_files self.package = package @@ -946,7 +889,7 @@ def __init__( class NginxConfigurationResponse(_serialization.Model): - """NginxConfigurationResponse. + """Nginx Configuration Response. Variables are only populated by the server, and will be ignored when sending a request. @@ -956,7 +899,7 @@ class NginxConfigurationResponse(_serialization.Model): :vartype name: str :ivar type: :vartype type: str - :ivar properties: + :ivar properties: Nginx Configuration Response Properties. :vartype properties: ~azure.mgmt.nginx.models.NginxConfigurationResponseProperties :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.nginx.models.SystemData @@ -981,31 +924,31 @@ def __init__( self, *, properties: Optional["_models.NginxConfigurationResponseProperties"] = None, **kwargs: Any ) -> None: """ - :keyword properties: + :keyword properties: Nginx Configuration Response Properties. :paramtype properties: ~azure.mgmt.nginx.models.NginxConfigurationResponseProperties """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.properties = properties - self.system_data = None + self.system_data: Optional["_models.SystemData"] = None class NginxConfigurationResponseProperties(_serialization.Model): - """NginxConfigurationResponseProperties. + """Nginx Configuration Response Properties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: Known values are: "Accepted", "Creating", "Updating", "Deleting", - "Succeeded", "Failed", "Canceled", "Deleted", and "NotSpecified". + :ivar provisioning_state: Provisioning State. Known values are: "Accepted", "Creating", + "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", and "NotSpecified". :vartype provisioning_state: str or ~azure.mgmt.nginx.models.ProvisioningState :ivar files: :vartype files: list[~azure.mgmt.nginx.models.NginxConfigurationFile] :ivar protected_files: :vartype protected_files: list[~azure.mgmt.nginx.models.NginxConfigurationProtectedFileResponse] - :ivar package: + :ivar package: Nginx Configuration Package. :vartype package: ~azure.mgmt.nginx.models.NginxConfigurationPackage :ivar root_file: :vartype root_file: str @@ -1038,13 +981,13 @@ def __init__( :keyword protected_files: :paramtype protected_files: list[~azure.mgmt.nginx.models.NginxConfigurationProtectedFileResponse] - :keyword package: + :keyword package: Nginx Configuration Package. :paramtype package: ~azure.mgmt.nginx.models.NginxConfigurationPackage :keyword root_file: :paramtype root_file: str """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None self.files = files self.protected_files = protected_files self.package = package @@ -1052,7 +995,7 @@ def __init__( class NginxDeployment(_serialization.Model): - """NginxDeployment. + """Nginx Deployment. Variables are only populated by the server, and will be ignored when sending a request. @@ -1062,15 +1005,15 @@ class NginxDeployment(_serialization.Model): :vartype name: str :ivar type: :vartype type: str - :ivar identity: + :ivar identity: Identity Properties. :vartype identity: ~azure.mgmt.nginx.models.IdentityProperties - :ivar properties: + :ivar properties: Nginx Deployment Properties. :vartype properties: ~azure.mgmt.nginx.models.NginxDeploymentProperties :ivar tags: Dictionary of :code:``. :vartype tags: dict[str, str] - :ivar sku: + :ivar sku: Resource Sku. :vartype sku: ~azure.mgmt.nginx.models.ResourceSku - :ivar location: + :ivar location: The geo-location where the resource lives. :vartype location: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.nginx.models.SystemData @@ -1106,31 +1049,31 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword identity: + :keyword identity: Identity Properties. :paramtype identity: ~azure.mgmt.nginx.models.IdentityProperties - :keyword properties: + :keyword properties: Nginx Deployment Properties. :paramtype properties: ~azure.mgmt.nginx.models.NginxDeploymentProperties :keyword tags: Dictionary of :code:``. :paramtype tags: dict[str, str] - :keyword sku: + :keyword sku: Resource Sku. :paramtype sku: ~azure.mgmt.nginx.models.ResourceSku - :keyword location: + :keyword location: The geo-location where the resource lives. :paramtype location: str """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.identity = identity self.properties = properties self.tags = tags self.sku = sku self.location = location - self.system_data = None + self.system_data: Optional["_models.SystemData"] = None class NginxDeploymentApiKeyListResponse(_serialization.Model): - """NginxDeploymentApiKeyListResponse. + """Nginx Deployment Api Key List Response. :ivar value: :vartype value: list[~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse] @@ -1162,7 +1105,7 @@ def __init__( class NginxDeploymentApiKeyRequest(_serialization.Model): - """NginxDeploymentApiKeyRequest. + """Nginx Deployment Api Key Request. Variables are only populated by the server, and will be ignored when sending a request. @@ -1172,14 +1115,17 @@ class NginxDeploymentApiKeyRequest(_serialization.Model): :vartype name: str :ivar type: :vartype type: str - :ivar properties: + :ivar properties: Nginx Deployment Api Key Request Properties. :vartype properties: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyRequestProperties + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.nginx.models.SystemData """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { @@ -1187,24 +1133,26 @@ class NginxDeploymentApiKeyRequest(_serialization.Model): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "properties": {"key": "properties", "type": "NginxDeploymentApiKeyRequestProperties"}, + "system_data": {"key": "systemData", "type": "SystemData"}, } def __init__( self, *, properties: Optional["_models.NginxDeploymentApiKeyRequestProperties"] = None, **kwargs: Any ) -> None: """ - :keyword properties: + :keyword properties: Nginx Deployment Api Key Request Properties. :paramtype properties: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyRequestProperties """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.properties = properties + self.system_data: Optional["_models.SystemData"] = None class NginxDeploymentApiKeyRequestProperties(_serialization.Model): - """NginxDeploymentApiKeyRequestProperties. + """Nginx Deployment Api Key Request Properties. :ivar secret_text: Secret text to be used as a Dataplane API Key. This is a write only property that can never be read back, but the first three characters will be returned in the 'hint' @@ -1236,7 +1184,7 @@ def __init__( class NginxDeploymentApiKeyResponse(_serialization.Model): - """NginxDeploymentApiKeyResponse. + """Nginx Deployment Api Key Response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1246,14 +1194,17 @@ class NginxDeploymentApiKeyResponse(_serialization.Model): :vartype name: str :ivar type: :vartype type: str - :ivar properties: + :ivar properties: Nginx Deployment Api Key Response Properties. :vartype properties: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponseProperties + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.nginx.models.SystemData """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { @@ -1261,24 +1212,26 @@ class NginxDeploymentApiKeyResponse(_serialization.Model): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "properties": {"key": "properties", "type": "NginxDeploymentApiKeyResponseProperties"}, + "system_data": {"key": "systemData", "type": "SystemData"}, } def __init__( self, *, properties: Optional["_models.NginxDeploymentApiKeyResponseProperties"] = None, **kwargs: Any ) -> None: """ - :keyword properties: + :keyword properties: Nginx Deployment Api Key Response Properties. :paramtype properties: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponseProperties """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.properties = properties + self.system_data: Optional["_models.SystemData"] = None class NginxDeploymentApiKeyResponseProperties(_serialization.Model): - """NginxDeploymentApiKeyResponseProperties. + """Nginx Deployment Api Key Response Properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -1304,12 +1257,72 @@ def __init__(self, *, end_date_time: Optional[datetime.datetime] = None, **kwarg :paramtype end_date_time: ~datetime.datetime """ super().__init__(**kwargs) - self.hint = None + self.hint: Optional[str] = None self.end_date_time = end_date_time +class NginxDeploymentDefaultWafPolicyListResponse(_serialization.Model): # pylint: disable=name-too-long + """Nginx Deployment Default Waf Policy List Response. + + :ivar value: + :vartype value: list[~azure.mgmt.nginx.models.NginxDeploymentDefaultWafPolicyProperties] + :ivar next_link: + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[NginxDeploymentDefaultWafPolicyProperties]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.NginxDeploymentDefaultWafPolicyProperties"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: + :paramtype value: list[~azure.mgmt.nginx.models.NginxDeploymentDefaultWafPolicyProperties] + :keyword next_link: + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NginxDeploymentDefaultWafPolicyProperties(_serialization.Model): # pylint: disable=name-too-long + """Nginx Deployment Default Waf Policy Properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar content: + :vartype content: bytes + :ivar filepath: + :vartype filepath: str + """ + + _validation = { + "content": {"readonly": True}, + "filepath": {"readonly": True}, + } + + _attribute_map = { + "content": {"key": "content", "type": "bytearray"}, + "filepath": {"key": "filepath", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.content: Optional[bytes] = None + self.filepath: Optional[str] = None + + class NginxDeploymentListResponse(_serialization.Model): - """NginxDeploymentListResponse. + """Nginx Deployment List Response. :ivar value: :vartype value: list[~azure.mgmt.nginx.models.NginxDeployment] @@ -1337,34 +1350,39 @@ def __init__( class NginxDeploymentProperties(_serialization.Model): - """NginxDeploymentProperties. + """Nginx Deployment Properties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: Known values are: "Accepted", "Creating", "Updating", "Deleting", - "Succeeded", "Failed", "Canceled", "Deleted", and "NotSpecified". + :ivar provisioning_state: Provisioning State. Known values are: "Accepted", "Creating", + "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", and "NotSpecified". :vartype provisioning_state: str or ~azure.mgmt.nginx.models.ProvisioningState :ivar nginx_version: :vartype nginx_version: str - :ivar network_profile: + :ivar network_profile: Nginx Network Profile. :vartype network_profile: ~azure.mgmt.nginx.models.NginxNetworkProfile :ivar ip_address: The IP address of the deployment. :vartype ip_address: str :ivar enable_diagnostics_support: :vartype enable_diagnostics_support: bool - :ivar logging: + :ivar logging: Nginx Logging. :vartype logging: ~azure.mgmt.nginx.models.NginxLogging :ivar scaling_properties: Information on how the deployment will be scaled. :vartype scaling_properties: ~azure.mgmt.nginx.models.NginxDeploymentScalingProperties :ivar auto_upgrade_profile: Autoupgrade settings of a deployment. :vartype auto_upgrade_profile: ~azure.mgmt.nginx.models.AutoUpgradeProfile - :ivar user_profile: + :ivar user_profile: Nginx Deployment User Profile. :vartype user_profile: ~azure.mgmt.nginx.models.NginxDeploymentUserProfile - :ivar nginx_app_protect: Settings for NGINX App Protect (NAP). - :vartype nginx_app_protect: ~azure.mgmt.nginx.models.NginxDeploymentPropertiesNginxAppProtect :ivar dataplane_api_endpoint: Dataplane API endpoint for the caller to update the NGINX state of the deployment. :vartype dataplane_api_endpoint: str + :ivar web_application_firewall_settings: Settings for the NGINX App Protect Web Application + Firewall (WAF). + :vartype web_application_firewall_settings: + ~azure.mgmt.nginx.models.WebApplicationFirewallSettings + :ivar web_application_firewall_status: The status of the NGINX App Protect Web Application + Firewall. + :vartype web_application_firewall_status: ~azure.mgmt.nginx.models.WebApplicationFirewallStatus """ _validation = { @@ -1372,6 +1390,7 @@ class NginxDeploymentProperties(_serialization.Model): "nginx_version": {"readonly": True}, "ip_address": {"readonly": True}, "dataplane_api_endpoint": {"readonly": True}, + "web_application_firewall_status": {"readonly": True}, } _attribute_map = { @@ -1384,8 +1403,15 @@ class NginxDeploymentProperties(_serialization.Model): "scaling_properties": {"key": "scalingProperties", "type": "NginxDeploymentScalingProperties"}, "auto_upgrade_profile": {"key": "autoUpgradeProfile", "type": "AutoUpgradeProfile"}, "user_profile": {"key": "userProfile", "type": "NginxDeploymentUserProfile"}, - "nginx_app_protect": {"key": "nginxAppProtect", "type": "NginxDeploymentPropertiesNginxAppProtect"}, "dataplane_api_endpoint": {"key": "dataplaneApiEndpoint", "type": "str"}, + "web_application_firewall_settings": { + "key": "nginxAppProtect.webApplicationFirewallSettings", + "type": "WebApplicationFirewallSettings", + }, + "web_application_firewall_status": { + "key": "nginxAppProtect.webApplicationFirewallStatus", + "type": "WebApplicationFirewallStatus", + }, } def __init__( @@ -1397,83 +1423,40 @@ def __init__( scaling_properties: Optional["_models.NginxDeploymentScalingProperties"] = None, auto_upgrade_profile: Optional["_models.AutoUpgradeProfile"] = None, user_profile: Optional["_models.NginxDeploymentUserProfile"] = None, - nginx_app_protect: Optional["_models.NginxDeploymentPropertiesNginxAppProtect"] = None, + web_application_firewall_settings: Optional["_models.WebApplicationFirewallSettings"] = None, **kwargs: Any ) -> None: """ - :keyword network_profile: + :keyword network_profile: Nginx Network Profile. :paramtype network_profile: ~azure.mgmt.nginx.models.NginxNetworkProfile :keyword enable_diagnostics_support: :paramtype enable_diagnostics_support: bool - :keyword logging: + :keyword logging: Nginx Logging. :paramtype logging: ~azure.mgmt.nginx.models.NginxLogging :keyword scaling_properties: Information on how the deployment will be scaled. :paramtype scaling_properties: ~azure.mgmt.nginx.models.NginxDeploymentScalingProperties :keyword auto_upgrade_profile: Autoupgrade settings of a deployment. :paramtype auto_upgrade_profile: ~azure.mgmt.nginx.models.AutoUpgradeProfile - :keyword user_profile: + :keyword user_profile: Nginx Deployment User Profile. :paramtype user_profile: ~azure.mgmt.nginx.models.NginxDeploymentUserProfile - :keyword nginx_app_protect: Settings for NGINX App Protect (NAP). - :paramtype nginx_app_protect: ~azure.mgmt.nginx.models.NginxDeploymentPropertiesNginxAppProtect + :keyword web_application_firewall_settings: Settings for the NGINX App Protect Web Application + Firewall (WAF). + :paramtype web_application_firewall_settings: + ~azure.mgmt.nginx.models.WebApplicationFirewallSettings """ super().__init__(**kwargs) - self.provisioning_state = None - self.nginx_version = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None + self.nginx_version: Optional[str] = None self.network_profile = network_profile - self.ip_address = None + self.ip_address: Optional[str] = None self.enable_diagnostics_support = enable_diagnostics_support self.logging = logging self.scaling_properties = scaling_properties self.auto_upgrade_profile = auto_upgrade_profile self.user_profile = user_profile - self.nginx_app_protect = nginx_app_protect - self.dataplane_api_endpoint = None - - -class NginxDeploymentPropertiesNginxAppProtect(_serialization.Model): - """Settings for NGINX App Protect (NAP). - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar web_application_firewall_settings: Settings for the NGINX App Protect Web Application - Firewall (WAF). Required. - :vartype web_application_firewall_settings: - ~azure.mgmt.nginx.models.WebApplicationFirewallSettings - :ivar web_application_firewall_status: The status of the NGINX App Protect Web Application - Firewall. - :vartype web_application_firewall_status: ~azure.mgmt.nginx.models.WebApplicationFirewallStatus - """ - - _validation = { - "web_application_firewall_settings": {"required": True}, - "web_application_firewall_status": {"readonly": True}, - } - - _attribute_map = { - "web_application_firewall_settings": { - "key": "webApplicationFirewallSettings", - "type": "WebApplicationFirewallSettings", - }, - "web_application_firewall_status": { - "key": "webApplicationFirewallStatus", - "type": "WebApplicationFirewallStatus", - }, - } - - def __init__( - self, *, web_application_firewall_settings: "_models.WebApplicationFirewallSettings", **kwargs: Any - ) -> None: - """ - :keyword web_application_firewall_settings: Settings for the NGINX App Protect Web Application - Firewall (WAF). Required. - :paramtype web_application_firewall_settings: - ~azure.mgmt.nginx.models.WebApplicationFirewallSettings - """ - super().__init__(**kwargs) + self.dataplane_api_endpoint: Optional[str] = None self.web_application_firewall_settings = web_application_firewall_settings - self.web_application_firewall_status = None + self.web_application_firewall_status: Optional["_models.WebApplicationFirewallStatus"] = None class NginxDeploymentScalingProperties(_serialization.Model): @@ -1505,17 +1488,17 @@ def __init__( class NginxDeploymentUpdateParameters(_serialization.Model): - """NginxDeploymentUpdateParameters. + """Nginx Deployment Update Parameters. - :ivar identity: + :ivar identity: Identity Properties. :vartype identity: ~azure.mgmt.nginx.models.IdentityProperties :ivar tags: Dictionary of :code:``. :vartype tags: dict[str, str] - :ivar sku: + :ivar sku: Resource Sku. :vartype sku: ~azure.mgmt.nginx.models.ResourceSku - :ivar location: + :ivar location: The geo-location where the resource lives. :vartype location: str - :ivar properties: + :ivar properties: Nginx Deployment Update Properties. :vartype properties: ~azure.mgmt.nginx.models.NginxDeploymentUpdateProperties """ @@ -1538,15 +1521,15 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword identity: + :keyword identity: Identity Properties. :paramtype identity: ~azure.mgmt.nginx.models.IdentityProperties :keyword tags: Dictionary of :code:``. :paramtype tags: dict[str, str] - :keyword sku: + :keyword sku: Resource Sku. :paramtype sku: ~azure.mgmt.nginx.models.ResourceSku - :keyword location: + :keyword location: The geo-location where the resource lives. :paramtype location: str - :keyword properties: + :keyword properties: Nginx Deployment Update Properties. :paramtype properties: ~azure.mgmt.nginx.models.NginxDeploymentUpdateProperties """ super().__init__(**kwargs) @@ -1558,23 +1541,24 @@ def __init__( class NginxDeploymentUpdateProperties(_serialization.Model): - """NginxDeploymentUpdateProperties. + """Nginx Deployment Update Properties. :ivar enable_diagnostics_support: :vartype enable_diagnostics_support: bool - :ivar logging: + :ivar logging: Nginx Logging. :vartype logging: ~azure.mgmt.nginx.models.NginxLogging :ivar scaling_properties: Information on how the deployment will be scaled. :vartype scaling_properties: ~azure.mgmt.nginx.models.NginxDeploymentScalingProperties - :ivar user_profile: + :ivar user_profile: Nginx Deployment User Profile. :vartype user_profile: ~azure.mgmt.nginx.models.NginxDeploymentUserProfile - :ivar network_profile: + :ivar network_profile: Nginx Network Profile. :vartype network_profile: ~azure.mgmt.nginx.models.NginxNetworkProfile :ivar auto_upgrade_profile: Autoupgrade settings of a deployment. :vartype auto_upgrade_profile: ~azure.mgmt.nginx.models.AutoUpgradeProfile - :ivar nginx_app_protect: Update settings for NGINX App Protect (NAP). - :vartype nginx_app_protect: - ~azure.mgmt.nginx.models.NginxDeploymentUpdatePropertiesNginxAppProtect + :ivar web_application_firewall_settings: Settings for the NGINX App Protect Web Application + Firewall (WAF). + :vartype web_application_firewall_settings: + ~azure.mgmt.nginx.models.WebApplicationFirewallSettings """ _attribute_map = { @@ -1584,7 +1568,10 @@ class NginxDeploymentUpdateProperties(_serialization.Model): "user_profile": {"key": "userProfile", "type": "NginxDeploymentUserProfile"}, "network_profile": {"key": "networkProfile", "type": "NginxNetworkProfile"}, "auto_upgrade_profile": {"key": "autoUpgradeProfile", "type": "AutoUpgradeProfile"}, - "nginx_app_protect": {"key": "nginxAppProtect", "type": "NginxDeploymentUpdatePropertiesNginxAppProtect"}, + "web_application_firewall_settings": { + "key": "nginxAppProtect.webApplicationFirewallSettings", + "type": "WebApplicationFirewallSettings", + }, } def __init__( @@ -1596,25 +1583,26 @@ def __init__( user_profile: Optional["_models.NginxDeploymentUserProfile"] = None, network_profile: Optional["_models.NginxNetworkProfile"] = None, auto_upgrade_profile: Optional["_models.AutoUpgradeProfile"] = None, - nginx_app_protect: Optional["_models.NginxDeploymentUpdatePropertiesNginxAppProtect"] = None, + web_application_firewall_settings: Optional["_models.WebApplicationFirewallSettings"] = None, **kwargs: Any ) -> None: """ :keyword enable_diagnostics_support: :paramtype enable_diagnostics_support: bool - :keyword logging: + :keyword logging: Nginx Logging. :paramtype logging: ~azure.mgmt.nginx.models.NginxLogging :keyword scaling_properties: Information on how the deployment will be scaled. :paramtype scaling_properties: ~azure.mgmt.nginx.models.NginxDeploymentScalingProperties - :keyword user_profile: + :keyword user_profile: Nginx Deployment User Profile. :paramtype user_profile: ~azure.mgmt.nginx.models.NginxDeploymentUserProfile - :keyword network_profile: + :keyword network_profile: Nginx Network Profile. :paramtype network_profile: ~azure.mgmt.nginx.models.NginxNetworkProfile :keyword auto_upgrade_profile: Autoupgrade settings of a deployment. :paramtype auto_upgrade_profile: ~azure.mgmt.nginx.models.AutoUpgradeProfile - :keyword nginx_app_protect: Update settings for NGINX App Protect (NAP). - :paramtype nginx_app_protect: - ~azure.mgmt.nginx.models.NginxDeploymentUpdatePropertiesNginxAppProtect + :keyword web_application_firewall_settings: Settings for the NGINX App Protect Web Application + Firewall (WAF). + :paramtype web_application_firewall_settings: + ~azure.mgmt.nginx.models.WebApplicationFirewallSettings """ super().__init__(**kwargs) self.enable_diagnostics_support = enable_diagnostics_support @@ -1623,69 +1611,320 @@ def __init__( self.user_profile = user_profile self.network_profile = network_profile self.auto_upgrade_profile = auto_upgrade_profile - self.nginx_app_protect = nginx_app_protect + self.web_application_firewall_settings = web_application_firewall_settings -class NginxDeploymentUpdatePropertiesNginxAppProtect(_serialization.Model): # pylint: disable=name-too-long - """Update settings for NGINX App Protect (NAP). +class NginxDeploymentUserProfile(_serialization.Model): + """Nginx Deployment User Profile. - :ivar web_application_firewall_settings: Settings for the NGINX App Protect Web Application - Firewall (WAF). - :vartype web_application_firewall_settings: - ~azure.mgmt.nginx.models.WebApplicationFirewallSettings + :ivar preferred_email: The preferred support contact email address of the user used for sending + alerts and notification. Can be an empty string or a valid email address. + :vartype preferred_email: str """ + _validation = { + "preferred_email": {"pattern": r"^$|^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\.)+[A-Za-z]{2,}$"}, + } + _attribute_map = { - "web_application_firewall_settings": { - "key": "webApplicationFirewallSettings", - "type": "WebApplicationFirewallSettings", - }, + "preferred_email": {"key": "preferredEmail", "type": "str"}, + } + + def __init__(self, *, preferred_email: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword preferred_email: The preferred support contact email address of the user used for + sending alerts and notification. Can be an empty string or a valid email address. + :paramtype preferred_email: str + """ + super().__init__(**kwargs) + self.preferred_email = preferred_email + + +class NginxDeploymentWafPolicy(_serialization.Model): + """Nginx Deployment Waf Policy. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: + :vartype id: str + :ivar name: + :vartype name: str + :ivar type: + :vartype type: str + :ivar properties: Nginx Deployment Waf Policy Properties. + :vartype properties: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyProperties + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.nginx.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "properties": {"key": "properties", "type": "NginxDeploymentWafPolicyProperties"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + } + + def __init__( + self, *, properties: Optional["_models.NginxDeploymentWafPolicyProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: Nginx Deployment Waf Policy Properties. + :paramtype properties: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyProperties + """ + super().__init__(**kwargs) + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.properties = properties + self.system_data: Optional["_models.SystemData"] = None + + +class NginxDeploymentWafPolicyApplyingStatus(_serialization.Model): + """Nginx Deployment Waf Policy Applying Status. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Machine readable code indicating the applying status code of a WAF Policy. Known + values are: "NotApplied", "Applying", "Succeeded", "Failed", and "Removing". + :vartype code: str or ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyApplyingStatusCode + :ivar display_status: A readable string of the current status, and sometimes have the reason + for the current state. + :vartype display_status: str + :ivar time: The date and time in UTC the current applying status was set. + :vartype time: str + """ + + _validation = { + "code": {"readonly": True}, + "display_status": {"readonly": True}, + "time": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "display_status": {"key": "displayStatus", "type": "str"}, + "time": {"key": "time", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code: Optional[Union[str, "_models.NginxDeploymentWafPolicyApplyingStatusCode"]] = None + self.display_status: Optional[str] = None + self.time: Optional[str] = None + + +class NginxDeploymentWafPolicyCompilingStatus(_serialization.Model): + """Nginx Deployment Waf Policy Compiling Status. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Machine readable code indicating the compilation status of a WAF Policy. Known + values are: "NotStarted", "InProgress", "Succeeded", and "Failed". + :vartype code: str or ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyCompilingStatusCode + :ivar display_status: A readable string of the current status, and sometimes have the reason + for the current state. If the CompilingStatus is Failed the Display Status will be The waf + Policy failed to compile. + :vartype display_status: str + :ivar time: The date and time the policy was compiled in UTC. + :vartype time: str + """ + + _validation = { + "code": {"readonly": True}, + "display_status": {"readonly": True}, + "time": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "display_status": {"key": "displayStatus", "type": "str"}, + "time": {"key": "time", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code: Optional[Union[str, "_models.NginxDeploymentWafPolicyCompilingStatusCode"]] = None + self.display_status: Optional[str] = None + self.time: Optional[str] = None + + +class NginxDeploymentWafPolicyListResponse(_serialization.Model): + """Nginx Deployment Waf Policy List Response. + + :ivar value: + :vartype value: list[~azure.mgmt.nginx.models.NginxDeploymentWafPolicyMetadata] + :ivar next_link: + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[NginxDeploymentWafPolicyMetadata]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( self, *, - web_application_firewall_settings: Optional["_models.WebApplicationFirewallSettings"] = None, + value: Optional[List["_models.NginxDeploymentWafPolicyMetadata"]] = None, + next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword web_application_firewall_settings: Settings for the NGINX App Protect Web Application - Firewall (WAF). - :paramtype web_application_firewall_settings: - ~azure.mgmt.nginx.models.WebApplicationFirewallSettings + :keyword value: + :paramtype value: list[~azure.mgmt.nginx.models.NginxDeploymentWafPolicyMetadata] + :keyword next_link: + :paramtype next_link: str """ super().__init__(**kwargs) - self.web_application_firewall_settings = web_application_firewall_settings + self.value = value + self.next_link = next_link -class NginxDeploymentUserProfile(_serialization.Model): - """NginxDeploymentUserProfile. +class NginxDeploymentWafPolicyMetadata(_serialization.Model): + """Nginx Deployment Waf Policy Metadata. - :ivar preferred_email: The preferred support contact email address of the user used for sending - alerts and notification. Can be an empty string or a valid email address. - :vartype preferred_email: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: + :vartype id: str + :ivar name: + :vartype name: str + :ivar type: + :vartype type: str + :ivar properties: Nginx Deployment Waf Policy Metadata Properties. + :vartype properties: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyMetadataProperties + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.nginx.models.SystemData """ _validation = { - "preferred_email": {"pattern": r"^$|^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\.)+[A-Za-z]{2,}$"}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { - "preferred_email": {"key": "preferredEmail", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "properties": {"key": "properties", "type": "NginxDeploymentWafPolicyMetadataProperties"}, + "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, *, preferred_email: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, *, properties: Optional["_models.NginxDeploymentWafPolicyMetadataProperties"] = None, **kwargs: Any + ) -> None: """ - :keyword preferred_email: The preferred support contact email address of the user used for - sending alerts and notification. Can be an empty string or a valid email address. - :paramtype preferred_email: str + :keyword properties: Nginx Deployment Waf Policy Metadata Properties. + :paramtype properties: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyMetadataProperties """ super().__init__(**kwargs) - self.preferred_email = preferred_email + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.properties = properties + self.system_data: Optional["_models.SystemData"] = None + + +class NginxDeploymentWafPolicyMetadataProperties(_serialization.Model): # pylint: disable=name-too-long + """Nginx Deployment Waf Policy Metadata Properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar filepath: + :vartype filepath: str + :ivar provisioning_state: Provisioning State. Known values are: "Accepted", "Creating", + "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", and "NotSpecified". + :vartype provisioning_state: str or ~azure.mgmt.nginx.models.ProvisioningState + :ivar compiling_state: Nginx Deployment Waf Policy Compiling Status. + :vartype compiling_state: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyCompilingStatus + :ivar applying_state: Nginx Deployment Waf Policy Applying Status. + :vartype applying_state: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyApplyingStatus + """ + + _validation = { + "filepath": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "compiling_state": {"readonly": True}, + "applying_state": {"readonly": True}, + } + + _attribute_map = { + "filepath": {"key": "filepath", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "compiling_state": {"key": "compilingState", "type": "NginxDeploymentWafPolicyCompilingStatus"}, + "applying_state": {"key": "applyingState", "type": "NginxDeploymentWafPolicyApplyingStatus"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.filepath: Optional[str] = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None + self.compiling_state: Optional["_models.NginxDeploymentWafPolicyCompilingStatus"] = None + self.applying_state: Optional["_models.NginxDeploymentWafPolicyApplyingStatus"] = None + + +class NginxDeploymentWafPolicyProperties(_serialization.Model): + """Nginx Deployment Waf Policy Properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Provisioning State. Known values are: "Accepted", "Creating", + "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", and "NotSpecified". + :vartype provisioning_state: str or ~azure.mgmt.nginx.models.ProvisioningState + :ivar content: The byte content of the Policy. + :vartype content: bytes + :ivar filepath: The file path where the Policy is to be saved. + :vartype filepath: str + :ivar compiling_state: Nginx Deployment Waf Policy Compiling Status. + :vartype compiling_state: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyCompilingStatus + :ivar applying_state: Nginx Deployment Waf Policy Applying Status. + :vartype applying_state: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyApplyingStatus + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "compiling_state": {"readonly": True}, + "applying_state": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "content": {"key": "content", "type": "bytearray"}, + "filepath": {"key": "filepath", "type": "str"}, + "compiling_state": {"key": "compilingState", "type": "NginxDeploymentWafPolicyCompilingStatus"}, + "applying_state": {"key": "applyingState", "type": "NginxDeploymentWafPolicyApplyingStatus"}, + } + + def __init__(self, *, content: Optional[bytes] = None, filepath: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword content: The byte content of the Policy. + :paramtype content: bytes + :keyword filepath: The file path where the Policy is to be saved. + :paramtype filepath: str + """ + super().__init__(**kwargs) + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None + self.content = content + self.filepath = filepath + self.compiling_state: Optional["_models.NginxDeploymentWafPolicyCompilingStatus"] = None + self.applying_state: Optional["_models.NginxDeploymentWafPolicyApplyingStatus"] = None class NginxFrontendIPConfiguration(_serialization.Model): - """NginxFrontendIPConfiguration. + """Nginx Frontend IP Configuration. :ivar public_ip_addresses: :vartype public_ip_addresses: list[~azure.mgmt.nginx.models.NginxPublicIPAddress] @@ -1717,9 +1956,9 @@ def __init__( class NginxLogging(_serialization.Model): - """NginxLogging. + """Nginx Logging. - :ivar storage_account: + :ivar storage_account: Nginx Storage Account. :vartype storage_account: ~azure.mgmt.nginx.models.NginxStorageAccount """ @@ -1729,7 +1968,7 @@ class NginxLogging(_serialization.Model): def __init__(self, *, storage_account: Optional["_models.NginxStorageAccount"] = None, **kwargs: Any) -> None: """ - :keyword storage_account: + :keyword storage_account: Nginx Storage Account. :paramtype storage_account: ~azure.mgmt.nginx.models.NginxStorageAccount """ super().__init__(**kwargs) @@ -1737,7 +1976,7 @@ def __init__(self, *, storage_account: Optional["_models.NginxStorageAccount"] = class NginxNetworkInterfaceConfiguration(_serialization.Model): - """NginxNetworkInterfaceConfiguration. + """Nginx Network Interface Configuration. :ivar subnet_id: :vartype subnet_id: str @@ -1757,11 +1996,11 @@ def __init__(self, *, subnet_id: Optional[str] = None, **kwargs: Any) -> None: class NginxNetworkProfile(_serialization.Model): - """NginxNetworkProfile. + """Nginx Network Profile. - :ivar front_end_ip_configuration: + :ivar front_end_ip_configuration: Nginx Frontend IP Configuration. :vartype front_end_ip_configuration: ~azure.mgmt.nginx.models.NginxFrontendIPConfiguration - :ivar network_interface_configuration: + :ivar network_interface_configuration: Nginx Network Interface Configuration. :vartype network_interface_configuration: ~azure.mgmt.nginx.models.NginxNetworkInterfaceConfiguration """ @@ -1782,9 +2021,9 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword front_end_ip_configuration: + :keyword front_end_ip_configuration: Nginx Frontend IP Configuration. :paramtype front_end_ip_configuration: ~azure.mgmt.nginx.models.NginxFrontendIPConfiguration - :keyword network_interface_configuration: + :keyword network_interface_configuration: Nginx Network Interface Configuration. :paramtype network_interface_configuration: ~azure.mgmt.nginx.models.NginxNetworkInterfaceConfiguration """ @@ -1794,11 +2033,12 @@ def __init__( class NginxPrivateIPAddress(_serialization.Model): - """NginxPrivateIPAddress. + """Nginx Private IP Address. :ivar private_ip_address: :vartype private_ip_address: str - :ivar private_ip_allocation_method: Known values are: "Static" and "Dynamic". + :ivar private_ip_allocation_method: Nginx Private IP Allocation Method. Known values are: + "Static" and "Dynamic". :vartype private_ip_allocation_method: str or ~azure.mgmt.nginx.models.NginxPrivateIPAllocationMethod :ivar subnet_id: @@ -1822,7 +2062,8 @@ def __init__( """ :keyword private_ip_address: :paramtype private_ip_address: str - :keyword private_ip_allocation_method: Known values are: "Static" and "Dynamic". + :keyword private_ip_allocation_method: Nginx Private IP Allocation Method. Known values are: + "Static" and "Dynamic". :paramtype private_ip_allocation_method: str or ~azure.mgmt.nginx.models.NginxPrivateIPAllocationMethod :keyword subnet_id: @@ -1835,7 +2076,7 @@ def __init__( class NginxPublicIPAddress(_serialization.Model): - """NginxPublicIPAddress. + """Nginx Public IP Address. :ivar id: :vartype id: str @@ -1855,7 +2096,7 @@ def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylin class NginxStorageAccount(_serialization.Model): - """NginxStorageAccount. + """Nginx Storage Account. :ivar account_name: :vartype account_name: str @@ -1882,7 +2123,99 @@ def __init__( self.container_name = container_name +class Operation(_serialization.Model): + """Details of a REST API operation, returned from the Resource Provider Operations API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for ARM/control-plane operations. + :vartype is_data_action: bool + :ivar display: Localized display information for this particular operation. + :vartype display: ~azure.mgmt.nginx.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", + and "user,system". + :vartype origin: str or ~azure.mgmt.nginx.models.Origin + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. "Internal" + :vartype action_type: str or ~azure.mgmt.nginx.models.ActionType + """ + + _validation = { + "name": {"readonly": True}, + "is_data_action": {"readonly": True}, + "origin": {"readonly": True}, + "action_type": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "is_data_action": {"key": "isDataAction", "type": "bool"}, + "display": {"key": "display", "type": "OperationDisplay"}, + "origin": {"key": "origin", "type": "str"}, + "action_type": {"key": "actionType", "type": "str"}, + } + + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: + """ + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure.mgmt.nginx.models.OperationDisplay + """ + super().__init__(**kwargs) + self.name: Optional[str] = None + self.is_data_action: Optional[bool] = None + self.display = display + self.origin: Optional[Union[str, "_models.Origin"]] = None + self.action_type: Optional[Union[str, "_models.ActionType"]] = None + + class OperationDisplay(_serialization.Model): + """Localized display information for this particular operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str + """ + + _validation = { + "provider": {"readonly": True}, + "resource": {"readonly": True}, + "operation": {"readonly": True}, + "description": {"readonly": True}, + } + + _attribute_map = { + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provider: Optional[str] = None + self.resource: Optional[str] = None + self.operation: Optional[str] = None + self.description: Optional[str] = None + + +class OperationDisplayAutoGenerated(_serialization.Model): """The object that represents the operation. :ivar provider: Service provider: Nginx.NginxPlus. @@ -1929,31 +2262,32 @@ def __init__( class OperationListResult(_serialization.Model): - """Result of GET request to list Nginx.NginxPlus operations. + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link + to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: List of operations supported by the Nginx.NginxPlus provider. - :vartype value: list[~azure.mgmt.nginx.models.OperationResult] - :ivar next_link: URL to get the next set of operation list results if there are any. + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.nginx.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). :vartype next_link: str """ + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + _attribute_map = { - "value": {"key": "value", "type": "[OperationResult]"}, + "value": {"key": "value", "type": "[Operation]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, *, value: Optional[List["_models.OperationResult"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: List of operations supported by the Nginx.NginxPlus provider. - :paramtype value: list[~azure.mgmt.nginx.models.OperationResult] - :keyword next_link: URL to get the next set of operation list results if there are any. - :paramtype next_link: str - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.value = value - self.next_link = next_link + self.value: Optional[List["_models.Operation"]] = None + self.next_link: Optional[str] = None class OperationResult(_serialization.Model): @@ -1962,14 +2296,14 @@ class OperationResult(_serialization.Model): :ivar name: Operation name: {provider}/{resource}/{operation}. :vartype name: str :ivar display: The object that represents the operation. - :vartype display: ~azure.mgmt.nginx.models.OperationDisplay + :vartype display: ~azure.mgmt.nginx.models.OperationDisplayAutoGenerated :ivar is_data_action: Indicates whether the operation is a data action. :vartype is_data_action: bool """ _attribute_map = { "name": {"key": "name", "type": "str"}, - "display": {"key": "display", "type": "OperationDisplay"}, + "display": {"key": "display", "type": "OperationDisplayAutoGenerated"}, "is_data_action": {"key": "isDataAction", "type": "bool"}, } @@ -1977,7 +2311,7 @@ def __init__( self, *, name: Optional[str] = None, - display: Optional["_models.OperationDisplay"] = None, + display: Optional["_models.OperationDisplayAutoGenerated"] = None, is_data_action: Optional[bool] = None, **kwargs: Any ) -> None: @@ -1985,7 +2319,7 @@ def __init__( :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str :keyword display: The object that represents the operation. - :paramtype display: ~azure.mgmt.nginx.models.OperationDisplay + :paramtype display: ~azure.mgmt.nginx.models.OperationDisplayAutoGenerated :keyword is_data_action: Indicates whether the operation is a data action. :paramtype is_data_action: bool """ @@ -1996,7 +2330,7 @@ def __init__( class ResourceSku(_serialization.Model): - """ResourceSku. + """Resource Sku. All required parameters must be populated in order to send to server. @@ -2028,37 +2362,6 @@ class ScaleProfile(_serialization.Model): :ivar name: Required. :vartype name: str - :ivar capacity: The capacity parameters of the profile. Required. - :vartype capacity: ~azure.mgmt.nginx.models.ScaleProfileCapacity - """ - - _validation = { - "name": {"required": True}, - "capacity": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "capacity": {"key": "capacity", "type": "ScaleProfileCapacity"}, - } - - def __init__(self, *, name: str, capacity: "_models.ScaleProfileCapacity", **kwargs: Any) -> None: - """ - :keyword name: Required. - :paramtype name: str - :keyword capacity: The capacity parameters of the profile. Required. - :paramtype capacity: ~azure.mgmt.nginx.models.ScaleProfileCapacity - """ - super().__init__(**kwargs) - self.name = name - self.capacity = capacity - - -class ScaleProfileCapacity(_serialization.Model): - """The capacity parameters of the profile. - - All required parameters must be populated in order to send to server. - :ivar min: The minimum number of NCUs the deployment can be autoscaled to. Required. :vartype min: int :ivar max: The maximum number of NCUs the deployment can be autoscaled to. Required. @@ -2066,29 +2369,35 @@ class ScaleProfileCapacity(_serialization.Model): """ _validation = { + "name": {"required": True}, "min": {"required": True, "minimum": 0}, "max": {"required": True, "minimum": 0}, } _attribute_map = { - "min": {"key": "min", "type": "int"}, - "max": {"key": "max", "type": "int"}, + "name": {"key": "name", "type": "str"}, + "min": {"key": "capacity.min", "type": "int"}, + "max": {"key": "capacity.max", "type": "int"}, } def __init__( self, *, + name: str, min: int, # pylint: disable=redefined-builtin max: int, # pylint: disable=redefined-builtin **kwargs: Any ) -> None: """ + :keyword name: Required. + :paramtype name: str :keyword min: The minimum number of NCUs the deployment can be autoscaled to. Required. :paramtype min: int :keyword max: The maximum number of NCUs the deployment can be autoscaled to. Required. :paramtype max: int """ super().__init__(**kwargs) + self.name = name self.min = min self.max = max @@ -2158,7 +2467,7 @@ def __init__( class UserIdentityProperties(_serialization.Model): - """UserIdentityProperties. + """User Identity Properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -2181,8 +2490,8 @@ class UserIdentityProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None class WebApplicationFirewallComponentVersions(_serialization.Model): @@ -2287,6 +2596,8 @@ class WebApplicationFirewallStatus(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. + :ivar waf_release: NGINX App Protect WAF release version. + :vartype waf_release: str :ivar attack_signatures_package: Package containing attack signatures for the NGINX App Protect Web Application Firewall (WAF). :vartype attack_signatures_package: ~azure.mgmt.nginx.models.WebApplicationFirewallPackage @@ -2309,16 +2620,21 @@ class WebApplicationFirewallStatus(_serialization.Model): } _attribute_map = { + "waf_release": {"key": "wafRelease", "type": "str"}, "attack_signatures_package": {"key": "attackSignaturesPackage", "type": "WebApplicationFirewallPackage"}, "bot_signatures_package": {"key": "botSignaturesPackage", "type": "WebApplicationFirewallPackage"}, "threat_campaigns_package": {"key": "threatCampaignsPackage", "type": "WebApplicationFirewallPackage"}, "component_versions": {"key": "componentVersions", "type": "WebApplicationFirewallComponentVersions"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, waf_release: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword waf_release: NGINX App Protect WAF release version. + :paramtype waf_release: str + """ super().__init__(**kwargs) - self.attack_signatures_package = None - self.bot_signatures_package = None - self.threat_campaigns_package = None - self.component_versions = None + self.waf_release = waf_release + self.attack_signatures_package: Optional["_models.WebApplicationFirewallPackage"] = None + self.bot_signatures_package: Optional["_models.WebApplicationFirewallPackage"] = None + self.threat_campaigns_package: Optional["_models.WebApplicationFirewallPackage"] = None + self.component_versions: Optional["_models.WebApplicationFirewallComponentVersions"] = None diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/_nginx_management_client_enums.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/_nginx_management_client_enums.py index 9d6b8d706b9f..c2b10e80087a 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/_nginx_management_client_enums.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/_nginx_management_client_enums.py @@ -10,6 +10,12 @@ from azure.core import CaseInsensitiveEnumMeta +class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" + + INTERNAL = "Internal" + + class ActivationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The activation state of the WAF. Use 'Enabled' to enable the WAF and 'Disabled' to disable it.""" @@ -27,7 +33,7 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class IdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """IdentityType.""" + """Identity Type.""" SYSTEM_ASSIGNED = "SystemAssigned" USER_ASSIGNED = "UserAssigned" @@ -42,15 +48,55 @@ class Level(str, Enum, metaclass=CaseInsensitiveEnumMeta): WARNING = "Warning" +class NginxDeploymentWafPolicyApplyingStatusCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Machine readable code indicating the applying status code of a WAF Policy.""" + + NOT_APPLIED = "NotApplied" + """The policy is not referenced in the nginx config and not applied.""" + APPLYING = "Applying" + """The policy is referenced in the nginx config and is applying.""" + SUCCEEDED = "Succeeded" + """The policy is referenced in the nginx config and that config has been successfully applied.""" + FAILED = "Failed" + """The policy is referenced in the nginx config and that config failed to apply.""" + REMOVING = "Removing" + """The policy is now not referenced in the nginx config and its being removed from the applied + nginx config.""" + + +class NginxDeploymentWafPolicyCompilingStatusCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Machine readable code indicating the compilation status of a WAF Policy.""" + + NOT_STARTED = "NotStarted" + """The compilation of the custom waf policy has not started""" + IN_PROGRESS = "InProgress" + """The compilation of the custom waf policy is in progress""" + SUCCEEDED = "Succeeded" + """The compilation of the custom waf policy is completed successfully and can now be referenced in + the nginx config.""" + FAILED = "Failed" + """The compilation of the custom waf policy failed.""" + + class NginxPrivateIPAllocationMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """NginxPrivateIPAllocationMethod.""" + """Nginx Private IP Allocation Method.""" STATIC = "Static" DYNAMIC = "Dynamic" +class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is "user,system". + """ + + USER = "user" + SYSTEM = "system" + USER_SYSTEM = "user,system" + + class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ProvisioningState.""" + """Provisioning State.""" ACCEPTED = "Accepted" CREATING = "Creating" diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/__init__.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/__init__.py index bf1dfbd4df3e..b4a11f8b05d4 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/__init__.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/__init__.py @@ -16,6 +16,8 @@ from ._certificates_operations import CertificatesOperations # type: ignore from ._configurations_operations import ConfigurationsOperations # type: ignore from ._deployments_operations import DeploymentsOperations # type: ignore +from ._waf_policy_operations import WafPolicyOperations # type: ignore +from ._default_waf_policy_operations import DefaultWafPolicyOperations # type: ignore from ._operations import Operations # type: ignore from ._patch import __all__ as _patch_all @@ -27,6 +29,8 @@ "CertificatesOperations", "ConfigurationsOperations", "DeploymentsOperations", + "WafPolicyOperations", + "DefaultWafPolicyOperations", "Operations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_api_keys_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_api_keys_operations.py index b4d2368903b6..8951e96f06ed 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_api_keys_operations.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_api_keys_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,12 +28,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import NginxManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +44,7 @@ def build_create_or_update_request( _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", "2024-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -53,7 +52,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/apiKeys/{apiKeyName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -89,14 +88,14 @@ def build_delete_request( _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", "2024-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/apiKeys/{apiKeyName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -130,14 +129,14 @@ def build_get_request( _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", "2024-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/apiKeys/{apiKeyName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -171,14 +170,14 @@ def build_list_request( _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", "2024-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/apiKeys", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -217,10 +216,10 @@ class ApiKeysOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - 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._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload def create_or_update( diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_certificates_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_certificates_operations.py index 8caee16fcec7..4a053c733bfc 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_certificates_operations.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_certificates_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -30,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import NginxManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,14 +48,14 @@ def build_get_request( _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", "2024-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -68,7 +67,12 @@ def build_get_request( "str", pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", ), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), + "certificateName": _SERIALIZER.url( + "certificate_name", + certificate_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -88,7 +92,7 @@ def build_create_or_update_request( _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", "2024-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -96,7 +100,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -108,7 +112,12 @@ def build_create_or_update_request( "str", pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", ), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), + "certificateName": _SERIALIZER.url( + "certificate_name", + certificate_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -130,14 +139,14 @@ def build_delete_request( _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", "2024-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -149,7 +158,12 @@ def build_delete_request( "str", pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", ), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), + "certificateName": _SERIALIZER.url( + "certificate_name", + certificate_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -169,14 +183,14 @@ def build_list_request( _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", "2024-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -215,10 +229,10 @@ class CertificatesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - 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._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( @@ -535,7 +549,7 @@ def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -544,10 +558,18 @@ def _delete_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Operation-Location"] = self._deserialize( + "str", response.headers.get("Operation-Location") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_configurations_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_configurations_operations.py index 6c10036b327c..5494219f4681 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_configurations_operations.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_configurations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -30,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import NginxManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,14 +48,14 @@ def build_list_request( _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", "2024-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -87,14 +86,14 @@ def build_get_request( _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", "2024-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -106,7 +105,9 @@ def build_get_request( "str", pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", ), - "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), + "configurationName": _SERIALIZER.url( + "configuration_name", configuration_name, "str", pattern=r"^[a-z][a-z0-9]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -126,7 +127,7 @@ def build_create_or_update_request( _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", "2024-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -134,7 +135,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -146,7 +147,9 @@ def build_create_or_update_request( "str", pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", ), - "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), + "configurationName": _SERIALIZER.url( + "configuration_name", configuration_name, "str", pattern=r"^[a-z][a-z0-9]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -168,14 +171,14 @@ def build_delete_request( _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", "2024-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -187,7 +190,9 @@ def build_delete_request( "str", pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", ), - "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), + "configurationName": _SERIALIZER.url( + "configuration_name", configuration_name, "str", pattern=r"^[a-z][a-z0-9]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -207,7 +212,7 @@ def build_analysis_request( _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", "2024-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -215,7 +220,7 @@ def build_analysis_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}/analyze", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -259,10 +264,10 @@ class ConfigurationsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - 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._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -670,7 +675,7 @@ def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -679,10 +684,18 @@ def _delete_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Operation-Location"] = self._deserialize( + "str", response.headers.get("Operation-Location") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_default_waf_policy_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_default_waf_policy_operations.py new file mode 100644 index 000000000000..f500f45d1c0e --- /dev/null +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_default_waf_policy_operations.py @@ -0,0 +1,153 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import NginxManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, deployment_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", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/listDefaultWafPolicies", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class DefaultWafPolicyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.nginx.NginxManagementClient`'s + :attr:`default_waf_policy` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, deployment_name: str, **kwargs: Any + ) -> _models.NginxDeploymentDefaultWafPolicyListResponse: + """Get the Nginx Waf Policy of given Nginx deployment. + + Get the Nginx Waf Policy of given Nginx deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :return: NginxDeploymentDefaultWafPolicyListResponse or the result of cls(response) + :rtype: ~azure.mgmt.nginx.models.NginxDeploymentDefaultWafPolicyListResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NginxDeploymentDefaultWafPolicyListResponse] = kwargs.pop("cls", None) + + _request = build_list_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NginxDeploymentDefaultWafPolicyListResponse", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_deployments_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_deployments_operations.py index 816e201aa2fa..75798b3c8469 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_deployments_operations.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_deployments_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -30,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import NginxManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,14 +48,14 @@ def build_get_request( _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", "2024-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -87,7 +86,7 @@ def build_create_or_update_request( _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", "2024-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -95,7 +94,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -128,7 +127,7 @@ def build_update_request( _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", "2024-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -136,7 +135,7 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -169,14 +168,14 @@ def build_delete_request( _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", "2024-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -205,7 +204,7 @@ def build_list_request(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", "2024-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -229,14 +228,14 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _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", "2024-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -269,10 +268,10 @@ class DeploymentsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - 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._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get(self, resource_group_name: str, deployment_name: str, **kwargs: Any) -> _models.NginxDeployment: @@ -421,7 +420,7 @@ def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of targeted NGINX deployment. Required. :type deployment_name: str - :param body: Default value is None. + :param body: The Nginx deployment. Default value is None. :type body: ~azure.mgmt.nginx.models.NginxDeployment :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -451,7 +450,7 @@ def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of targeted NGINX deployment. Required. :type deployment_name: str - :param body: Default value is None. + :param body: The Nginx deployment. Default value is None. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -479,7 +478,8 @@ def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of targeted NGINX deployment. Required. :type deployment_name: str - :param body: Is either a NginxDeployment type or a IO[bytes] type. Default value is None. + :param body: The Nginx deployment. Is either a NginxDeployment type or a IO[bytes] type. + Default value is None. :type body: ~azure.mgmt.nginx.models.NginxDeployment or IO[bytes] :return: An instance of LROPoller that returns either NginxDeployment or the result of cls(response) @@ -589,7 +589,7 @@ def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -598,10 +598,18 @@ def _update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Operation-Location"] = self._deserialize( + "str", response.headers.get("Operation-Location") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -624,7 +632,7 @@ def begin_update( :type resource_group_name: str :param deployment_name: The name of targeted NGINX deployment. Required. :type deployment_name: str - :param body: Default value is None. + :param body: The Nginx deployment update parameters. Default value is None. :type body: ~azure.mgmt.nginx.models.NginxDeploymentUpdateParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -654,7 +662,7 @@ def begin_update( :type resource_group_name: str :param deployment_name: The name of targeted NGINX deployment. Required. :type deployment_name: str - :param body: Default value is None. + :param body: The Nginx deployment update parameters. Default value is None. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -682,8 +690,8 @@ def begin_update( :type resource_group_name: str :param deployment_name: The name of targeted NGINX deployment. Required. :type deployment_name: str - :param body: Is either a NginxDeploymentUpdateParameters type or a IO[bytes] type. Default - value is None. + :param body: The Nginx deployment update parameters. Is either a + NginxDeploymentUpdateParameters type or a IO[bytes] type. Default value is None. :type body: ~azure.mgmt.nginx.models.NginxDeploymentUpdateParameters or IO[bytes] :return: An instance of LROPoller that returns either NginxDeployment or the result of cls(response) @@ -721,7 +729,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -770,7 +780,7 @@ def _delete_initial(self, resource_group_name: str, deployment_name: str, **kwar response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -779,10 +789,18 @@ def _delete_initial(self, resource_group_name: str, deployment_name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Operation-Location"] = self._deserialize( + "str", response.headers.get("Operation-Location") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_operations.py index b7ece36d4268..ed7ce15550a6 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_operations.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_operations.py @@ -5,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,12 +26,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import NginxManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +40,7 @@ def build_list_request(**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", "2024-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,19 +69,19 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - 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._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.OperationResult"]: + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: """List all operations provided by Nginx.NginxPlus for the 2024-11-01-preview api version. List all operations provided by Nginx.NginxPlus for the 2024-11-01-preview api version. - :return: An iterator like instance of either OperationResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.nginx.models.OperationResult] + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.nginx.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_waf_policy_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_waf_policy_operations.py new file mode 100644 index 000000000000..ec6ba0d2855f --- /dev/null +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_waf_policy_operations.py @@ -0,0 +1,728 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._configuration import NginxManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, deployment_name: str, waf_policy_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", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/wafPolicies/{wafPolicyName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), + "wafPolicyName": _SERIALIZER.url( + "waf_policy_name", + waf_policy_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_request( + resource_group_name: str, deployment_name: str, waf_policy_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", "2025-03-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/Nginx.NginxPlus/nginxDeployments/{deploymentName}/wafPolicies/{wafPolicyName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), + "wafPolicyName": _SERIALIZER.url( + "waf_policy_name", + waf_policy_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), + } + + _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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, deployment_name: str, waf_policy_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", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/wafPolicies/{wafPolicyName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), + "wafPolicyName": _SERIALIZER.url( + "waf_policy_name", + waf_policy_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_group_name: str, deployment_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", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/wafPolicies", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class WafPolicyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.nginx.NginxManagementClient`'s + :attr:`waf_policy` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, deployment_name: str, waf_policy_name: str, **kwargs: Any + ) -> _models.NginxDeploymentWafPolicy: + """Get the Nginx Waf Policy of given Nginx deployment. + + Get the Nginx Waf Policy of given Nginx deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param waf_policy_name: The name of Waf Policy. Required. + :type waf_policy_name: str + :return: NginxDeploymentWafPolicy or the result of cls(response) + :rtype: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NginxDeploymentWafPolicy] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + waf_policy_name=waf_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NginxDeploymentWafPolicy", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + deployment_name: str, + waf_policy_name: str, + body: Optional[Union[_models.NginxDeploymentWafPolicy, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 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._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "NginxDeploymentWafPolicy") + else: + _json = None + + _request = build_create_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + waf_policy_name=waf_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + 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, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Operation-Location"] = self._deserialize( + "str", response.headers.get("Operation-Location") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + deployment_name: str, + waf_policy_name: str, + body: Optional[_models.NginxDeploymentWafPolicy] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NginxDeploymentWafPolicy]: + """Create or update the Nginx Waf Policy for given Nginx deployment. + + Create or update the Nginx Waf Policy for given Nginx deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param waf_policy_name: The name of Waf Policy. Required. + :type waf_policy_name: str + :param body: The Nginx Deployment Waf Policy. Default value is None. + :type body: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either NginxDeploymentWafPolicy or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxDeploymentWafPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + deployment_name: str, + waf_policy_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NginxDeploymentWafPolicy]: + """Create or update the Nginx Waf Policy for given Nginx deployment. + + Create or update the Nginx Waf Policy for given Nginx deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param waf_policy_name: The name of Waf Policy. Required. + :type waf_policy_name: str + :param body: The Nginx Deployment Waf Policy. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either NginxDeploymentWafPolicy or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxDeploymentWafPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + deployment_name: str, + waf_policy_name: str, + body: Optional[Union[_models.NginxDeploymentWafPolicy, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.NginxDeploymentWafPolicy]: + """Create or update the Nginx Waf Policy for given Nginx deployment. + + Create or update the Nginx Waf Policy for given Nginx deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param waf_policy_name: The name of Waf Policy. Required. + :type waf_policy_name: str + :param body: The Nginx Deployment Waf Policy. Is either a NginxDeploymentWafPolicy type or a + IO[bytes] type. Default value is None. + :type body: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicy or IO[bytes] + :return: An instance of LROPoller that returns either NginxDeploymentWafPolicy or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxDeploymentWafPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _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._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NginxDeploymentWafPolicy] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + waf_policy_name=waf_policy_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NginxDeploymentWafPolicy", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.NginxDeploymentWafPolicy].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.NginxDeploymentWafPolicy]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, deployment_name: str, waf_policy_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + waf_policy_name=waf_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + 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 [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Operation-Location"] = self._deserialize( + "str", response.headers.get("Operation-Location") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, deployment_name: str, waf_policy_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Reset the Nginx Waf Policy of given Nginx deployment to default. + + Reset the Nginx Waf Policy of given Nginx deployment to default. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param waf_policy_name: The name of Waf Policy. Required. + :type waf_policy_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + waf_policy_name=waf_policy_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, deployment_name: str, **kwargs: Any + ) -> Iterable["_models.NginxDeploymentWafPolicyMetadata"]: + """List Waf Policies of given Nginx deployment. + + List Waf Policies of given Nginx deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :return: An iterator like instance of either NginxDeploymentWafPolicyMetadata or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.nginx.models.NginxDeploymentWafPolicyMetadata] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NginxDeploymentWafPolicyListResponse] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NginxDeploymentWafPolicyListResponse", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/api_keys_create_or_update.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/api_keys_create_or_update.py index 66c898cc6ead..5c89973c210a 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/api_keys_create_or_update.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/api_keys_create_or_update.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_CreateOrUpdate.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2025-03-01-preview/examples/ApiKeys_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/api_keys_delete.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/api_keys_delete.py index 1d3d1f295162..538ca7f5b339 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/api_keys_delete.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/api_keys_delete.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_Delete.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2025-03-01-preview/examples/ApiKeys_Delete.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/api_keys_get.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/api_keys_get.py index e43c55ad8a65..92aafd1e4bc9 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/api_keys_get.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/api_keys_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_Get.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2025-03-01-preview/examples/ApiKeys_Get.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/api_keys_list.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/api_keys_list.py index 14656db6c4f5..f2ceb5c95678 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/api_keys_list.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/api_keys_list.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_List.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2025-03-01-preview/examples/ApiKeys_List.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_create_or_update.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_create_or_update.py index dc033d4bbd8e..4e330872662b 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_create_or_update.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_create_or_update.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_CreateOrUpdate.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2025-03-01-preview/examples/Certificates_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_delete.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_delete.py index d1d1400bdd09..158b4871da63 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_delete.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_delete.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_Delete.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2025-03-01-preview/examples/Certificates_Delete.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_get.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_get.py index f3a32df1144f..b358f0106fd4 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_get.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_Get.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2025-03-01-preview/examples/Certificates_Get.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_list.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_list.py index e6be437650f1..f0b8fddf985f 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_list.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_list.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_List.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2025-03-01-preview/examples/Certificates_List.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_analysis.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_analysis.py index a3ccb680adc2..7e6dc41fc1cc 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_analysis.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_analysis.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_Analysis.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2025-03-01-preview/examples/Configurations_Analysis.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_create_or_update.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_create_or_update.py index 1f487c964cd6..af0e1076c269 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_create_or_update.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_create_or_update.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_CreateOrUpdate.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2025-03-01-preview/examples/Configurations_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_delete.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_delete.py index d71ddae41f25..f34b76dd1ba8 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_delete.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_delete.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_Delete.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2025-03-01-preview/examples/Configurations_Delete.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_get.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_get.py index cac35ab11b6d..e83c4f4a11b9 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_get.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_Get.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2025-03-01-preview/examples/Configurations_Get.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_list.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_list.py index 7093aad43cab..c82afd1dce37 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_list.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_list.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_List.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2025-03-01-preview/examples/Configurations_List.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/default_waf_policy_list.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/default_waf_policy_list.py new file mode 100644 index 000000000000..23cf7401ee16 --- /dev/null +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/default_waf_policy_list.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.nginx import NginxManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-nginx +# USAGE + python default_waf_policy_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NginxManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.default_waf_policy.list( + resource_group_name="myResourceGroup", + deployment_name="myDeployment", + ) + print(response) + + +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2025-03-01-preview/examples/DefaultWafPolicy_List.json +if __name__ == "__main__": + main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_create.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_create.py index 3ddba130d6c7..81103cece959 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_create.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_create.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Create.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2025-03-01-preview/examples/Deployments_Create.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_delete.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_delete.py index b024fdf29d3b..fa53d88c392c 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_delete.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_delete.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Delete.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2025-03-01-preview/examples/Deployments_Delete.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_get.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_get.py index 4158a22fd119..ee3460016c5f 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_get.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Get.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2025-03-01-preview/examples/Deployments_Get.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_get_auto_scale.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_get_auto_scale.py index 8920a0811d56..adc0b9eea1c4 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_get_auto_scale.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_get_auto_scale.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Get_AutoScale.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2025-03-01-preview/examples/Deployments_Get_AutoScale.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_list.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_list.py index 6236b8df9a3f..62fa5c097bb9 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_list.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_list.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_List.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2025-03-01-preview/examples/Deployments_List.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_list_by_resource_group.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_list_by_resource_group.py index a56ae5afd178..61055fcc4500 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_list_by_resource_group.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_list_by_resource_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_ListByResourceGroup.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2025-03-01-preview/examples/Deployments_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_update.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_update.py index 34925bd37cc8..8a5c9f7b231c 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_update.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_update.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Update.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2025-03-01-preview/examples/Deployments_Update.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_update_subnet.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_update_subnet.py index 7b595c70ddb7..084625f6fe3b 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_update_subnet.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_update_subnet.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_UpdateSubnet.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2025-03-01-preview/examples/Deployments_UpdateSubnet.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/operations_list.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/operations_list.py index e22445325bcc..a403adec4d13 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/operations_list.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/operations_list.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Operations_List.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2025-03-01-preview/examples/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/waf_policy_create.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/waf_policy_create.py new file mode 100644 index 000000000000..50a125e22f50 --- /dev/null +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/waf_policy_create.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.nginx import NginxManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-nginx +# USAGE + python waf_policy_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NginxManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.waf_policy.begin_create( + resource_group_name="myResourceGroup", + deployment_name="myDeployment", + waf_policy_name="myWafPolicy", + ).result() + print(response) + + +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2025-03-01-preview/examples/WafPolicy_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/waf_policy_delete.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/waf_policy_delete.py new file mode 100644 index 000000000000..73df80f9e778 --- /dev/null +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/waf_policy_delete.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.nginx import NginxManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-nginx +# USAGE + python waf_policy_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NginxManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.waf_policy.begin_delete( + resource_group_name="myResourceGroup", + deployment_name="myDeployment", + waf_policy_name="myWafPolicy", + ).result() + + +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2025-03-01-preview/examples/WafPolicy_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/waf_policy_get.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/waf_policy_get.py new file mode 100644 index 000000000000..6fc84ccc9faf --- /dev/null +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/waf_policy_get.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.nginx import NginxManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-nginx +# USAGE + python waf_policy_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NginxManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.waf_policy.get( + resource_group_name="myResourceGroup", + deployment_name="myDeployment", + waf_policy_name="myWafPolicy", + ) + print(response) + + +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2025-03-01-preview/examples/WafPolicy_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/waf_policy_list.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/waf_policy_list.py new file mode 100644 index 000000000000..efe44510842f --- /dev/null +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/waf_policy_list.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.nginx import NginxManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-nginx +# USAGE + python waf_policy_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NginxManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.waf_policy.list( + resource_group_name="myResourceGroup", + deployment_name="myDeployment", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2025-03-01-preview/examples/WafPolicy_List.json +if __name__ == "__main__": + main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_api_keys_operations.py b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_api_keys_operations.py index 778d8cb65fef..c750ded92ca4 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_api_keys_operations.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_api_keys_operations.py @@ -25,7 +25,7 @@ def test_api_keys_create_or_update(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", api_key_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) # please add some check logic here by yourself @@ -38,7 +38,7 @@ def test_api_keys_delete(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", api_key_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) # please add some check logic here by yourself @@ -51,7 +51,7 @@ def test_api_keys_get(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", api_key_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) # please add some check logic here by yourself @@ -63,7 +63,7 @@ def test_api_keys_list(self, resource_group): response = self.client.api_keys.list( resource_group_name=resource_group.name, deployment_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_api_keys_operations_async.py b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_api_keys_operations_async.py index bd3935178b67..cddfc132973d 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_api_keys_operations_async.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_api_keys_operations_async.py @@ -26,7 +26,7 @@ async def test_api_keys_create_or_update(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", api_key_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) # please add some check logic here by yourself @@ -39,7 +39,7 @@ async def test_api_keys_delete(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", api_key_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) # please add some check logic here by yourself @@ -52,7 +52,7 @@ async def test_api_keys_get(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", api_key_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) # please add some check logic here by yourself @@ -64,7 +64,7 @@ async def test_api_keys_list(self, resource_group): response = self.client.api_keys.list( resource_group_name=resource_group.name, deployment_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_certificates_operations.py b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_certificates_operations.py index 9015537ef366..43851ad83012 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_certificates_operations.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_certificates_operations.py @@ -25,7 +25,7 @@ def test_certificates_get(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", certificate_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) # please add some check logic here by yourself @@ -38,7 +38,7 @@ def test_certificates_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", certificate_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -51,7 +51,7 @@ def test_certificates_begin_delete(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", certificate_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -63,7 +63,7 @@ def test_certificates_list(self, resource_group): response = self.client.certificates.list( resource_group_name=resource_group.name, deployment_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_certificates_operations_async.py b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_certificates_operations_async.py index 31377bb30174..49357cece65c 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_certificates_operations_async.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_certificates_operations_async.py @@ -26,7 +26,7 @@ async def test_certificates_get(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", certificate_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) # please add some check logic here by yourself @@ -40,7 +40,7 @@ async def test_certificates_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", certificate_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -55,7 +55,7 @@ async def test_certificates_begin_delete(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", certificate_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -68,7 +68,7 @@ async def test_certificates_list(self, resource_group): response = self.client.certificates.list( resource_group_name=resource_group.name, deployment_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_configurations_operations.py b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_configurations_operations.py index 77da242df523..382badb8f461 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_configurations_operations.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_configurations_operations.py @@ -24,7 +24,7 @@ def test_configurations_list(self, resource_group): response = self.client.configurations.list( resource_group_name=resource_group.name, deployment_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_configurations_get(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", configuration_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) # please add some check logic here by yourself @@ -50,7 +50,7 @@ def test_configurations_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", configuration_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -63,7 +63,7 @@ def test_configurations_begin_delete(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", configuration_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -76,7 +76,7 @@ def test_configurations_analysis(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", configuration_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_configurations_operations_async.py b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_configurations_operations_async.py index 20ceda6c70e3..35de9d3b7a68 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_configurations_operations_async.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_configurations_operations_async.py @@ -25,7 +25,7 @@ async def test_configurations_list(self, resource_group): response = self.client.configurations.list( resource_group_name=resource_group.name, deployment_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_configurations_get(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", configuration_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) # please add some check logic here by yourself @@ -52,7 +52,7 @@ async def test_configurations_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", configuration_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -67,7 +67,7 @@ async def test_configurations_begin_delete(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", configuration_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -81,7 +81,7 @@ async def test_configurations_analysis(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", configuration_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_default_waf_policy_operations.py b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_default_waf_policy_operations.py new file mode 100644 index 000000000000..ab93df2d7ac5 --- /dev/null +++ b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_default_waf_policy_operations.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.nginx import NginxManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNginxManagementDefaultWafPolicyOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NginxManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_default_waf_policy_list(self, resource_group): + response = self.client.default_waf_policy.list( + resource_group_name=resource_group.name, + deployment_name="str", + api_version="2025-03-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_default_waf_policy_operations_async.py b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_default_waf_policy_operations_async.py new file mode 100644 index 000000000000..6e85aa5bcd1c --- /dev/null +++ b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_default_waf_policy_operations_async.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.nginx.aio import NginxManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNginxManagementDefaultWafPolicyOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NginxManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_default_waf_policy_list(self, resource_group): + response = await self.client.default_waf_policy.list( + resource_group_name=resource_group.name, + deployment_name="str", + api_version="2025-03-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_deployments_operations.py b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_deployments_operations.py index 0dbecf943803..7e63c8ec98c8 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_deployments_operations.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_deployments_operations.py @@ -24,7 +24,7 @@ def test_deployments_get(self, resource_group): response = self.client.deployments.get( resource_group_name=resource_group.name, deployment_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) # please add some check logic here by yourself @@ -36,7 +36,7 @@ def test_deployments_begin_create_or_update(self, resource_group): response = self.client.deployments.begin_create_or_update( resource_group_name=resource_group.name, deployment_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -48,7 +48,7 @@ def test_deployments_begin_update(self, resource_group): response = self.client.deployments.begin_update( resource_group_name=resource_group.name, deployment_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -60,7 +60,7 @@ def test_deployments_begin_delete(self, resource_group): response = self.client.deployments.begin_delete( resource_group_name=resource_group.name, deployment_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -70,7 +70,7 @@ def test_deployments_begin_delete(self, resource_group): @recorded_by_proxy def test_deployments_list(self, resource_group): response = self.client.deployments.list( - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -81,7 +81,7 @@ def test_deployments_list(self, resource_group): def test_deployments_list_by_resource_group(self, resource_group): response = self.client.deployments.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_deployments_operations_async.py b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_deployments_operations_async.py index 337809d16e8a..e0db5d838a0f 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_deployments_operations_async.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_deployments_operations_async.py @@ -25,7 +25,7 @@ async def test_deployments_get(self, resource_group): response = await self.client.deployments.get( resource_group_name=resource_group.name, deployment_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_deployments_begin_create_or_update(self, resource_group): await self.client.deployments.begin_create_or_update( resource_group_name=resource_group.name, deployment_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -52,7 +52,7 @@ async def test_deployments_begin_update(self, resource_group): await self.client.deployments.begin_update( resource_group_name=resource_group.name, deployment_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -66,7 +66,7 @@ async def test_deployments_begin_delete(self, resource_group): await self.client.deployments.begin_delete( resource_group_name=resource_group.name, deployment_name="str", - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -77,7 +77,7 @@ async def test_deployments_begin_delete(self, resource_group): @recorded_by_proxy_async async def test_deployments_list(self, resource_group): response = self.client.deployments.list( - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -88,7 +88,7 @@ async def test_deployments_list(self, resource_group): async def test_deployments_list_by_resource_group(self, resource_group): response = self.client.deployments.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_operations.py b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_operations.py index 0bd6d31cfba8..eb04a81419b0 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_operations.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_operations.py @@ -22,7 +22,7 @@ def setup_method(self, method): @recorded_by_proxy def test_operations_list(self, resource_group): response = self.client.operations.list( - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_operations_async.py b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_operations_async.py index 8f0c573e997a..5acab908bbf1 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_operations_async.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_operations_async.py @@ -23,7 +23,7 @@ def setup_method(self, method): @recorded_by_proxy_async async def test_operations_list(self, resource_group): response = self.client.operations.list( - api_version="2024-11-01-preview", + api_version="2025-03-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_waf_policy_operations.py b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_waf_policy_operations.py new file mode 100644 index 000000000000..72e002a8f86e --- /dev/null +++ b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_waf_policy_operations.py @@ -0,0 +1,70 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.nginx import NginxManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNginxManagementWafPolicyOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NginxManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_waf_policy_get(self, resource_group): + response = self.client.waf_policy.get( + resource_group_name=resource_group.name, + deployment_name="str", + waf_policy_name="str", + api_version="2025-03-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_waf_policy_begin_create(self, resource_group): + response = self.client.waf_policy.begin_create( + resource_group_name=resource_group.name, + deployment_name="str", + waf_policy_name="str", + api_version="2025-03-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_waf_policy_begin_delete(self, resource_group): + response = self.client.waf_policy.begin_delete( + resource_group_name=resource_group.name, + deployment_name="str", + waf_policy_name="str", + api_version="2025-03-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_waf_policy_list(self, resource_group): + response = self.client.waf_policy.list( + resource_group_name=resource_group.name, + deployment_name="str", + api_version="2025-03-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_waf_policy_operations_async.py b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_waf_policy_operations_async.py new file mode 100644 index 000000000000..2f69d6ab4ffb --- /dev/null +++ b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_waf_policy_operations_async.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.nginx.aio import NginxManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNginxManagementWafPolicyOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NginxManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_waf_policy_get(self, resource_group): + response = await self.client.waf_policy.get( + resource_group_name=resource_group.name, + deployment_name="str", + waf_policy_name="str", + api_version="2025-03-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_waf_policy_begin_create(self, resource_group): + response = await ( + await self.client.waf_policy.begin_create( + resource_group_name=resource_group.name, + deployment_name="str", + waf_policy_name="str", + api_version="2025-03-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_waf_policy_begin_delete(self, resource_group): + response = await ( + await self.client.waf_policy.begin_delete( + resource_group_name=resource_group.name, + deployment_name="str", + waf_policy_name="str", + api_version="2025-03-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_waf_policy_list(self, resource_group): + response = self.client.waf_policy.list( + resource_group_name=resource_group.name, + deployment_name="str", + api_version="2025-03-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/nginx/azure-mgmt-nginx/setup.py b/sdk/nginx/azure-mgmt-nginx/setup.py index 4c971572f69c..ff69f46ec20d 100644 --- a/sdk/nginx/azure-mgmt-nginx/setup.py +++ b/sdk/nginx/azure-mgmt-nginx/setup.py @@ -53,7 +53,6 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -77,7 +76,7 @@ "isodate>=0.6.1", "typing-extensions>=4.6.0", "azure-common>=1.1", - "azure-mgmt-core>=1.3.2", + "azure-mgmt-core>=1.5.0", ], - python_requires=">=3.8", + python_requires=">=3.9", )