diff --git a/sdk/nginx/azure-mgmt-nginx/CHANGELOG.md b/sdk/nginx/azure-mgmt-nginx/CHANGELOG.md index a8be3c65efde..fd48523b496f 100644 --- a/sdk/nginx/azure-mgmt-nginx/CHANGELOG.md +++ b/sdk/nginx/azure-mgmt-nginx/CHANGELOG.md @@ -1,5 +1,84 @@ # Release History +## 3.1.0b3 (2025-04-29) + +### Features Added + + - Model `NginxCertificate` added property `provisioning_state` + - Model `NginxCertificate` added property `key_virtual_path` + - Model `NginxCertificate` added property `certificate_virtual_path` + - Model `NginxCertificate` added property `key_vault_secret_id` + - Model `NginxCertificate` added property `sha1_thumbprint` + - Model `NginxCertificate` added property `key_vault_secret_version` + - Model `NginxCertificate` added property `key_vault_secret_created` + - Model `NginxCertificate` added property `certificate_error` + - Model `NginxConfigurationResponse` added property `provisioning_state` + - Model `NginxConfigurationResponse` added property `files` + - Model `NginxConfigurationResponse` added property `protected_files` + - Model `NginxConfigurationResponse` added property `package` + - Model `NginxConfigurationResponse` added property `root_file` + - Model `NginxDeployment` added property `provisioning_state` + - Model `NginxDeployment` added property `nginx_version` + - Model `NginxDeployment` added property `network_profile` + - Model `NginxDeployment` added property `ip_address` + - Model `NginxDeployment` added property `enable_diagnostics_support` + - Model `NginxDeployment` added property `logging` + - Model `NginxDeployment` added property `scaling_properties` + - Model `NginxDeployment` added property `auto_upgrade_profile` + - Model `NginxDeployment` added property `user_profile` + - Model `NginxDeployment` added property `nginx_app_protect` + - Model `NginxDeployment` added property `dataplane_api_endpoint` + - Model `NginxDeploymentApiKeyResponse` added property `hint` + - Model `NginxDeploymentApiKeyResponse` added property `end_date_time` + - Model `NginxDeploymentApiKeyResponse` added property `system_data` + - Added enum `ActionType` + - Added model `AzureResourceManagerArmResponseNginxDeployment` + - Added model `AzureResourceManagerResourceSkuProperty` + - Added model `Operation` + - Added enum `Origin` + - Added model `ProxyResource` + - Added model `Resource` + - Added model `Sku` + - Added enum `SkuTier` + - Added model `TrackedResource` + - Method `ApiKeysOperations.create_or_update` has a new overload `def create_or_update(self: None, resource_group_name: str, deployment_name: str, api_key_name: str, body: NginxDeploymentApiKeyResponse, content_type: str)` + - Method `ApiKeysOperations.create_or_update` has a new overload `def create_or_update(self: None, resource_group_name: str, deployment_name: str, api_key_name: str, body: IO[bytes], content_type: str)` + - Method `CertificatesOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, deployment_name: str, certificate_name: str, body: NginxCertificate, content_type: str)` + - Method `CertificatesOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, deployment_name: str, certificate_name: str, body: IO[bytes], content_type: str)` + - Method `ConfigurationsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, deployment_name: str, configuration_name: str, body: NginxConfigurationResponse, content_type: str)` + - Method `ConfigurationsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, deployment_name: str, configuration_name: str, body: IO[bytes], content_type: str)` + - Method `DeploymentsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, deployment_name: str, body: NginxDeployment, content_type: str)` + - Method `DeploymentsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, deployment_name: str, body: IO[bytes], content_type: str)` + - Method `DeploymentsOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, deployment_name: str, body: NginxDeploymentUpdateParameters, content_type: str)` + - Method `DeploymentsOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, deployment_name: str, body: IO[bytes], content_type: str)` + +### Breaking Changes + + - Model `NginxCertificate` deleted or renamed its instance variable `properties` + - Method `NginxCertificateListResponse.__init__` removed default value `None` from its parameter `value` + - Method `NginxConfigurationListResponse.__init__` removed default value `None` from its parameter `value` + - Model `NginxConfigurationResponse` deleted or renamed its instance variable `properties` + - Model `NginxDeployment` deleted or renamed its instance variable `properties` + - Method `NginxDeployment.__init__` removed default value `None` from its parameter `location` + - Method `NginxDeploymentApiKeyListResponse.__init__` removed default value `None` from its parameter `value` + - Model `NginxDeploymentApiKeyResponse` deleted or renamed its instance variable `properties` + - Method `NginxDeploymentListResponse.__init__` removed default value `None` from its parameter `value` + - Deleted or renamed model `NginxCertificateProperties` + - Deleted or renamed model `NginxConfigurationRequest` + - Deleted or renamed model `NginxConfigurationRequestProperties` + - Deleted or renamed model `NginxConfigurationResponseProperties` + - Deleted or renamed model `NginxDeploymentApiKeyRequest` + - Deleted or renamed model `NginxDeploymentApiKeyRequestProperties` + - Deleted or renamed model `NginxDeploymentApiKeyResponseProperties` + - Deleted or renamed model `NginxDeploymentProperties` + - Deleted or renamed model `OperationResult` + - Deleted or renamed model `ResourceSku` + - Method `ApiKeysOperations.create_or_update` removed default value `None` from its parameter `body` + - Method `CertificatesOperations.begin_create_or_update` removed default value `None` from its parameter `body` + - Method `ConfigurationsOperations.begin_create_or_update` removed default value `None` from its parameter `body` + - Method `DeploymentsOperations.begin_create_or_update` removed default value `None` from its parameter `body` + - Method `DeploymentsOperations.begin_update` removed default value `None` from its parameter `body` + ## 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..efd0d4dd81d0 100644 --- a/sdk/nginx/azure-mgmt-nginx/_meta.json +++ b/sdk/nginx/azure-mgmt-nginx/_meta.json @@ -1,11 +1,11 @@ { - "commit": "198ffdb2b788b49be283a388ad9735b0cfad1be1", + "commit": "e34f731fc59195cf22bbe1923ec4ed35f65f0bb2", "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/_nginx_management_client.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_nginx_management_client.py index bad67fdda2bf..6049a27662f1 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,17 +7,19 @@ # -------------------------------------------------------------------------- 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, @@ -31,23 +33,23 @@ class NginxManagementClient: - """NginxManagementClient. + """// FIXME: (missing-service-description) Add service description. + :ivar operations: Operations operations + :vartype operations: azure.mgmt.nginx.operations.Operations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: azure.mgmt.nginx.operations.DeploymentsOperations :ivar api_keys: ApiKeysOperations operations :vartype api_keys: azure.mgmt.nginx.operations.ApiKeysOperations :ivar certificates: CertificatesOperations operations :vartype certificates: azure.mgmt.nginx.operations.CertificatesOperations :ivar configurations: ConfigurationsOperations operations :vartype configurations: azure.mgmt.nginx.operations.ConfigurationsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: azure.mgmt.nginx.operations.DeploymentsOperations - :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 this default value may result in unsupported behavior. @@ -57,15 +59,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,17 +88,17 @@ 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) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) self.api_keys = ApiKeysOperations(self._client, self._config, self._serialize, self._deserialize) 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.operations = Operations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. 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/_nginx_management_client.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_nginx_management_client.py index 059f95c1db19..d613c858c9f5 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,16 +7,18 @@ # -------------------------------------------------------------------------- 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, @@ -31,23 +33,23 @@ class NginxManagementClient: - """NginxManagementClient. + """// FIXME: (missing-service-description) Add service description. + :ivar operations: Operations operations + :vartype operations: azure.mgmt.nginx.aio.operations.Operations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: azure.mgmt.nginx.aio.operations.DeploymentsOperations :ivar api_keys: ApiKeysOperations operations :vartype api_keys: azure.mgmt.nginx.aio.operations.ApiKeysOperations :ivar certificates: CertificatesOperations operations :vartype certificates: azure.mgmt.nginx.aio.operations.CertificatesOperations :ivar configurations: ConfigurationsOperations operations :vartype configurations: azure.mgmt.nginx.aio.operations.ConfigurationsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: azure.mgmt.nginx.aio.operations.DeploymentsOperations - :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 this default value may result in unsupported behavior. @@ -57,15 +59,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,17 +88,19 @@ 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) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) self.api_keys = ApiKeysOperations(self._client, self._config, self._serialize, self._deserialize) 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.operations = Operations(self._client, self._config, self._serialize, self._deserialize) def _send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any 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..7ecb29e64fff 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 @@ -12,22 +12,22 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import +from ._operations import Operations # type: ignore +from ._deployments_operations import DeploymentsOperations # type: ignore from ._api_keys_operations import ApiKeysOperations # type: ignore from ._certificates_operations import CertificatesOperations # type: ignore from ._configurations_operations import ConfigurationsOperations # type: ignore -from ._deployments_operations import DeploymentsOperations # type: ignore -from ._operations import Operations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ + "Operations", + "DeploymentsOperations", "ApiKeysOperations", "CertificatesOperations", "ConfigurationsOperations", - "DeploymentsOperations", - "Operations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() 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..6b734e96093c 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,157 @@ 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") + + @distributed_trace + def list( + self, resource_group_name: str, deployment_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NginxDeploymentApiKeyResponse"]: + """List all API Keys of the 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 NginxDeploymentApiKeyResponse or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse] + :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.NginxDeploymentApiKeyListResponse] = 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("NginxDeploymentApiKeyListResponse", 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) + + @distributed_trace_async + async def get( + self, resource_group_name: str, deployment_name: str, api_key_name: str, **kwargs: Any + ) -> _models.NginxDeploymentApiKeyResponse: + """Get the specified API Key of the 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 api_key_name: The resource name of the API key. Required. + :type api_key_name: str + :return: NginxDeploymentApiKeyResponse or the result of cls(response) + :rtype: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse + :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.NginxDeploymentApiKeyResponse] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + api_key_name=api_key_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("NginxDeploymentApiKeyResponse", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def create_or_update( @@ -67,7 +213,7 @@ async def create_or_update( resource_group_name: str, deployment_name: str, api_key_name: str, - body: Optional[_models.NginxDeploymentApiKeyRequest] = None, + body: _models.NginxDeploymentApiKeyResponse, *, content_type: str = "application/json", **kwargs: Any @@ -75,9 +221,6 @@ async def create_or_update( """Create or update an API Key for the Nginx deployment in order to access the dataplane API endpoint. - Create or update an API Key for the Nginx deployment in order to access the dataplane API - endpoint. - :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str @@ -86,8 +229,8 @@ async def create_or_update( :param api_key_name: The resource name of the API key. Required. :type api_key_name: str :param body: The API Key object containing fields (e.g. secret text, expiration date) to upsert - the key. Default value is None. - :type body: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyRequest + the key. Required. + :type body: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -102,7 +245,7 @@ async def create_or_update( resource_group_name: str, deployment_name: str, api_key_name: str, - body: Optional[IO[bytes]] = None, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -110,9 +253,6 @@ async def create_or_update( """Create or update an API Key for the Nginx deployment in order to access the dataplane API endpoint. - Create or update an API Key for the Nginx deployment in order to access the dataplane API - endpoint. - :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str @@ -121,7 +261,7 @@ async def create_or_update( :param api_key_name: The resource name of the API key. Required. :type api_key_name: str :param body: The API Key object containing fields (e.g. secret text, expiration date) to upsert - the key. Default value is None. + the key. Required. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -137,15 +277,12 @@ async def create_or_update( resource_group_name: str, deployment_name: str, api_key_name: str, - body: Optional[Union[_models.NginxDeploymentApiKeyRequest, IO[bytes]]] = None, + body: Union[_models.NginxDeploymentApiKeyResponse, IO[bytes]], **kwargs: Any ) -> _models.NginxDeploymentApiKeyResponse: """Create or update an API Key for the Nginx deployment in order to access the dataplane API endpoint. - Create or update an API Key for the Nginx deployment in order to access the dataplane API - endpoint. - :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str @@ -154,9 +291,8 @@ async def create_or_update( :param api_key_name: The resource name of the API key. Required. :type api_key_name: str :param body: The API Key object containing fields (e.g. secret text, expiration date) to upsert - the key. Is either a NginxDeploymentApiKeyRequest type or a IO[bytes] type. Default value is - None. - :type body: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyRequest or IO[bytes] + the key. Is either a NginxDeploymentApiKeyResponse type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse or IO[bytes] :return: NginxDeploymentApiKeyResponse or the result of cls(response) :rtype: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -182,10 +318,7 @@ async def create_or_update( if isinstance(body, (IOBase, bytes)): _content = body else: - if body is not None: - _json = self._serialize.body(body, "NginxDeploymentApiKeyRequest") - else: - _json = None + _json = self._serialize.body(body, "NginxDeploymentApiKeyResponse") _request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -224,8 +357,6 @@ async def create_or_update( async def delete(self, resource_group_name: str, deployment_name: str, api_key_name: str, **kwargs: Any) -> None: """Delete API key for Nginx deployment. - Delete API key for Nginx deployment. - :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str @@ -276,154 +407,3 @@ async def delete(self, resource_group_name: str, deployment_name: str, api_key_n if cls: return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, deployment_name: str, api_key_name: str, **kwargs: Any - ) -> _models.NginxDeploymentApiKeyResponse: - """Get the specified API Key of the given Nginx deployment. - - Get the specified API Key of the 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 api_key_name: The resource name of the API key. Required. - :type api_key_name: str - :return: NginxDeploymentApiKeyResponse or the result of cls(response) - :rtype: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse - :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.NginxDeploymentApiKeyResponse] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - api_key_name=api_key_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("NginxDeploymentApiKeyResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterable["_models.NginxDeploymentApiKeyResponse"]: - """List all API Keys of the given Nginx deployment. - - List all API Keys of the 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 NginxDeploymentApiKeyResponse or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse] - :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.NginxDeploymentApiKeyListResponse] = 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("NginxDeploymentApiKeyListResponse", 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/aio/operations/_certificates_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_certificates_operations.py index 5314cc4dac6f..12941eedc2ea 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,94 @@ 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 + def list( + self, resource_group_name: str, deployment_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NginxCertificate"]: + """List all certificates 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 NginxCertificate or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.nginx.models.NginxCertificate] + :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.NginxCertificateListResponse] = 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("NginxCertificateListResponse", 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) @distributed_trace_async async def get( @@ -71,8 +154,6 @@ async def get( ) -> _models.NginxCertificate: """Get a certificate of given NGINX deployment. - Get a certificate 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 @@ -133,7 +214,7 @@ async def _create_or_update_initial( resource_group_name: str, deployment_name: str, certificate_name: str, - body: Optional[Union[_models.NginxCertificate, IO[bytes]]] = None, + body: Union[_models.NginxCertificate, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -157,10 +238,7 @@ async def _create_or_update_initial( if isinstance(body, (IOBase, bytes)): _content = body else: - if body is not None: - _json = self._serialize.body(body, "NginxCertificate") - else: - _json = None + _json = self._serialize.body(body, "NginxCertificate") _request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -193,10 +271,17 @@ async def _create_or_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 == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + 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 @@ -206,15 +291,13 @@ async def begin_create_or_update( resource_group_name: str, deployment_name: str, certificate_name: str, - body: Optional[_models.NginxCertificate] = None, + body: _models.NginxCertificate, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.NginxCertificate]: """Create or update the NGINX certificates for given NGINX deployment. - Create or update the NGINX certificates 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 @@ -222,7 +305,7 @@ async def begin_create_or_update( :type deployment_name: str :param certificate_name: The name of certificate. Required. :type certificate_name: str - :param body: The certificate. Default value is None. + :param body: The certificate. Required. :type body: ~azure.mgmt.nginx.models.NginxCertificate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -239,15 +322,13 @@ async def begin_create_or_update( resource_group_name: str, deployment_name: str, certificate_name: str, - body: Optional[IO[bytes]] = None, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.NginxCertificate]: """Create or update the NGINX certificates for given NGINX deployment. - Create or update the NGINX certificates 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 @@ -255,7 +336,7 @@ async def begin_create_or_update( :type deployment_name: str :param certificate_name: The name of certificate. Required. :type certificate_name: str - :param body: The certificate. Default value is None. + :param body: The certificate. Required. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -272,13 +353,11 @@ async def begin_create_or_update( resource_group_name: str, deployment_name: str, certificate_name: str, - body: Optional[Union[_models.NginxCertificate, IO[bytes]]] = None, + body: Union[_models.NginxCertificate, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.NginxCertificate]: """Create or update the NGINX certificates for given NGINX deployment. - Create or update the NGINX certificates 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 @@ -286,8 +365,7 @@ async def begin_create_or_update( :type deployment_name: str :param certificate_name: The name of certificate. Required. :type certificate_name: str - :param body: The certificate. Is either a NginxCertificate type or a IO[bytes] type. Default - value is None. + :param body: The certificate. Is either a NginxCertificate type or a IO[bytes] type. Required. :type body: ~azure.mgmt.nginx.models.NginxCertificate or IO[bytes] :return: An instance of AsyncLROPoller that returns either NginxCertificate or the result of cls(response) @@ -390,10 +468,15 @@ 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["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + 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 @@ -403,8 +486,6 @@ async def begin_delete( ) -> AsyncLROPoller[None]: """Deletes a certificate from the NGINX deployment. - Deletes a certificate from the NGINX deployment. - :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str @@ -443,7 +524,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -456,89 +539,3 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- 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.NginxCertificate"]: - """List all certificates of given NGINX deployment. - - List all certificates 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 NginxCertificate or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.nginx.models.NginxCertificate] - :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.NginxCertificateListResponse] = 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("NginxCertificateListResponse", 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/aio/operations/_configurations_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_configurations_operations.py index d5422b33ca06..089093e5c44f 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( @@ -72,8 +71,6 @@ def list( ) -> AsyncIterable["_models.NginxConfigurationResponse"]: """List the NGINX configuration of given NGINX deployment. - List the NGINX configuration 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 @@ -160,8 +157,6 @@ async def get( ) -> _models.NginxConfigurationResponse: """Get the NGINX configuration of given NGINX deployment. - Get the NGINX configuration 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 @@ -223,7 +218,7 @@ async def _create_or_update_initial( resource_group_name: str, deployment_name: str, configuration_name: str, - body: Optional[Union[_models.NginxConfigurationRequest, IO[bytes]]] = None, + body: Union[_models.NginxConfigurationResponse, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -247,10 +242,7 @@ async def _create_or_update_initial( if isinstance(body, (IOBase, bytes)): _content = body else: - if body is not None: - _json = self._serialize.body(body, "NginxConfigurationRequest") - else: - _json = None + _json = self._serialize.body(body, "NginxConfigurationResponse") _request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -283,10 +275,17 @@ async def _create_or_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 == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + 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 @@ -296,15 +295,13 @@ async def begin_create_or_update( resource_group_name: str, deployment_name: str, configuration_name: str, - body: Optional[_models.NginxConfigurationRequest] = None, + body: _models.NginxConfigurationResponse, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.NginxConfigurationResponse]: """Create or update the NGINX configuration for given NGINX deployment. - Create or update the NGINX configuration 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 @@ -313,8 +310,8 @@ async def begin_create_or_update( :param configuration_name: The name of configuration, only 'default' is supported value due to the singleton of NGINX conf. Required. :type configuration_name: str - :param body: The NGINX configuration. Default value is None. - :type body: ~azure.mgmt.nginx.models.NginxConfigurationRequest + :param body: The NGINX configuration. Required. + :type body: ~azure.mgmt.nginx.models.NginxConfigurationResponse :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -330,15 +327,13 @@ async def begin_create_or_update( resource_group_name: str, deployment_name: str, configuration_name: str, - body: Optional[IO[bytes]] = None, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.NginxConfigurationResponse]: """Create or update the NGINX configuration for given NGINX deployment. - Create or update the NGINX configuration 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 @@ -347,7 +342,7 @@ async def begin_create_or_update( :param configuration_name: The name of configuration, only 'default' is supported value due to the singleton of NGINX conf. Required. :type configuration_name: str - :param body: The NGINX configuration. Default value is None. + :param body: The NGINX configuration. Required. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -364,13 +359,11 @@ async def begin_create_or_update( resource_group_name: str, deployment_name: str, configuration_name: str, - body: Optional[Union[_models.NginxConfigurationRequest, IO[bytes]]] = None, + body: Union[_models.NginxConfigurationResponse, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.NginxConfigurationResponse]: """Create or update the NGINX configuration for given NGINX deployment. - Create or update the NGINX configuration 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 @@ -379,9 +372,9 @@ async def begin_create_or_update( :param configuration_name: The name of configuration, only 'default' is supported value due to the singleton of NGINX conf. Required. :type configuration_name: str - :param body: The NGINX configuration. Is either a NginxConfigurationRequest type or a IO[bytes] - type. Default value is None. - :type body: ~azure.mgmt.nginx.models.NginxConfigurationRequest or IO[bytes] + :param body: The NGINX configuration. Is either a NginxConfigurationResponse type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.nginx.models.NginxConfigurationResponse or IO[bytes] :return: An instance of AsyncLROPoller that returns either NginxConfigurationResponse or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxConfigurationResponse] @@ -483,10 +476,15 @@ 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["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + 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 @@ -496,8 +494,6 @@ async def begin_delete( ) -> AsyncLROPoller[None]: """Reset the NGINX configuration of given NGINX deployment to default. - Reset the NGINX configuration 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 @@ -537,7 +533,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -564,8 +562,6 @@ async def analysis( ) -> _models.AnalysisResult: """Analyze an NGINX configuration without applying it to the NGINXaaS deployment. - Analyze an NGINX configuration without applying it to the NGINXaaS deployment. - :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str @@ -597,8 +593,6 @@ async def analysis( ) -> _models.AnalysisResult: """Analyze an NGINX configuration without applying it to the NGINXaaS deployment. - Analyze an NGINX configuration without applying it to the NGINXaaS deployment. - :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str @@ -628,8 +622,6 @@ async def analysis( ) -> _models.AnalysisResult: """Analyze an NGINX configuration without applying it to the NGINXaaS deployment. - Analyze an NGINX configuration without applying it to the NGINXaaS deployment. - :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str 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..bd955dde6acd 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,17 +61,171 @@ 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 + def list(self, **kwargs: Any) -> AsyncIterable["_models.NginxDeployment"]: + """List the NGINX deployments resources. + + :return: An iterator like instance of either NginxDeployment or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.nginx.models.NginxDeployment] + :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.NginxDeploymentListResponse] = 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( + 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("NginxDeploymentListResponse", 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) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NginxDeployment"]: + """List all NGINX deployments under the specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either NginxDeployment or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.nginx.models.NginxDeployment] + :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.NginxDeploymentListResponse] = 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_by_resource_group_request( + resource_group_name=resource_group_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("NginxDeploymentListResponse", 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) @distributed_trace_async async def get(self, resource_group_name: str, deployment_name: str, **kwargs: Any) -> _models.NginxDeployment: """Get the NGINX deployment. - Get the NGINX deployment. - :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str @@ -129,7 +282,7 @@ async def _create_or_update_initial( self, resource_group_name: str, deployment_name: str, - body: Optional[Union[_models.NginxDeployment, IO[bytes]]] = None, + body: Union[_models.NginxDeployment, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -153,10 +306,7 @@ async def _create_or_update_initial( if isinstance(body, (IOBase, bytes)): _content = body else: - if body is not None: - _json = self._serialize.body(body, "NginxDeployment") - else: - _json = None + _json = self._serialize.body(body, "NginxDeployment") _request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -188,10 +338,17 @@ async def _create_or_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 == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + 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 @@ -200,21 +357,19 @@ async def begin_create_or_update( self, resource_group_name: str, deployment_name: str, - body: Optional[_models.NginxDeployment] = None, + body: _models.NginxDeployment, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.NginxDeployment]: """Create or update the NGINX deployment. - Create or update the 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 body: Default value is None. + :param body: Required. :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". @@ -230,21 +385,19 @@ async def begin_create_or_update( self, resource_group_name: str, deployment_name: str, - body: Optional[IO[bytes]] = None, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.NginxDeployment]: """Create or update the NGINX deployment. - Create or update the 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 body: Default value is None. + :param body: Required. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -260,19 +413,17 @@ async def begin_create_or_update( self, resource_group_name: str, deployment_name: str, - body: Optional[Union[_models.NginxDeployment, IO[bytes]]] = None, + body: Union[_models.NginxDeployment, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.NginxDeployment]: """Create or update the NGINX deployment. - Create or update the 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 body: Is either a NginxDeployment type or a IO[bytes] type. Default value is None. + :param body: Is either a NginxDeployment type or a IO[bytes] type. Required. :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) @@ -333,7 +484,7 @@ async def _update_initial( self, resource_group_name: str, deployment_name: str, - body: Optional[Union[_models.NginxDeploymentUpdateParameters, IO[bytes]]] = None, + body: Union[_models.NginxDeploymentUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -357,10 +508,7 @@ async def _update_initial( if isinstance(body, (IOBase, bytes)): _content = body else: - if body is not None: - _json = self._serialize.body(body, "NginxDeploymentUpdateParameters") - else: - _json = None + _json = self._serialize.body(body, "NginxDeploymentUpdateParameters") _request = build_update_request( resource_group_name=resource_group_name, @@ -392,10 +540,14 @@ 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 == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + 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 @@ -404,21 +556,19 @@ async def begin_update( self, resource_group_name: str, deployment_name: str, - body: Optional[_models.NginxDeploymentUpdateParameters] = None, + body: _models.NginxDeploymentUpdateParameters, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.NginxDeployment]: """Update the NGINX deployment. - Update the 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 body: Default value is None. + :param body: Required. :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". @@ -434,21 +584,19 @@ async def begin_update( self, resource_group_name: str, deployment_name: str, - body: Optional[IO[bytes]] = None, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.NginxDeployment]: """Update the NGINX deployment. - Update the 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 body: Default value is None. + :param body: Required. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -464,20 +612,17 @@ async def begin_update( self, resource_group_name: str, deployment_name: str, - body: Optional[Union[_models.NginxDeploymentUpdateParameters, IO[bytes]]] = None, + body: Union[_models.NginxDeploymentUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.NginxDeployment]: """Update the NGINX deployment. - Update the 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 body: Is either a NginxDeploymentUpdateParameters type or a IO[bytes] type. Default - value is None. + :param body: Is either a NginxDeploymentUpdateParameters type or a IO[bytes] type. Required. :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 +660,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": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -575,10 +723,15 @@ 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["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + 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 @@ -586,8 +739,6 @@ async def _delete_initial( async def begin_delete(self, resource_group_name: str, deployment_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Delete the NGINX deployment resource. - Delete the NGINX deployment resource. - :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str @@ -623,7 +774,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -636,163 +789,3 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- 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, **kwargs: Any) -> AsyncIterable["_models.NginxDeployment"]: - """List the NGINX deployments resources. - - List the NGINX deployments resources. - - :return: An iterator like instance of either NginxDeployment or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.nginx.models.NginxDeployment] - :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.NginxDeploymentListResponse] = 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( - 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("NginxDeploymentListResponse", 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) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.NginxDeployment"]: - """List all NGINX deployments under the specified resource group. - - List all NGINX deployments under the specified resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either NginxDeployment or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.nginx.models.NginxDeployment] - :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.NginxDeploymentListResponse] = 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_by_resource_group_request( - resource_group_name=resource_group_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("NginxDeploymentListResponse", 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/aio/operations/_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_operations.py index c945da5d2cef..748690dba932 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,17 @@ 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"]: - """List all operations provided by Nginx.NginxPlus for the 2024-11-01-preview api version. + def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: + """List the operations for the provider. - 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/models/__init__.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/__init__.py index 159f89a3eaec..e4a81e9c0d06 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 @@ -20,6 +20,8 @@ AnalysisResult, AnalysisResultData, AutoUpgradeProfile, + AzureResourceManagerArmResponseNginxDeployment, + AzureResourceManagerResourceSkuProperty, DiagnosticItem, ErrorAdditionalInfo, ErrorDetail, @@ -28,24 +30,16 @@ NginxCertificate, NginxCertificateErrorResponseBody, NginxCertificateListResponse, - NginxCertificateProperties, NginxConfigurationFile, NginxConfigurationListResponse, NginxConfigurationPackage, NginxConfigurationProtectedFileRequest, NginxConfigurationProtectedFileResponse, - NginxConfigurationRequest, - NginxConfigurationRequestProperties, NginxConfigurationResponse, - NginxConfigurationResponseProperties, NginxDeployment, NginxDeploymentApiKeyListResponse, - NginxDeploymentApiKeyRequest, - NginxDeploymentApiKeyRequestProperties, NginxDeploymentApiKeyResponse, - NginxDeploymentApiKeyResponseProperties, NginxDeploymentListResponse, - NginxDeploymentProperties, NginxDeploymentPropertiesNginxAppProtect, NginxDeploymentScalingProperties, NginxDeploymentUpdateParameters, @@ -59,13 +53,16 @@ NginxPrivateIPAddress, NginxPublicIPAddress, NginxStorageAccount, + Operation, OperationDisplay, OperationListResult, - OperationResult, - ResourceSku, + ProxyResource, + Resource, ScaleProfile, ScaleProfileCapacity, + Sku, SystemData, + TrackedResource, UserIdentityProperties, WebApplicationFirewallComponentVersions, WebApplicationFirewallPackage, @@ -74,12 +71,15 @@ ) from ._nginx_management_client_enums import ( # type: ignore + ActionType, ActivationState, CreatedByType, IdentityType, Level, NginxPrivateIPAllocationMethod, + Origin, ProvisioningState, + SkuTier, ) from ._patch import __all__ as _patch_all from ._patch import * @@ -92,6 +92,8 @@ "AnalysisResult", "AnalysisResultData", "AutoUpgradeProfile", + "AzureResourceManagerArmResponseNginxDeployment", + "AzureResourceManagerResourceSkuProperty", "DiagnosticItem", "ErrorAdditionalInfo", "ErrorDetail", @@ -100,24 +102,16 @@ "NginxCertificate", "NginxCertificateErrorResponseBody", "NginxCertificateListResponse", - "NginxCertificateProperties", "NginxConfigurationFile", "NginxConfigurationListResponse", "NginxConfigurationPackage", "NginxConfigurationProtectedFileRequest", "NginxConfigurationProtectedFileResponse", - "NginxConfigurationRequest", - "NginxConfigurationRequestProperties", "NginxConfigurationResponse", - "NginxConfigurationResponseProperties", "NginxDeployment", "NginxDeploymentApiKeyListResponse", - "NginxDeploymentApiKeyRequest", - "NginxDeploymentApiKeyRequestProperties", "NginxDeploymentApiKeyResponse", - "NginxDeploymentApiKeyResponseProperties", "NginxDeploymentListResponse", - "NginxDeploymentProperties", "NginxDeploymentPropertiesNginxAppProtect", "NginxDeploymentScalingProperties", "NginxDeploymentUpdateParameters", @@ -131,24 +125,30 @@ "NginxPrivateIPAddress", "NginxPublicIPAddress", "NginxStorageAccount", + "Operation", "OperationDisplay", "OperationListResult", - "OperationResult", - "ResourceSku", + "ProxyResource", + "Resource", "ScaleProfile", "ScaleProfileCapacity", + "Sku", "SystemData", + "TrackedResource", "UserIdentityProperties", "WebApplicationFirewallComponentVersions", "WebApplicationFirewallPackage", "WebApplicationFirewallSettings", "WebApplicationFirewallStatus", + "ActionType", "ActivationState", "CreatedByType", "IdentityType", "Level", "NginxPrivateIPAllocationMethod", + "Origin", "ProvisioningState", + "SkuTier", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() 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..bf91fda3a969 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 @@ -1,4 +1,4 @@ -# 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. @@ -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 @@ -259,6 +259,52 @@ def __init__(self, *, upgrade_channel: str, **kwargs: Any) -> None: self.upgrade_channel = upgrade_channel +class AzureResourceManagerArmResponseNginxDeployment(_serialization.Model): # pylint: disable=name-too-long + """Azure operation completed successfully. + + All required parameters must be populated in order to send to server. + + :ivar body: The body type of the operation request or response. Required. + :vartype body: ~azure.mgmt.nginx.models.NginxDeployment + """ + + _validation = { + "body": {"required": True}, + } + + _attribute_map = { + "body": {"key": "body", "type": "NginxDeployment"}, + } + + def __init__(self, *, body: "_models.NginxDeployment", **kwargs: Any) -> None: + """ + :keyword body: The body type of the operation request or response. Required. + :paramtype body: ~azure.mgmt.nginx.models.NginxDeployment + """ + super().__init__(**kwargs) + self.body = body + + +class AzureResourceManagerResourceSkuProperty(_serialization.Model): + """The SKU (Stock Keeping Unit) assigned to this resource. + + :ivar sku: The SKU (Stock Keeping Unit) assigned to this resource. + :vartype sku: ~azure.mgmt.nginx.models.Sku + """ + + _attribute_map = { + "sku": {"key": "sku", "type": "Sku"}, + } + + def __init__(self, *, sku: Optional["_models.Sku"] = None, **kwargs: Any) -> None: + """ + :keyword sku: The SKU (Stock Keeping Unit) assigned to this resource. + :paramtype sku: ~azure.mgmt.nginx.models.Sku + """ + super().__init__(**kwargs) + self.sku = sku + + class DiagnosticItem(_serialization.Model): """A diagnostic is a message associated with an NGINX config. The Analyzer returns diagnostics with a level indicating the importance of the diagnostic with optional category. @@ -377,8 +423,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 +463,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): @@ -488,28 +534,27 @@ def __init__( :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. +class Resource(_serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str - :ivar name: + :ivar name: The name of the resource. :vartype name: str - :ivar type: + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar 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. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.nginx.models.SystemData """ @@ -524,96 +569,57 @@ class NginxCertificate(_serialization.Model): "id": {"key": "id", "type": "str"}, "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: - """ - :keyword properties: - :paramtype properties: ~azure.mgmt.nginx.models.NginxCertificateProperties - :keyword location: - :paramtype location: str - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.properties = properties - self.location = location - self.system_data = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.system_data: Optional["_models.SystemData"] = None -class NginxCertificateErrorResponseBody(_serialization.Model): - """NginxCertificateErrorResponseBody. - - :ivar code: - :vartype code: str - :ivar message: - :vartype message: str - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. - def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword code: - :paramtype code: str - :keyword message: - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class NginxCertificateListResponse(_serialization.Model): - """NginxCertificateListResponse. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: - :vartype value: list[~azure.mgmt.nginx.models.NginxCertificate] - :ivar next_link: - :vartype next_link: str + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.nginx.models.SystemData """ - _attribute_map = { - "value": {"key": "value", "type": "[NginxCertificate]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.NginxCertificate"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: list[~azure.mgmt.nginx.models.NginxCertificate] - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - -class NginxCertificateProperties(_serialization.Model): - """NginxCertificateProperties. +class NginxCertificate(ProxyResource): + """Concrete proxy resource types can be created by aliasing this type using a specific property + type. Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.nginx.models.SystemData + :ivar location: + :vartype location: str :ivar 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 @@ -634,6 +640,10 @@ class NginxCertificateProperties(_serialization.Model): """ _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, "provisioning_state": {"readonly": True}, "sha1_thumbprint": {"readonly": True}, "key_vault_secret_version": {"readonly": True}, @@ -641,19 +651,25 @@ class NginxCertificateProperties(_serialization.Model): } _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "key_virtual_path": {"key": "keyVirtualPath", "type": "str"}, - "certificate_virtual_path": {"key": "certificateVirtualPath", "type": "str"}, - "key_vault_secret_id": {"key": "keyVaultSecretId", "type": "str"}, - "sha1_thumbprint": {"key": "sha1Thumbprint", "type": "str"}, - "key_vault_secret_version": {"key": "keyVaultSecretVersion", "type": "str"}, - "key_vault_secret_created": {"key": "keyVaultSecretCreated", "type": "iso-8601"}, - "certificate_error": {"key": "certificateError", "type": "NginxCertificateErrorResponseBody"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "location": {"key": "location", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "key_virtual_path": {"key": "properties.keyVirtualPath", "type": "str"}, + "certificate_virtual_path": {"key": "properties.certificateVirtualPath", "type": "str"}, + "key_vault_secret_id": {"key": "properties.keyVaultSecretId", "type": "str"}, + "sha1_thumbprint": {"key": "properties.sha1Thumbprint", "type": "str"}, + "key_vault_secret_version": {"key": "properties.keyVaultSecretVersion", "type": "str"}, + "key_vault_secret_created": {"key": "properties.keyVaultSecretCreated", "type": "iso-8601"}, + "certificate_error": {"key": "properties.certificateError", "type": "NginxCertificateErrorResponseBody"}, } def __init__( self, *, + location: Optional[str] = None, key_virtual_path: Optional[str] = None, certificate_virtual_path: Optional[str] = None, key_vault_secret_id: Optional[str] = None, @@ -661,6 +677,8 @@ def __init__( **kwargs: Any ) -> None: """ + :keyword location: + :paramtype location: str :keyword key_virtual_path: :paramtype key_virtual_path: str :keyword certificate_virtual_path: @@ -671,16 +689,77 @@ def __init__( :paramtype certificate_error: ~azure.mgmt.nginx.models.NginxCertificateErrorResponseBody """ super().__init__(**kwargs) - self.provisioning_state = None + self.location = location + 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 NginxCertificateErrorResponseBody(_serialization.Model): + """NginxCertificateErrorResponseBody. + + :ivar code: + :vartype code: str + :ivar message: + :vartype message: str + """ + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword code: + :paramtype code: str + :keyword message: + :paramtype message: str + """ + super().__init__(**kwargs) + self.code = code + self.message = message + + +class NginxCertificateListResponse(_serialization.Model): + """Paged collection of NginxCertificate items. + + All required parameters must be populated in order to send to server. + + :ivar value: The NginxCertificate items on this page. Required. + :vartype value: list[~azure.mgmt.nginx.models.NginxCertificate] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[NginxCertificate]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.NginxCertificate"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The NginxCertificate items on this page. Required. + :paramtype value: list[~azure.mgmt.nginx.models.NginxCertificate] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + class NginxConfigurationFile(_serialization.Model): """NginxConfigurationFile. @@ -710,28 +789,30 @@ def __init__(self, *, content: Optional[str] = None, virtual_path: Optional[str] class NginxConfigurationListResponse(_serialization.Model): """Response of a list operation. - :ivar value: Results of a list operation. + All required parameters must be populated in order to send to server. + + :ivar value: The NginxConfigurationResponse items on this page. Required. :vartype value: list[~azure.mgmt.nginx.models.NginxConfigurationResponse] - :ivar next_link: Link to the next set of results, if any. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ + _validation = { + "value": {"required": True}, + } + _attribute_map = { "value": {"key": "value", "type": "[NginxConfigurationResponse]"}, "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.NginxConfigurationResponse"]] = None, - next_link: Optional[str] = None, - **kwargs: Any + self, *, value: List["_models.NginxConfigurationResponse"], next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword value: Results of a list operation. + :keyword value: The NginxConfigurationResponse items on this page. Required. :paramtype value: list[~azure.mgmt.nginx.models.NginxConfigurationResponse] - :keyword next_link: Link to the next set of results, if any. + :keyword next_link: The link to the next page of items. :paramtype next_link: str """ super().__init__(**kwargs) @@ -840,187 +921,55 @@ def __init__( self.content_hash = content_hash -class NginxConfigurationRequest(_serialization.Model): - """NginxConfigurationRequest. +class NginxConfigurationResponse(ProxyResource): + """Concrete proxy resource types can be created by aliasing this type using a specific property + type. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str - :ivar name: + :ivar name: The name of the resource. :vartype name: str - :ivar type: + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar properties: - :vartype properties: ~azure.mgmt.nginx.models.NginxConfigurationRequestProperties - :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :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": "NginxConfigurationRequestProperties"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__( - self, *, properties: Optional["_models.NginxConfigurationRequestProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: - :paramtype properties: ~azure.mgmt.nginx.models.NginxConfigurationRequestProperties - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.properties = properties - self.system_data = None - - -class NginxConfigurationRequestProperties(_serialization.Model): - """NginxConfigurationRequestProperties. - - 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". :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] + :vartype protected_files: + list[~azure.mgmt.nginx.models.NginxConfigurationProtectedFileResponse] :ivar package: :vartype package: ~azure.mgmt.nginx.models.NginxConfigurationPackage :ivar root_file: :vartype root_file: str """ - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "files": {"key": "files", "type": "[NginxConfigurationFile]"}, - "protected_files": {"key": "protectedFiles", "type": "[NginxConfigurationProtectedFileRequest]"}, - "package": {"key": "package", "type": "NginxConfigurationPackage"}, - "root_file": {"key": "rootFile", "type": "str"}, - } - - def __init__( - self, - *, - files: Optional[List["_models.NginxConfigurationFile"]] = None, - protected_files: Optional[List["_models.NginxConfigurationProtectedFileRequest"]] = None, - package: Optional["_models.NginxConfigurationPackage"] = None, - root_file: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword files: - :paramtype files: list[~azure.mgmt.nginx.models.NginxConfigurationFile] - :keyword protected_files: - :paramtype protected_files: - list[~azure.mgmt.nginx.models.NginxConfigurationProtectedFileRequest] - :keyword package: - :paramtype package: ~azure.mgmt.nginx.models.NginxConfigurationPackage - :keyword root_file: - :paramtype root_file: str - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.files = files - self.protected_files = protected_files - self.package = package - self.root_file = root_file - - -class NginxConfigurationResponse(_serialization.Model): - """NginxConfigurationResponse. - - 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: - :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 - """ - _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "properties": {"key": "properties", "type": "NginxConfigurationResponseProperties"}, "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__( - self, *, properties: Optional["_models.NginxConfigurationResponseProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: - :paramtype properties: ~azure.mgmt.nginx.models.NginxConfigurationResponseProperties - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.properties = properties - self.system_data = None - - -class NginxConfigurationResponseProperties(_serialization.Model): - """NginxConfigurationResponseProperties. - - 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". - :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: - :vartype package: ~azure.mgmt.nginx.models.NginxConfigurationPackage - :ivar root_file: - :vartype root_file: str - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "files": {"key": "files", "type": "[NginxConfigurationFile]"}, - "protected_files": {"key": "protectedFiles", "type": "[NginxConfigurationProtectedFileResponse]"}, - "package": {"key": "package", "type": "NginxConfigurationPackage"}, - "root_file": {"key": "rootFile", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "files": {"key": "properties.files", "type": "[NginxConfigurationFile]"}, + "protected_files": {"key": "properties.protectedFiles", "type": "[NginxConfigurationProtectedFileResponse]"}, + "package": {"key": "properties.package", "type": "NginxConfigurationPackage"}, + "root_file": {"key": "properties.rootFile", "type": "str"}, } def __init__( @@ -1044,36 +993,36 @@ def __init__( :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 self.root_file = root_file -class NginxDeployment(_serialization.Model): - """NginxDeployment. +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str - :ivar name: + :ivar name: The name of the resource. :vartype name: str - :ivar type: + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar identity: - :vartype identity: ~azure.mgmt.nginx.models.IdentityProperties - :ivar properties: - :vartype properties: ~azure.mgmt.nginx.models.NginxDeploymentProperties - :ivar tags: Dictionary of :code:``. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.nginx.models.SystemData + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar sku: - :vartype sku: ~azure.mgmt.nginx.models.ResourceSku - :ivar location: + :ivar location: The geo-location where the resource lives. Required. :vartype location: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.nginx.models.SystemData """ _validation = { @@ -1081,266 +1030,57 @@ class NginxDeployment(_serialization.Model): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "identity": {"key": "identity", "type": "IdentityProperties"}, - "properties": {"key": "properties", "type": "NginxDeploymentProperties"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, - "sku": {"key": "sku", "type": "ResourceSku"}, "location": {"key": "location", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__( - self, - *, - identity: Optional["_models.IdentityProperties"] = None, - properties: Optional["_models.NginxDeploymentProperties"] = None, - tags: Optional[Dict[str, str]] = None, - sku: Optional["_models.ResourceSku"] = None, - location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword identity: - :paramtype identity: ~azure.mgmt.nginx.models.IdentityProperties - :keyword properties: - :paramtype properties: ~azure.mgmt.nginx.models.NginxDeploymentProperties - :keyword tags: Dictionary of :code:``. - :paramtype tags: dict[str, str] - :keyword sku: - :paramtype sku: ~azure.mgmt.nginx.models.ResourceSku - :keyword location: - :paramtype location: str - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.identity = identity - self.properties = properties - self.tags = tags - self.sku = sku - self.location = location - self.system_data = None - - -class NginxDeploymentApiKeyListResponse(_serialization.Model): - """NginxDeploymentApiKeyListResponse. - - :ivar value: - :vartype value: list[~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[NginxDeploymentApiKeyResponse]"}, - "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.NginxDeploymentApiKeyResponse"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: list[~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse] - :keyword next_link: - :paramtype next_link: str + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class NginxDeploymentApiKeyRequest(_serialization.Model): - """NginxDeploymentApiKeyRequest. - - 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: - :vartype properties: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyRequestProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "properties": {"key": "properties", "type": "NginxDeploymentApiKeyRequestProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.NginxDeploymentApiKeyRequestProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: - :paramtype properties: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyRequestProperties - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.properties = properties - - -class NginxDeploymentApiKeyRequestProperties(_serialization.Model): - """NginxDeploymentApiKeyRequestProperties. - - :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' - property. - :vartype secret_text: str - :ivar end_date_time: The time after which this Dataplane API Key is no longer valid. - :vartype end_date_time: ~datetime.datetime - """ - - _attribute_map = { - "secret_text": {"key": "secretText", "type": "str"}, - "end_date_time": {"key": "endDateTime", "type": "iso-8601"}, - } - - def __init__( - self, *, secret_text: Optional[str] = None, end_date_time: Optional[datetime.datetime] = None, **kwargs: Any - ) -> None: - """ - :keyword 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' property. - :paramtype secret_text: str - :keyword end_date_time: The time after which this Dataplane API Key is no longer valid. - :paramtype end_date_time: ~datetime.datetime - """ - super().__init__(**kwargs) - self.secret_text = secret_text - self.end_date_time = end_date_time - - -class NginxDeploymentApiKeyResponse(_serialization.Model): - """NginxDeploymentApiKeyResponse. - - 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: - :vartype properties: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponseProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "properties": {"key": "properties", "type": "NginxDeploymentApiKeyResponseProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.NginxDeploymentApiKeyResponseProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: - :paramtype properties: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponseProperties - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.properties = properties - - -class NginxDeploymentApiKeyResponseProperties(_serialization.Model): - """NginxDeploymentApiKeyResponseProperties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar hint: The first three characters of the secret text to help identify it in use. This - property is read-only. - :vartype hint: str - :ivar end_date_time: The time after which this Dataplane API Key is no longer valid. - :vartype end_date_time: ~datetime.datetime - """ - - _validation = { - "hint": {"readonly": True}, - } - - _attribute_map = { - "hint": {"key": "hint", "type": "str"}, - "end_date_time": {"key": "endDateTime", "type": "iso-8601"}, - } - - def __init__(self, *, end_date_time: Optional[datetime.datetime] = None, **kwargs: Any) -> None: - """ - :keyword end_date_time: The time after which this Dataplane API Key is no longer valid. - :paramtype end_date_time: ~datetime.datetime - """ - super().__init__(**kwargs) - self.hint = None - self.end_date_time = end_date_time - - -class NginxDeploymentListResponse(_serialization.Model): - """NginxDeploymentListResponse. - - :ivar value: - :vartype value: list[~azure.mgmt.nginx.models.NginxDeployment] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[NginxDeployment]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.NginxDeployment"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: list[~azure.mgmt.nginx.models.NginxDeployment] - :keyword next_link: - :paramtype next_link: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str """ super().__init__(**kwargs) - self.value = value - self.next_link = next_link + self.tags = tags + self.location = location -class NginxDeploymentProperties(_serialization.Model): - """NginxDeploymentProperties. +class NginxDeployment(TrackedResource): + """Concrete tracked resource types can be created by aliasing this type using a specific property + type. 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 id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.nginx.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar identity: + :vartype identity: ~azure.mgmt.nginx.models.IdentityProperties + :ivar sku: The SKU (Stock Keeping Unit) assigned to this resource. + :vartype sku: ~azure.mgmt.nginx.models.AzureResourceManagerResourceSkuProperty :ivar 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 @@ -1368,6 +1108,11 @@ class NginxDeploymentProperties(_serialization.Model): """ _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, "provisioning_state": {"readonly": True}, "nginx_version": {"readonly": True}, "ip_address": {"readonly": True}, @@ -1375,22 +1120,34 @@ class NginxDeploymentProperties(_serialization.Model): } _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "nginx_version": {"key": "nginxVersion", "type": "str"}, - "network_profile": {"key": "networkProfile", "type": "NginxNetworkProfile"}, - "ip_address": {"key": "ipAddress", "type": "str"}, - "enable_diagnostics_support": {"key": "enableDiagnosticsSupport", "type": "bool"}, - "logging": {"key": "logging", "type": "NginxLogging"}, - "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"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "identity": {"key": "identity", "type": "IdentityProperties"}, + "sku": {"key": "sku", "type": "AzureResourceManagerResourceSkuProperty"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "nginx_version": {"key": "properties.nginxVersion", "type": "str"}, + "network_profile": {"key": "properties.networkProfile", "type": "NginxNetworkProfile"}, + "ip_address": {"key": "properties.ipAddress", "type": "str"}, + "enable_diagnostics_support": {"key": "properties.enableDiagnosticsSupport", "type": "bool"}, + "logging": {"key": "properties.logging", "type": "NginxLogging"}, + "scaling_properties": {"key": "properties.scalingProperties", "type": "NginxDeploymentScalingProperties"}, + "auto_upgrade_profile": {"key": "properties.autoUpgradeProfile", "type": "AutoUpgradeProfile"}, + "user_profile": {"key": "properties.userProfile", "type": "NginxDeploymentUserProfile"}, + "nginx_app_protect": {"key": "properties.nginxAppProtect", "type": "NginxDeploymentPropertiesNginxAppProtect"}, + "dataplane_api_endpoint": {"key": "properties.dataplaneApiEndpoint", "type": "str"}, } def __init__( self, *, + location: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.IdentityProperties"] = None, + sku: Optional["_models.AzureResourceManagerResourceSkuProperty"] = None, network_profile: Optional["_models.NginxNetworkProfile"] = None, enable_diagnostics_support: Optional[bool] = None, logging: Optional["_models.NginxLogging"] = None, @@ -1401,6 +1158,14 @@ def __init__( **kwargs: Any ) -> None: """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword identity: + :paramtype identity: ~azure.mgmt.nginx.models.IdentityProperties + :keyword sku: The SKU (Stock Keeping Unit) assigned to this resource. + :paramtype sku: ~azure.mgmt.nginx.models.AzureResourceManagerResourceSkuProperty :keyword network_profile: :paramtype network_profile: ~azure.mgmt.nginx.models.NginxNetworkProfile :keyword enable_diagnostics_support: @@ -1416,18 +1181,139 @@ def __init__( :keyword nginx_app_protect: Settings for NGINX App Protect (NAP). :paramtype nginx_app_protect: ~azure.mgmt.nginx.models.NginxDeploymentPropertiesNginxAppProtect """ - super().__init__(**kwargs) - self.provisioning_state = None - self.nginx_version = None + super().__init__(tags=tags, location=location, **kwargs) + self.identity = identity + self.sku = sku + 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 + self.dataplane_api_endpoint: Optional[str] = None + + +class NginxDeploymentApiKeyListResponse(_serialization.Model): + """Paged collection of NginxDeploymentApiKeyResponse items. + + All required parameters must be populated in order to send to server. + + :ivar value: The NginxDeploymentApiKeyResponse items on this page. Required. + :vartype value: list[~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[NginxDeploymentApiKeyResponse]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.NginxDeploymentApiKeyResponse"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The NginxDeploymentApiKeyResponse items on this page. Required. + :paramtype value: list[~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NginxDeploymentApiKeyResponse(ProxyResource): + """Concrete proxy resource types can be created by aliasing this type using a specific property + type. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.nginx.models.SystemData + :ivar hint: The first three characters of the secret text to help identify it in use. This + property is read-only. + :vartype hint: str + :ivar end_date_time: The time after which this Dataplane API Key is no longer valid. + :vartype end_date_time: ~datetime.datetime + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "hint": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "hint": {"key": "properties.hint", "type": "str"}, + "end_date_time": {"key": "properties.endDateTime", "type": "iso-8601"}, + } + + def __init__(self, *, end_date_time: Optional[datetime.datetime] = None, **kwargs: Any) -> None: + """ + :keyword end_date_time: The time after which this Dataplane API Key is no longer valid. + :paramtype end_date_time: ~datetime.datetime + """ + super().__init__(**kwargs) + self.hint: Optional[str] = None + self.end_date_time = end_date_time + + +class NginxDeploymentListResponse(_serialization.Model): + """Paged collection of NginxDeployment items. + + All required parameters must be populated in order to send to server. + + :ivar value: The NginxDeployment items on this page. Required. + :vartype value: list[~azure.mgmt.nginx.models.NginxDeployment] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[NginxDeployment]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.NginxDeployment"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The NginxDeployment items on this page. Required. + :paramtype value: list[~azure.mgmt.nginx.models.NginxDeployment] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link class NginxDeploymentPropertiesNginxAppProtect(_serialization.Model): @@ -1473,7 +1359,7 @@ def __init__( """ super().__init__(**kwargs) 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): @@ -1511,8 +1397,8 @@ class NginxDeploymentUpdateParameters(_serialization.Model): :vartype identity: ~azure.mgmt.nginx.models.IdentityProperties :ivar tags: Dictionary of :code:``. :vartype tags: dict[str, str] - :ivar sku: - :vartype sku: ~azure.mgmt.nginx.models.ResourceSku + :ivar sku: The SKU (Stock Keeping Unit) assigned to this resource. + :vartype sku: ~azure.mgmt.nginx.models.AzureResourceManagerResourceSkuProperty :ivar location: :vartype location: str :ivar properties: @@ -1522,7 +1408,7 @@ class NginxDeploymentUpdateParameters(_serialization.Model): _attribute_map = { "identity": {"key": "identity", "type": "IdentityProperties"}, "tags": {"key": "tags", "type": "{str}"}, - "sku": {"key": "sku", "type": "ResourceSku"}, + "sku": {"key": "sku", "type": "AzureResourceManagerResourceSkuProperty"}, "location": {"key": "location", "type": "str"}, "properties": {"key": "properties", "type": "NginxDeploymentUpdateProperties"}, } @@ -1532,7 +1418,7 @@ def __init__( *, identity: Optional["_models.IdentityProperties"] = None, tags: Optional[Dict[str, str]] = None, - sku: Optional["_models.ResourceSku"] = None, + sku: Optional["_models.AzureResourceManagerResourceSkuProperty"] = None, location: Optional[str] = None, properties: Optional["_models.NginxDeploymentUpdateProperties"] = None, **kwargs: Any @@ -1542,8 +1428,8 @@ def __init__( :paramtype identity: ~azure.mgmt.nginx.models.IdentityProperties :keyword tags: Dictionary of :code:``. :paramtype tags: dict[str, str] - :keyword sku: - :paramtype sku: ~azure.mgmt.nginx.models.ResourceSku + :keyword sku: The SKU (Stock Keeping Unit) assigned to this resource. + :paramtype sku: ~azure.mgmt.nginx.models.AzureResourceManagerResourceSkuProperty :keyword location: :paramtype location: str :keyword properties: @@ -1882,143 +1768,125 @@ def __init__( self.container_name = container_name -class OperationDisplay(_serialization.Model): - """The object that represents the operation. +class Operation(_serialization.Model): + """Details of a REST API operation, returned from the Resource Provider Operations API. - :ivar provider: Service provider: Nginx.NginxPlus. - :vartype provider: str - :ivar resource: Type on which the operation is performed, e.g., 'deployments'. - :vartype resource: str - :ivar operation: Operation type, e.g., read, write, delete, etc. - :vartype operation: str - :ivar description: Description of the operation, e.g., 'Write deployments'. - :vartype description: str + 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 """ - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, + _validation = { + "name": {"readonly": True}, + "is_data_action": {"readonly": True}, + "origin": {"readonly": True}, + "action_type": {"readonly": True}, } - def __init__( - self, - *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword provider: Service provider: Nginx.NginxPlus. - :paramtype provider: str - :keyword resource: Type on which the operation is performed, e.g., 'deployments'. - :paramtype resource: str - :keyword operation: Operation type, e.g., read, write, delete, etc. - :paramtype operation: str - :keyword description: Description of the operation, e.g., 'Write deployments'. - :paramtype description: str - """ - super().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationListResult(_serialization.Model): - """Result of GET request to list Nginx.NginxPlus operations. - - :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. - :vartype next_link: str - """ - _attribute_map = { - "value": {"key": "value", "type": "[OperationResult]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "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, *, value: Optional[List["_models.OperationResult"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: + def __init__(self, *, display: Optional["_models.OperationDisplay"] = 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 + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure.mgmt.nginx.models.OperationDisplay """ super().__init__(**kwargs) - self.value = value - self.next_link = next_link + 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 OperationResult(_serialization.Model): - """A Nginx.NginxPlus REST API operation. +class OperationDisplay(_serialization.Model): + """Localized display information for this particular operation. - :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 - :ivar is_data_action: Indicates whether the operation is a data action. - :vartype is_data_action: bool + 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 = { - "name": {"key": "name", "type": "str"}, - "display": {"key": "display", "type": "OperationDisplay"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "description": {"key": "description", "type": "str"}, } - def __init__( - self, - *, - name: Optional[str] = None, - display: Optional["_models.OperationDisplay"] = None, - is_data_action: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :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 - :keyword is_data_action: Indicates whether the operation is a data action. - :paramtype is_data_action: bool - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.name = name - self.display = display - self.is_data_action = is_data_action + self.provider: Optional[str] = None + self.resource: Optional[str] = None + self.operation: Optional[str] = None + self.description: Optional[str] = None -class ResourceSku(_serialization.Model): - """ResourceSku. +class OperationListResult(_serialization.Model): + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link + to get the next set of results. - All required parameters must be populated in order to send to server. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Name of the SKU. Required. - :vartype name: str + :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 = { - "name": {"required": True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: Name of the SKU. Required. - :paramtype name: str - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.name = name + self.value: Optional[List["_models.Operation"]] = None + self.next_link: Optional[str] = None class ScaleProfile(_serialization.Model): @@ -2066,8 +1934,8 @@ class ScaleProfileCapacity(_serialization.Model): """ _validation = { - "min": {"required": True, "minimum": 0}, - "max": {"required": True, "minimum": 0}, + "min": {"required": True}, + "max": {"required": True}, } _attribute_map = { @@ -2093,6 +1961,75 @@ def __init__( self.max = max +class Sku(_serialization.Model): + """The resource model definition representing SKU. + + All required parameters must be populated in order to send to server. + + :ivar name: The name of the SKU. E.g. P3. It is typically a letter+number code. Required. + :vartype name: str + :ivar tier: This field is required to be implemented by the Resource Provider if the service + has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", + "Standard", and "Premium". + :vartype tier: str or ~azure.mgmt.nginx.models.SkuTier + :ivar size: The SKU size. When the name field is the combination of tier and some other value, + this would be the standalone code. + :vartype size: str + :ivar family: If the service has different generations of hardware, for the same SKU, then that + can be captured here. + :vartype family: str + :ivar capacity: If the SKU supports scale out/in then the capacity integer should be included. + If scale out/in is not possible for the resource this may be omitted. + :vartype capacity: int + """ + + _validation = { + "name": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + "size": {"key": "size", "type": "str"}, + "family": {"key": "family", "type": "str"}, + "capacity": {"key": "capacity", "type": "int"}, + } + + def __init__( + self, + *, + name: str, + tier: Optional[Union[str, "_models.SkuTier"]] = None, + size: Optional[str] = None, + family: Optional[str] = None, + capacity: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the SKU. E.g. P3. It is typically a letter+number code. Required. + :paramtype name: str + :keyword tier: This field is required to be implemented by the Resource Provider if the service + has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", + "Standard", and "Premium". + :paramtype tier: str or ~azure.mgmt.nginx.models.SkuTier + :keyword size: The SKU size. When the name field is the combination of tier and some other + value, this would be the standalone code. + :paramtype size: str + :keyword family: If the service has different generations of hardware, for the same SKU, then + that can be captured here. + :paramtype family: str + :keyword capacity: If the SKU supports scale out/in then the capacity integer should be + included. If scale out/in is not possible for the resource this may be omitted. + :paramtype capacity: int + """ + super().__init__(**kwargs) + self.name = name + self.tier = tier + self.size = size + self.family = family + self.capacity = capacity + + class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. @@ -2181,8 +2118,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): @@ -2318,7 +2255,7 @@ class WebApplicationFirewallStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.attack_signatures_package = None - self.bot_signatures_package = None - self.threat_campaigns_package = None - self.component_versions = None + 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..2fdacf5918f6 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.""" @@ -49,6 +55,16 @@ class NginxPrivateIPAllocationMethod(str, Enum, metaclass=CaseInsensitiveEnumMet 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.""" @@ -61,3 +77,14 @@ class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): CANCELED = "Canceled" DELETED = "Deleted" NOT_SPECIFIED = "NotSpecified" + + +class SkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """This field is required to be implemented by the Resource Provider if the service has more than + one tier, but is not required on a PUT. + """ + + FREE = "Free" + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" 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..7ecb29e64fff 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 @@ -12,22 +12,22 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import +from ._operations import Operations # type: ignore +from ._deployments_operations import DeploymentsOperations # type: ignore from ._api_keys_operations import ApiKeysOperations # type: ignore from ._certificates_operations import CertificatesOperations # type: ignore from ._configurations_operations import ConfigurationsOperations # type: ignore -from ._deployments_operations import DeploymentsOperations # type: ignore -from ._operations import Operations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ + "Operations", + "DeploymentsOperations", "ApiKeysOperations", "CertificatesOperations", "ConfigurationsOperations", - "DeploymentsOperations", - "Operations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() 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..416e6d1dfc29 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]] @@ -39,21 +38,20 @@ _SERIALIZER.client_side_validation = False -def build_create_or_update_request( - resource_group_name: str, deployment_name: str, api_key_name: str, subscription_id: str, **kwargs: Any +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", "2024-11-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}/apiKeys/{apiKeyName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/apiKeys", + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -65,9 +63,6 @@ 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])$", ), - "apiKeyName": _SERIALIZER.url( - "api_key_name", api_key_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 @@ -76,14 +71,12 @@ def build_create_or_update_request( _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) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( +def build_get_request( resource_group_name: str, deployment_name: str, api_key_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -96,7 +89,7 @@ def build_delete_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( @@ -121,23 +114,24 @@ def build_delete_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( +def build_create_or_update_request( resource_group_name: str, deployment_name: str, api_key_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", "2024-11-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}/apiKeys/{apiKeyName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -160,13 +154,15 @@ def build_get_request( _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="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - resource_group_name: str, deployment_name: str, subscription_id: str, **kwargs: Any +def build_delete_request( + resource_group_name: str, deployment_name: str, api_key_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -177,8 +173,8 @@ def build_list_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/apiKeys", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/apiKeys/{apiKeyName}", + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -190,6 +186,9 @@ def build_list_request( "str", pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", ), + "apiKeyName": _SERIALIZER.url( + "api_key_name", api_key_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 @@ -200,7 +199,7 @@ def build_list_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) class ApiKeysOperations: @@ -217,10 +216,156 @@ 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") + + @distributed_trace + def list( + self, resource_group_name: str, deployment_name: str, **kwargs: Any + ) -> Iterable["_models.NginxDeploymentApiKeyResponse"]: + """List all API Keys of the 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 NginxDeploymentApiKeyResponse or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse] + :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.NginxDeploymentApiKeyListResponse] = 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("NginxDeploymentApiKeyListResponse", 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) + + @distributed_trace + def get( + self, resource_group_name: str, deployment_name: str, api_key_name: str, **kwargs: Any + ) -> _models.NginxDeploymentApiKeyResponse: + """Get the specified API Key of the 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 api_key_name: The resource name of the API key. Required. + :type api_key_name: str + :return: NginxDeploymentApiKeyResponse or the result of cls(response) + :rtype: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse + :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.NginxDeploymentApiKeyResponse] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + api_key_name=api_key_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("NginxDeploymentApiKeyResponse", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def create_or_update( @@ -228,7 +373,7 @@ def create_or_update( resource_group_name: str, deployment_name: str, api_key_name: str, - body: Optional[_models.NginxDeploymentApiKeyRequest] = None, + body: _models.NginxDeploymentApiKeyResponse, *, content_type: str = "application/json", **kwargs: Any @@ -236,9 +381,6 @@ def create_or_update( """Create or update an API Key for the Nginx deployment in order to access the dataplane API endpoint. - Create or update an API Key for the Nginx deployment in order to access the dataplane API - endpoint. - :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str @@ -247,8 +389,8 @@ def create_or_update( :param api_key_name: The resource name of the API key. Required. :type api_key_name: str :param body: The API Key object containing fields (e.g. secret text, expiration date) to upsert - the key. Default value is None. - :type body: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyRequest + the key. Required. + :type body: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -263,7 +405,7 @@ def create_or_update( resource_group_name: str, deployment_name: str, api_key_name: str, - body: Optional[IO[bytes]] = None, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -271,9 +413,6 @@ def create_or_update( """Create or update an API Key for the Nginx deployment in order to access the dataplane API endpoint. - Create or update an API Key for the Nginx deployment in order to access the dataplane API - endpoint. - :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str @@ -282,7 +421,7 @@ def create_or_update( :param api_key_name: The resource name of the API key. Required. :type api_key_name: str :param body: The API Key object containing fields (e.g. secret text, expiration date) to upsert - the key. Default value is None. + the key. Required. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -298,15 +437,12 @@ def create_or_update( resource_group_name: str, deployment_name: str, api_key_name: str, - body: Optional[Union[_models.NginxDeploymentApiKeyRequest, IO[bytes]]] = None, + body: Union[_models.NginxDeploymentApiKeyResponse, IO[bytes]], **kwargs: Any ) -> _models.NginxDeploymentApiKeyResponse: """Create or update an API Key for the Nginx deployment in order to access the dataplane API endpoint. - Create or update an API Key for the Nginx deployment in order to access the dataplane API - endpoint. - :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str @@ -315,9 +451,8 @@ def create_or_update( :param api_key_name: The resource name of the API key. Required. :type api_key_name: str :param body: The API Key object containing fields (e.g. secret text, expiration date) to upsert - the key. Is either a NginxDeploymentApiKeyRequest type or a IO[bytes] type. Default value is - None. - :type body: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyRequest or IO[bytes] + the key. Is either a NginxDeploymentApiKeyResponse type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse or IO[bytes] :return: NginxDeploymentApiKeyResponse or the result of cls(response) :rtype: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -343,10 +478,7 @@ def create_or_update( if isinstance(body, (IOBase, bytes)): _content = body else: - if body is not None: - _json = self._serialize.body(body, "NginxDeploymentApiKeyRequest") - else: - _json = None + _json = self._serialize.body(body, "NginxDeploymentApiKeyResponse") _request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -387,8 +519,6 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete API key for Nginx deployment. - Delete API key for Nginx deployment. - :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str @@ -439,153 +569,3 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, deployment_name: str, api_key_name: str, **kwargs: Any - ) -> _models.NginxDeploymentApiKeyResponse: - """Get the specified API Key of the given Nginx deployment. - - Get the specified API Key of the 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 api_key_name: The resource name of the API key. Required. - :type api_key_name: str - :return: NginxDeploymentApiKeyResponse or the result of cls(response) - :rtype: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse - :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.NginxDeploymentApiKeyResponse] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - api_key_name=api_key_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("NginxDeploymentApiKeyResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, deployment_name: str, **kwargs: Any - ) -> Iterable["_models.NginxDeploymentApiKeyResponse"]: - """List all API Keys of the given Nginx deployment. - - List all API Keys of the 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 NginxDeploymentApiKeyResponse or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse] - :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.NginxDeploymentApiKeyListResponse] = 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("NginxDeploymentApiKeyListResponse", 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/azure/mgmt/nginx/operations/_certificates_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_certificates_operations.py index 8caee16fcec7..e890b57bd03a 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]] @@ -43,8 +42,8 @@ _SERIALIZER.client_side_validation = False -def build_get_request( - resource_group_name: str, deployment_name: str, certificate_name: str, subscription_id: str, **kwargs: Any +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 {}) @@ -55,8 +54,8 @@ def build_get_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates", + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -68,7 +67,6 @@ 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"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -82,21 +80,20 @@ def build_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request( +def build_get_request( resource_group_name: str, deployment_name: str, certificate_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", "2024-11-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}/certificates/{certificateName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -117,27 +114,26 @@ def build_create_or_update_request( _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) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( +def build_create_or_update_request( resource_group_name: str, deployment_name: str, certificate_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", "2024-11-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}/certificates/{certificateName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -158,13 +154,15 @@ def build_delete_request( _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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - resource_group_name: str, deployment_name: str, subscription_id: str, **kwargs: Any +def build_delete_request( + resource_group_name: str, deployment_name: str, certificate_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -175,8 +173,8 @@ def build_list_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates/{certificateName}", + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -188,6 +186,7 @@ def build_list_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"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -198,7 +197,7 @@ def build_list_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) class CertificatesOperations: @@ -215,10 +214,94 @@ 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 list( + self, resource_group_name: str, deployment_name: str, **kwargs: Any + ) -> Iterable["_models.NginxCertificate"]: + """List all certificates 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 NginxCertificate or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.nginx.models.NginxCertificate] + :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.NginxCertificateListResponse] = 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("NginxCertificateListResponse", 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) @distributed_trace def get( @@ -226,8 +309,6 @@ def get( ) -> _models.NginxCertificate: """Get a certificate of given NGINX deployment. - Get a certificate 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 @@ -288,7 +369,7 @@ def _create_or_update_initial( resource_group_name: str, deployment_name: str, certificate_name: str, - body: Optional[Union[_models.NginxCertificate, IO[bytes]]] = None, + body: Union[_models.NginxCertificate, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -312,10 +393,7 @@ def _create_or_update_initial( if isinstance(body, (IOBase, bytes)): _content = body else: - if body is not None: - _json = self._serialize.body(body, "NginxCertificate") - else: - _json = None + _json = self._serialize.body(body, "NginxCertificate") _request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -348,10 +426,17 @@ def _create_or_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 == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + 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 @@ -361,15 +446,13 @@ def begin_create_or_update( resource_group_name: str, deployment_name: str, certificate_name: str, - body: Optional[_models.NginxCertificate] = None, + body: _models.NginxCertificate, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.NginxCertificate]: """Create or update the NGINX certificates for given NGINX deployment. - Create or update the NGINX certificates 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 @@ -377,7 +460,7 @@ def begin_create_or_update( :type deployment_name: str :param certificate_name: The name of certificate. Required. :type certificate_name: str - :param body: The certificate. Default value is None. + :param body: The certificate. Required. :type body: ~azure.mgmt.nginx.models.NginxCertificate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -394,15 +477,13 @@ def begin_create_or_update( resource_group_name: str, deployment_name: str, certificate_name: str, - body: Optional[IO[bytes]] = None, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.NginxCertificate]: """Create or update the NGINX certificates for given NGINX deployment. - Create or update the NGINX certificates 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 @@ -410,7 +491,7 @@ def begin_create_or_update( :type deployment_name: str :param certificate_name: The name of certificate. Required. :type certificate_name: str - :param body: The certificate. Default value is None. + :param body: The certificate. Required. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -427,13 +508,11 @@ def begin_create_or_update( resource_group_name: str, deployment_name: str, certificate_name: str, - body: Optional[Union[_models.NginxCertificate, IO[bytes]]] = None, + body: Union[_models.NginxCertificate, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.NginxCertificate]: """Create or update the NGINX certificates for given NGINX deployment. - Create or update the NGINX certificates 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 @@ -441,8 +520,7 @@ def begin_create_or_update( :type deployment_name: str :param certificate_name: The name of certificate. Required. :type certificate_name: str - :param body: The certificate. Is either a NginxCertificate type or a IO[bytes] type. Default - value is None. + :param body: The certificate. Is either a NginxCertificate type or a IO[bytes] type. Required. :type body: ~azure.mgmt.nginx.models.NginxCertificate or IO[bytes] :return: An instance of LROPoller that returns either NginxCertificate or the result of cls(response) @@ -544,10 +622,15 @@ 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["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + 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 @@ -557,8 +640,6 @@ def begin_delete( ) -> LROPoller[None]: """Deletes a certificate from the NGINX deployment. - Deletes a certificate from the NGINX deployment. - :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str @@ -597,7 +678,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -610,89 +693,3 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- 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.NginxCertificate"]: - """List all certificates of given NGINX deployment. - - List all certificates 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 NginxCertificate or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.nginx.models.NginxCertificate] - :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.NginxCertificateListResponse] = 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("NginxCertificateListResponse", 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/azure/mgmt/nginx/operations/_configurations_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_configurations_operations.py index 6c10036b327c..ddaf29c33a2f 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]] @@ -56,7 +55,7 @@ def build_list_request( _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( @@ -94,7 +93,7 @@ def build_get_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( @@ -134,7 +133,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( @@ -175,7 +174,7 @@ def build_delete_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( @@ -215,7 +214,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( @@ -227,9 +226,7 @@ def build_analysis_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", pattern=r"^[a-z][a-z0-9]*$" - ), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -259,10 +256,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( @@ -270,8 +267,6 @@ def list( ) -> Iterable["_models.NginxConfigurationResponse"]: """List the NGINX configuration of given NGINX deployment. - List the NGINX configuration 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 @@ -357,8 +352,6 @@ def get( ) -> _models.NginxConfigurationResponse: """Get the NGINX configuration of given NGINX deployment. - Get the NGINX configuration 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 @@ -420,7 +413,7 @@ def _create_or_update_initial( resource_group_name: str, deployment_name: str, configuration_name: str, - body: Optional[Union[_models.NginxConfigurationRequest, IO[bytes]]] = None, + body: Union[_models.NginxConfigurationResponse, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -444,10 +437,7 @@ def _create_or_update_initial( if isinstance(body, (IOBase, bytes)): _content = body else: - if body is not None: - _json = self._serialize.body(body, "NginxConfigurationRequest") - else: - _json = None + _json = self._serialize.body(body, "NginxConfigurationResponse") _request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -480,10 +470,17 @@ def _create_or_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 == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + 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 @@ -493,15 +490,13 @@ def begin_create_or_update( resource_group_name: str, deployment_name: str, configuration_name: str, - body: Optional[_models.NginxConfigurationRequest] = None, + body: _models.NginxConfigurationResponse, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.NginxConfigurationResponse]: """Create or update the NGINX configuration for given NGINX deployment. - Create or update the NGINX configuration 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 @@ -510,8 +505,8 @@ def begin_create_or_update( :param configuration_name: The name of configuration, only 'default' is supported value due to the singleton of NGINX conf. Required. :type configuration_name: str - :param body: The NGINX configuration. Default value is None. - :type body: ~azure.mgmt.nginx.models.NginxConfigurationRequest + :param body: The NGINX configuration. Required. + :type body: ~azure.mgmt.nginx.models.NginxConfigurationResponse :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -527,15 +522,13 @@ def begin_create_or_update( resource_group_name: str, deployment_name: str, configuration_name: str, - body: Optional[IO[bytes]] = None, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.NginxConfigurationResponse]: """Create or update the NGINX configuration for given NGINX deployment. - Create or update the NGINX configuration 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 @@ -544,7 +537,7 @@ def begin_create_or_update( :param configuration_name: The name of configuration, only 'default' is supported value due to the singleton of NGINX conf. Required. :type configuration_name: str - :param body: The NGINX configuration. Default value is None. + :param body: The NGINX configuration. Required. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -561,13 +554,11 @@ def begin_create_or_update( resource_group_name: str, deployment_name: str, configuration_name: str, - body: Optional[Union[_models.NginxConfigurationRequest, IO[bytes]]] = None, + body: Union[_models.NginxConfigurationResponse, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.NginxConfigurationResponse]: """Create or update the NGINX configuration for given NGINX deployment. - Create or update the NGINX configuration 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 @@ -576,9 +567,9 @@ def begin_create_or_update( :param configuration_name: The name of configuration, only 'default' is supported value due to the singleton of NGINX conf. Required. :type configuration_name: str - :param body: The NGINX configuration. Is either a NginxConfigurationRequest type or a IO[bytes] - type. Default value is None. - :type body: ~azure.mgmt.nginx.models.NginxConfigurationRequest or IO[bytes] + :param body: The NGINX configuration. Is either a NginxConfigurationResponse type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.nginx.models.NginxConfigurationResponse or IO[bytes] :return: An instance of LROPoller that returns either NginxConfigurationResponse or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxConfigurationResponse] @@ -679,10 +670,15 @@ 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["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + 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 @@ -692,8 +688,6 @@ def begin_delete( ) -> LROPoller[None]: """Reset the NGINX configuration of given NGINX deployment to default. - Reset the NGINX configuration 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 @@ -733,7 +727,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -760,8 +756,6 @@ def analysis( ) -> _models.AnalysisResult: """Analyze an NGINX configuration without applying it to the NGINXaaS deployment. - Analyze an NGINX configuration without applying it to the NGINXaaS deployment. - :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str @@ -793,8 +787,6 @@ def analysis( ) -> _models.AnalysisResult: """Analyze an NGINX configuration without applying it to the NGINXaaS deployment. - Analyze an NGINX configuration without applying it to the NGINXaaS deployment. - :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str @@ -824,8 +816,6 @@ def analysis( ) -> _models.AnalysisResult: """Analyze an NGINX configuration without applying it to the NGINXaaS deployment. - Analyze an NGINX configuration without applying it to the NGINXaaS deployment. - :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str 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..56c864696013 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 # 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]] @@ -43,9 +42,7 @@ _SERIALIZER.client_side_validation = False -def build_get_request( - resource_group_name: str, deployment_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +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 {}) @@ -53,21 +50,9 @@ def build_get_request( 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 + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Nginx.NginxPlus/nginxDeployments") 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 @@ -81,32 +66,23 @@ def build_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request( - resource_group_name: str, deployment_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_list_by_resource_group_request(resource_group_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", "2024-11-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}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments", + ) 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 @@ -115,28 +91,25 @@ def build_create_or_update_request( _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) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_request( +def build_get_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", "2024-11-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}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -156,27 +129,26 @@ def build_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( +def build_create_or_update_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", "2024-11-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}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -196,22 +168,39 @@ def build_delete_request( _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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_update_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", "2024-11-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}/providers/Nginx.NginxPlus/nginxDeployments") + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}", + ) 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 @@ -220,12 +209,16 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _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="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_delete_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 {}) @@ -235,13 +228,19 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}", + ) 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 @@ -252,7 +251,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) class DeploymentsOperations: @@ -269,17 +268,169 @@ 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 list(self, **kwargs: Any) -> Iterable["_models.NginxDeployment"]: + """List the NGINX deployments resources. + + :return: An iterator like instance of either NginxDeployment or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.nginx.models.NginxDeployment] + :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.NginxDeploymentListResponse] = 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( + 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("NginxDeploymentListResponse", 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) + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.NginxDeployment"]: + """List all NGINX deployments under the specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either NginxDeployment or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.nginx.models.NginxDeployment] + :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.NginxDeploymentListResponse] = 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_by_resource_group_request( + resource_group_name=resource_group_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("NginxDeploymentListResponse", 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) @distributed_trace def get(self, resource_group_name: str, deployment_name: str, **kwargs: Any) -> _models.NginxDeployment: """Get the NGINX deployment. - Get the NGINX deployment. - :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str @@ -336,7 +487,7 @@ def _create_or_update_initial( self, resource_group_name: str, deployment_name: str, - body: Optional[Union[_models.NginxDeployment, IO[bytes]]] = None, + body: Union[_models.NginxDeployment, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -360,10 +511,7 @@ def _create_or_update_initial( if isinstance(body, (IOBase, bytes)): _content = body else: - if body is not None: - _json = self._serialize.body(body, "NginxDeployment") - else: - _json = None + _json = self._serialize.body(body, "NginxDeployment") _request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -395,10 +543,17 @@ def _create_or_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 == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + 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 @@ -407,21 +562,19 @@ def begin_create_or_update( self, resource_group_name: str, deployment_name: str, - body: Optional[_models.NginxDeployment] = None, + body: _models.NginxDeployment, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.NginxDeployment]: """Create or update the NGINX deployment. - Create or update the 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 body: Default value is None. + :param body: Required. :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". @@ -437,21 +590,19 @@ def begin_create_or_update( self, resource_group_name: str, deployment_name: str, - body: Optional[IO[bytes]] = None, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.NginxDeployment]: """Create or update the NGINX deployment. - Create or update the 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 body: Default value is None. + :param body: Required. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -467,19 +618,17 @@ def begin_create_or_update( self, resource_group_name: str, deployment_name: str, - body: Optional[Union[_models.NginxDeployment, IO[bytes]]] = None, + body: Union[_models.NginxDeployment, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.NginxDeployment]: """Create or update the NGINX deployment. - Create or update the 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 body: Is either a NginxDeployment type or a IO[bytes] type. Default value is None. + :param body: Is either a NginxDeployment type or a IO[bytes] type. Required. :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) @@ -539,7 +688,7 @@ def _update_initial( self, resource_group_name: str, deployment_name: str, - body: Optional[Union[_models.NginxDeploymentUpdateParameters, IO[bytes]]] = None, + body: Union[_models.NginxDeploymentUpdateParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -563,10 +712,7 @@ def _update_initial( if isinstance(body, (IOBase, bytes)): _content = body else: - if body is not None: - _json = self._serialize.body(body, "NginxDeploymentUpdateParameters") - else: - _json = None + _json = self._serialize.body(body, "NginxDeploymentUpdateParameters") _request = build_update_request( resource_group_name=resource_group_name, @@ -598,10 +744,14 @@ 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 == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + 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 @@ -610,21 +760,19 @@ def begin_update( self, resource_group_name: str, deployment_name: str, - body: Optional[_models.NginxDeploymentUpdateParameters] = None, + body: _models.NginxDeploymentUpdateParameters, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.NginxDeployment]: """Update the NGINX deployment. - Update the 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 body: Default value is None. + :param body: Required. :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". @@ -640,21 +788,19 @@ def begin_update( self, resource_group_name: str, deployment_name: str, - body: Optional[IO[bytes]] = None, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.NginxDeployment]: """Update the NGINX deployment. - Update the 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 body: Default value is None. + :param body: Required. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -670,20 +816,17 @@ def begin_update( self, resource_group_name: str, deployment_name: str, - body: Optional[Union[_models.NginxDeploymentUpdateParameters, IO[bytes]]] = None, + body: Union[_models.NginxDeploymentUpdateParameters, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.NginxDeployment]: """Update the NGINX deployment. - Update the 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 body: Is either a NginxDeploymentUpdateParameters type or a IO[bytes] type. Default - value is None. + :param body: Is either a NginxDeploymentUpdateParameters type or a IO[bytes] type. Required. :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 +864,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": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -779,10 +924,15 @@ 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["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + 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 @@ -790,8 +940,6 @@ def _delete_initial(self, resource_group_name: str, deployment_name: str, **kwar def begin_delete(self, resource_group_name: str, deployment_name: str, **kwargs: Any) -> LROPoller[None]: """Delete the NGINX deployment resource. - Delete the NGINX deployment resource. - :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str @@ -827,7 +975,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -840,161 +990,3 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- 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, **kwargs: Any) -> Iterable["_models.NginxDeployment"]: - """List the NGINX deployments resources. - - List the NGINX deployments resources. - - :return: An iterator like instance of either NginxDeployment or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.nginx.models.NginxDeployment] - :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.NginxDeploymentListResponse] = 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( - 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("NginxDeploymentListResponse", 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) - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.NginxDeployment"]: - """List all NGINX deployments under the specified resource group. - - List all NGINX deployments under the specified resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either NginxDeployment or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.nginx.models.NginxDeployment] - :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.NginxDeploymentListResponse] = 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_by_resource_group_request( - resource_group_name=resource_group_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("NginxDeploymentListResponse", 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/azure/mgmt/nginx/operations/_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_operations.py index b7ece36d4268..ddb1335d0f47 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]] @@ -71,19 +69,17 @@ 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"]: - """List all operations provided by Nginx.NginxPlus for the 2024-11-01-preview api version. + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: + """List the operations for the provider. - 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/generated_samples/api_keys_create_or_update.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/api_keys_create_or_update.py deleted file mode 100644 index 66c898cc6ead..000000000000 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/api_keys_create_or_update.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 api_keys_create_or_update.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.api_keys.create_or_update( - resource_group_name="myResourceGroup", - deployment_name="myDeployment", - api_key_name="myApiKey", - ) - print(response) - - -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-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..30841da8ba5f 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. 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..695cebaa54ea 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. 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..bca5427ae077 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. 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 deleted file mode 100644 index dc033d4bbd8e..000000000000 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_create_or_update.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 certificates_create_or_update.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.certificates.begin_create_or_update( - resource_group_name="myResourceGroup", - deployment_name="myDeployment", - certificate_name="default", - ).result() - print(response) - - -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-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..809650ccc027 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. 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..b435a4be36ac 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. 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..653b008a0872 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. 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..d50d7d78be22 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. 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 deleted file mode 100644 index 1f487c964cd6..000000000000 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_create_or_update.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 configurations_create_or_update.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.configurations.begin_create_or_update( - resource_group_name="myResourceGroup", - deployment_name="myDeployment", - configuration_name="default", - ).result() - print(response) - - -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-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..b95b5d41fd64 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. 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..e04137fb91a9 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. 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..db59d259342c 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. diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_create.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_create.py deleted file mode 100644 index 3ddba130d6c7..000000000000 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_create.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 deployments_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.deployments.begin_create_or_update( - resource_group_name="myResourceGroup", - deployment_name="myDeployment", - ).result() - print(response) - - -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-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..bb9c221a1250 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. 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..edbc15a56235 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. 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..6b9146ca57a5 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. 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..b501eef3ac71 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. 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..7422efa8e029 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. diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_update.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_update.py deleted file mode 100644 index 34925bd37cc8..000000000000 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_update.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 deployments_update.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.deployments.begin_update( - resource_group_name="myResourceGroup", - deployment_name="myDeployment", - ).result() - print(response) - - -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-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 deleted file mode 100644 index 7b595c70ddb7..000000000000 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_update_subnet.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 deployments_update_subnet.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.deployments.begin_update( - resource_group_name="myResourceGroup", - deployment_name="myDeployment", - ).result() - print(response) - - -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-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..d1ac83b8ac2d 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. 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..cf68b96df0c7 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 @@ -20,21 +20,20 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_api_keys_create_or_update(self, resource_group): - response = self.client.api_keys.create_or_update( + def test_api_keys_list(self, resource_group): + response = self.client.api_keys.list( resource_group_name=resource_group.name, deployment_name="str", - api_key_name="str", api_version="2024-11-01-preview", ) - + result = [r for r in response] # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_api_keys_delete(self, resource_group): - response = self.client.api_keys.delete( + def test_api_keys_get(self, resource_group): + response = self.client.api_keys.get( resource_group_name=resource_group.name, deployment_name="str", api_key_name="str", @@ -46,11 +45,26 @@ def test_api_keys_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_api_keys_get(self, resource_group): - response = self.client.api_keys.get( + def test_api_keys_create_or_update(self, resource_group): + response = self.client.api_keys.create_or_update( resource_group_name=resource_group.name, deployment_name="str", api_key_name="str", + body={ + "endDateTime": "2020-02-20 00:00:00", + "hint": "str", + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, api_version="2024-11-01-preview", ) @@ -59,12 +73,13 @@ def test_api_keys_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_api_keys_list(self, resource_group): - response = self.client.api_keys.list( + def test_api_keys_delete(self, resource_group): + response = self.client.api_keys.delete( resource_group_name=resource_group.name, deployment_name="str", + api_key_name="str", api_version="2024-11-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..9c065d956f72 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 @@ -21,21 +21,20 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_api_keys_create_or_update(self, resource_group): - response = await self.client.api_keys.create_or_update( + 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_key_name="str", api_version="2024-11-01-preview", ) - + result = [r async for r in response] # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_api_keys_delete(self, resource_group): - response = await self.client.api_keys.delete( + async def test_api_keys_get(self, resource_group): + response = await self.client.api_keys.get( resource_group_name=resource_group.name, deployment_name="str", api_key_name="str", @@ -47,11 +46,26 @@ async def test_api_keys_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_api_keys_get(self, resource_group): - response = await self.client.api_keys.get( + async def test_api_keys_create_or_update(self, resource_group): + response = await self.client.api_keys.create_or_update( resource_group_name=resource_group.name, deployment_name="str", api_key_name="str", + body={ + "endDateTime": "2020-02-20 00:00:00", + "hint": "str", + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, api_version="2024-11-01-preview", ) @@ -60,12 +74,13 @@ async def test_api_keys_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_api_keys_list(self, resource_group): - response = self.client.api_keys.list( + async def test_api_keys_delete(self, resource_group): + response = await self.client.api_keys.delete( resource_group_name=resource_group.name, deployment_name="str", + api_key_name="str", api_version="2024-11-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..e8e62132cc81 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 @@ -18,6 +18,18 @@ class TestNginxManagementCertificatesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(NginxManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_certificates_get(self, resource_group): @@ -38,6 +50,28 @@ def test_certificates_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", certificate_name="str", + body={ + "certificateError": {"code": "str", "message": "str"}, + "certificateVirtualPath": "str", + "id": "str", + "keyVaultSecretCreated": "2020-02-20 00:00:00", + "keyVaultSecretId": "str", + "keyVaultSecretVersion": "str", + "keyVirtualPath": "str", + "location": "str", + "name": "str", + "provisioningState": "str", + "sha1Thumbprint": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, api_version="2024-11-01-preview", ).result() # call '.result()' to poll until service return final result @@ -56,15 +90,3 @@ def test_certificates_begin_delete(self, resource_group): # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - 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", - ) - 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..32971ffd9905 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 @@ -19,6 +19,18 @@ class TestNginxManagementCertificatesOperationsAsync(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_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", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_certificates_get(self, resource_group): @@ -40,6 +52,28 @@ async def test_certificates_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", certificate_name="str", + body={ + "certificateError": {"code": "str", "message": "str"}, + "certificateVirtualPath": "str", + "id": "str", + "keyVaultSecretCreated": "2020-02-20 00:00:00", + "keyVaultSecretId": "str", + "keyVaultSecretVersion": "str", + "keyVirtualPath": "str", + "location": "str", + "name": "str", + "provisioningState": "str", + "sha1Thumbprint": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, api_version="2024-11-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -61,15 +95,3 @@ async def test_certificates_begin_delete(self, resource_group): # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - 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", - ) - 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..02ee90237d7d 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 @@ -50,6 +50,24 @@ def test_configurations_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", configuration_name="str", + body={ + "files": [{"content": "str", "virtualPath": "str"}], + "id": "str", + "name": "str", + "package": {"data": "str", "protectedFiles": ["str"]}, + "protectedFiles": [{"contentHash": "str", "virtualPath": "str"}], + "provisioningState": "str", + "rootFile": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, api_version="2024-11-01-preview", ).result() # call '.result()' to poll until service return final result 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..319a24715934 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 @@ -52,6 +52,24 @@ async def test_configurations_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", configuration_name="str", + body={ + "files": [{"content": "str", "virtualPath": "str"}], + "id": "str", + "name": "str", + "package": {"data": "str", "protectedFiles": ["str"]}, + "protectedFiles": [{"contentHash": "str", "virtualPath": "str"}], + "provisioningState": "str", + "rootFile": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, api_version="2024-11-01-preview", ) ).result() # call '.result()' to poll until service return final result 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..a41e96cdeaaa 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 @@ -18,6 +18,27 @@ class TestNginxManagementDeploymentsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(NginxManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_deployments_list(self, resource_group): + response = self.client.deployments.list( + api_version="2024-11-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_deployments_get(self, resource_group): @@ -36,6 +57,55 @@ 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", + body={ + "location": "str", + "autoUpgradeProfile": {"upgradeChannel": "str"}, + "dataplaneApiEndpoint": "str", + "enableDiagnosticsSupport": bool, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "ipAddress": "str", + "logging": {"storageAccount": {"accountName": "str", "containerName": "str"}}, + "name": "str", + "networkProfile": { + "frontEndIPConfiguration": { + "privateIPAddresses": [ + {"privateIPAddress": "str", "privateIPAllocationMethod": "str", "subnetId": "str"} + ], + "publicIPAddresses": [{"id": "str"}], + }, + "networkInterfaceConfiguration": {"subnetId": "str"}, + }, + "nginxAppProtect": { + "webApplicationFirewallSettings": {"activationState": "str"}, + "webApplicationFirewallStatus": { + "attackSignaturesPackage": {"revisionDatetime": "2020-02-20 00:00:00", "version": "str"}, + "botSignaturesPackage": {"revisionDatetime": "2020-02-20 00:00:00", "version": "str"}, + "componentVersions": {"wafEngineVersion": "str", "wafNginxVersion": "str"}, + "threatCampaignsPackage": {"revisionDatetime": "2020-02-20 00:00:00", "version": "str"}, + }, + }, + "nginxVersion": "str", + "provisioningState": "str", + "scalingProperties": {"capacity": 0, "profiles": [{"capacity": {"max": 0, "min": 0}, "name": "str"}]}, + "sku": {"sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "userProfile": {"preferredEmail": "str"}, + }, api_version="2024-11-01-preview", ).result() # call '.result()' to poll until service return final result @@ -48,6 +118,37 @@ def test_deployments_begin_update(self, resource_group): response = self.client.deployments.begin_update( resource_group_name=resource_group.name, deployment_name="str", + body={ + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "properties": { + "autoUpgradeProfile": {"upgradeChannel": "str"}, + "enableDiagnosticsSupport": bool, + "logging": {"storageAccount": {"accountName": "str", "containerName": "str"}}, + "networkProfile": { + "frontEndIPConfiguration": { + "privateIPAddresses": [ + {"privateIPAddress": "str", "privateIPAllocationMethod": "str", "subnetId": "str"} + ], + "publicIPAddresses": [{"id": "str"}], + }, + "networkInterfaceConfiguration": {"subnetId": "str"}, + }, + "nginxAppProtect": {"webApplicationFirewallSettings": {"activationState": "str"}}, + "scalingProperties": { + "capacity": 0, + "profiles": [{"capacity": {"max": 0, "min": 0}, "name": "str"}], + }, + "userProfile": {"preferredEmail": "str"}, + }, + "sku": {"sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}}, + "tags": {"str": "str"}, + }, api_version="2024-11-01-preview", ).result() # call '.result()' to poll until service return final result @@ -65,24 +166,3 @@ def test_deployments_begin_delete(self, resource_group): # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_deployments_list(self, resource_group): - response = self.client.deployments.list( - api_version="2024-11-01-preview", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - 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", - ) - 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..472583bf5bd9 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 @@ -19,6 +19,27 @@ class TestNginxManagementDeploymentsOperationsAsync(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_deployments_list(self, resource_group): + response = self.client.deployments.list( + api_version="2024-11-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + 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", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_deployments_get(self, resource_group): @@ -38,6 +59,58 @@ 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", + body={ + "location": "str", + "autoUpgradeProfile": {"upgradeChannel": "str"}, + "dataplaneApiEndpoint": "str", + "enableDiagnosticsSupport": bool, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "ipAddress": "str", + "logging": {"storageAccount": {"accountName": "str", "containerName": "str"}}, + "name": "str", + "networkProfile": { + "frontEndIPConfiguration": { + "privateIPAddresses": [ + {"privateIPAddress": "str", "privateIPAllocationMethod": "str", "subnetId": "str"} + ], + "publicIPAddresses": [{"id": "str"}], + }, + "networkInterfaceConfiguration": {"subnetId": "str"}, + }, + "nginxAppProtect": { + "webApplicationFirewallSettings": {"activationState": "str"}, + "webApplicationFirewallStatus": { + "attackSignaturesPackage": {"revisionDatetime": "2020-02-20 00:00:00", "version": "str"}, + "botSignaturesPackage": {"revisionDatetime": "2020-02-20 00:00:00", "version": "str"}, + "componentVersions": {"wafEngineVersion": "str", "wafNginxVersion": "str"}, + "threatCampaignsPackage": {"revisionDatetime": "2020-02-20 00:00:00", "version": "str"}, + }, + }, + "nginxVersion": "str", + "provisioningState": "str", + "scalingProperties": { + "capacity": 0, + "profiles": [{"capacity": {"max": 0, "min": 0}, "name": "str"}], + }, + "sku": {"sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "userProfile": {"preferredEmail": "str"}, + }, api_version="2024-11-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -52,6 +125,37 @@ async def test_deployments_begin_update(self, resource_group): await self.client.deployments.begin_update( resource_group_name=resource_group.name, deployment_name="str", + body={ + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "properties": { + "autoUpgradeProfile": {"upgradeChannel": "str"}, + "enableDiagnosticsSupport": bool, + "logging": {"storageAccount": {"accountName": "str", "containerName": "str"}}, + "networkProfile": { + "frontEndIPConfiguration": { + "privateIPAddresses": [ + {"privateIPAddress": "str", "privateIPAllocationMethod": "str", "subnetId": "str"} + ], + "publicIPAddresses": [{"id": "str"}], + }, + "networkInterfaceConfiguration": {"subnetId": "str"}, + }, + "nginxAppProtect": {"webApplicationFirewallSettings": {"activationState": "str"}}, + "scalingProperties": { + "capacity": 0, + "profiles": [{"capacity": {"max": 0, "min": 0}, "name": "str"}], + }, + "userProfile": {"preferredEmail": "str"}, + }, + "sku": {"sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}}, + "tags": {"str": "str"}, + }, api_version="2024-11-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -72,24 +176,3 @@ async def test_deployments_begin_delete(self, resource_group): # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_deployments_list(self, resource_group): - response = self.client.deployments.list( - api_version="2024-11-01-preview", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - 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", - ) - 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", )