From b7b8aa9bcd0c18ce07c38f07eac8f9e1954698d8 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Thu, 12 Mar 2026 16:31:45 +0000 Subject: [PATCH 1/2] Configurations: 'specification/nginx/Nginx.Management/tspconfig.yaml', API Version: 2025-11-01, SDK Release Type: stable, and CommitSHA: '6f518a19a4f53c8ccb38b839c6076e3b578d795d' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6002138 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- sdk/nginx/azure-mgmt-nginx/CHANGELOG.md | 91 + sdk/nginx/azure-mgmt-nginx/_metadata.json | 16 +- .../azure-mgmt-nginx/apiview-properties.json | 256 +- .../azure/mgmt/nginx/__init__.py | 4 +- ..._nginx_management_client.py => _client.py} | 58 +- .../azure/mgmt/nginx/_configuration.py | 15 +- .../azure/mgmt/nginx/_utils/__init__.py | 2 +- .../azure/mgmt/nginx/_utils/model_base.py | 1343 +++++ .../azure/mgmt/nginx/_utils/serialization.py | 2 +- .../azure/mgmt/nginx/_validation.py | 66 + .../azure/mgmt/nginx/_version.py | 2 +- .../azure/mgmt/nginx/aio/__init__.py | 4 +- ..._nginx_management_client.py => _client.py} | 58 +- .../azure/mgmt/nginx/aio/_configuration.py | 15 +- .../mgmt/nginx/aio/operations/__init__.py | 22 +- .../aio/operations/_api_keys_operations.py | 427 -- .../operations/_certificates_operations.py | 560 --- .../operations/_configurations_operations.py | 719 --- .../_default_waf_policy_operations.py | 114 - .../aio/operations/_deployments_operations.py | 825 ---- .../mgmt/nginx/aio/operations/_operations.py | 3647 +++++++++++++- .../aio/operations/_waf_policy_operations.py | 563 --- .../azure/mgmt/nginx/models/__init__.py | 38 +- ...x_management_client_enums.py => _enums.py} | 39 +- .../azure/mgmt/nginx/models/_models.py | 2705 ++++++++++ .../azure/mgmt/nginx/models/_models_py3.py | 2694 ---------- .../azure/mgmt/nginx/operations/__init__.py | 22 +- .../nginx/operations/_api_keys_operations.py | 589 --- .../operations/_certificates_operations.py | 729 --- .../operations/_configurations_operations.py | 921 ---- .../_default_waf_policy_operations.py | 155 - .../operations/_deployments_operations.py | 1026 ---- .../mgmt/nginx/operations/_operations.py | 4331 ++++++++++++++++- .../operations/_waf_policy_operations.py | 731 --- .../api_keys_create_or_update.py | 7 +- .../generated_samples/api_keys_delete.py | 7 +- .../generated_samples/api_keys_get.py | 7 +- .../generated_samples/api_keys_list.py | 7 +- .../certificates_create_or_update.py | 7 +- .../generated_samples/certificates_delete.py | 7 +- .../generated_samples/certificates_get.py | 7 +- .../generated_samples/certificates_list.py | 7 +- .../configurations_analysis.py | 7 +- .../configurations_create_or_update.py | 7 +- .../configurations_delete.py | 7 +- .../generated_samples/configurations_get.py | 7 +- .../generated_samples/configurations_list.py | 7 +- .../default_waf_policy_list.py | 7 +- .../generated_samples/deployments_create.py | 7 +- .../generated_samples/deployments_delete.py | 7 +- .../generated_samples/deployments_get.py | 7 +- .../deployments_get_auto_scale.py | 7 +- .../generated_samples/deployments_list.py | 7 +- .../deployments_list_by_resource_group.py | 7 +- .../generated_samples/deployments_update.py | 7 +- .../deployments_update_subnet.py | 7 +- .../nginx_deployment_waf_policies_analysis.py | 43 + .../generated_samples/operations_list.py | 5 +- .../generated_samples/waf_policy_create.py | 7 +- .../generated_samples/waf_policy_delete.py | 7 +- .../generated_samples/waf_policy_get.py | 7 +- .../generated_samples/waf_policy_list.py | 7 +- .../generated_tests/conftest.py | 2 +- ...st_nginx_management_api_keys_operations.py | 28 +- ...nx_management_api_keys_operations_async.py | 28 +- ...ginx_management_certificates_operations.py | 28 +- ...anagement_certificates_operations_async.py | 28 +- ...nx_management_configurations_operations.py | 29 +- ...agement_configurations_operations_async.py | 29 +- ...anagement_default_waf_policy_operations.py | 3 +- ...ent_default_waf_policy_operations_async.py | 3 +- ...nginx_management_deployments_operations.py | 45 +- ...management_deployments_operations_async.py | 45 +- ...ginx_deployment_waf_policies_operations.py | 31 + ...eployment_waf_policies_operations_async.py | 32 + .../test_nginx_management_operations.py | 6 +- .../test_nginx_management_operations_async.py | 6 +- ..._nginx_management_waf_policy_operations.py | 6 +- ..._management_waf_policy_operations_async.py | 6 +- sdk/nginx/azure-mgmt-nginx/pyproject.toml | 4 +- sdk/nginx/azure-mgmt-nginx/tsp-location.yaml | 4 + 81 files changed, 12765 insertions(+), 10617 deletions(-) rename sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/{_nginx_management_client.py => _client.py} (82%) create mode 100644 sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_utils/model_base.py create mode 100644 sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_validation.py rename sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/{_nginx_management_client.py => _client.py} (83%) delete mode 100644 sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_api_keys_operations.py delete mode 100644 sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_certificates_operations.py delete mode 100644 sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_configurations_operations.py delete mode 100644 sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_default_waf_policy_operations.py delete mode 100644 sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_deployments_operations.py delete mode 100644 sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_waf_policy_operations.py rename sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/{_nginx_management_client_enums.py => _enums.py} (74%) create mode 100644 sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/_models.py delete mode 100644 sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/_models_py3.py delete mode 100644 sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_api_keys_operations.py delete mode 100644 sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_certificates_operations.py delete mode 100644 sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_configurations_operations.py delete mode 100644 sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_default_waf_policy_operations.py delete mode 100644 sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_deployments_operations.py delete mode 100644 sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_waf_policy_operations.py create mode 100644 sdk/nginx/azure-mgmt-nginx/generated_samples/nginx_deployment_waf_policies_analysis.py create mode 100644 sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_nginx_deployment_waf_policies_operations.py create mode 100644 sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_nginx_deployment_waf_policies_operations_async.py create mode 100644 sdk/nginx/azure-mgmt-nginx/tsp-location.yaml diff --git a/sdk/nginx/azure-mgmt-nginx/CHANGELOG.md b/sdk/nginx/azure-mgmt-nginx/CHANGELOG.md index c8dac323d50e..a343a7f8a0da 100644 --- a/sdk/nginx/azure-mgmt-nginx/CHANGELOG.md +++ b/sdk/nginx/azure-mgmt-nginx/CHANGELOG.md @@ -1,5 +1,96 @@ # Release History +## 4.0.0 (2026-03-12) + +### Features Added + + - Model `NginxManagementClient` added parameter `cloud_setting` in method `__init__` + - Client `NginxManagementClient` added method `send_request` + - Client `NginxManagementClient` added operation group `nginx_deployment_waf_policies` + - Client `NginxManagementClient` added operation group `api_keys` + - Client `NginxManagementClient` added operation group `waf_policy` + - Client `NginxManagementClient` added operation group `default_waf_policy` + - Model `NginxCertificateProperties` added property `sha1_thumbprint` + - Model `NginxCertificateProperties` added property `key_vault_secret_version` + - Model `NginxCertificateProperties` added property `key_vault_secret_created` + - Model `NginxCertificateProperties` added property `certificate_error` + - Model `NginxDeploymentProperties` added property `auto_upgrade_profile` + - Model `NginxDeploymentProperties` added property `nginx_app_protect` + - Model `NginxDeploymentProperties` added property `dataplane_api_endpoint` + - Model `NginxDeploymentScalingProperties` added property `auto_scale_settings` + - Model `NginxDeploymentUpdateProperties` added property `network_profile` + - Model `NginxDeploymentUpdateProperties` added property `auto_upgrade_profile` + - Model `NginxDeploymentUpdateProperties` added property `nginx_app_protect` + - Added enum `ActionType` + - Added enum `ActivationState` + - Added model `AnalysisCreate` + - Added model `AnalysisCreateConfig` + - Added model `AnalysisDiagnostic` + - Added model `AnalysisResult` + - Added model `AnalysisResultData` + - Added model `AutoUpgradeProfile` + - Added model `DiagnosticItem` + - Added model `ErrorAdditionalInfo` + - Added model `ErrorDetail` + - Added model `ErrorResponse` + - Added enum `Level` + - Added model `NginxCertificateErrorResponseBody` + - Added model `NginxConfigurationProtectedFileRequest` + - Added model `NginxConfigurationProtectedFileResponse` + - Added model `NginxConfigurationRequest` + - Added model `NginxConfigurationRequestProperties` + - Added model `NginxConfigurationResponse` + - Added model `NginxConfigurationResponseProperties` + - Added model `NginxDeploymentApiKeyRequest` + - Added model `NginxDeploymentApiKeyRequestProperties` + - Added model `NginxDeploymentApiKeyResponse` + - Added model `NginxDeploymentApiKeyResponseProperties` + - Added model `NginxDeploymentDefaultWafPolicyListResponse` + - Added model `NginxDeploymentDefaultWafPolicyProperties` + - Added model `NginxDeploymentPropertiesNginxAppProtect` + - Added model `NginxDeploymentScalingPropertiesAutoScaleSettings` + - Added model `NginxDeploymentUpdatePropertiesNginxAppProtect` + - Added model `NginxDeploymentWafPolicy` + - Added model `NginxDeploymentWafPolicyAnalysisCreateRequest` + - Added model `NginxDeploymentWafPolicyAnalysisData` + - Added model `NginxDeploymentWafPolicyAnalysisResponse` + - Added model `NginxDeploymentWafPolicyApplyingStatus` + - Added enum `NginxDeploymentWafPolicyApplyingStatusCode` + - Added model `NginxDeploymentWafPolicyCompilingStatus` + - Added enum `NginxDeploymentWafPolicyCompilingStatusCode` + - Added model `NginxDeploymentWafPolicyError` + - Added model `NginxDeploymentWafPolicyMetadata` + - Added model `NginxDeploymentWafPolicyMetadataProperties` + - Added model `NginxDeploymentWafPolicyProperties` + - Added model `Operation` + - Added enum `Origin` + - Added model `ProxyResource` + - Added model `Resource` + - Added model `ScaleProfile` + - Added model `ScaleProfileCapacity` + - Added model `TrackedResource` + - Added model `WebApplicationFirewallComponentVersions` + - Added model `WebApplicationFirewallPackage` + - Added model `WebApplicationFirewallSettings` + - Added model `WebApplicationFirewallStatus` + - Model `ConfigurationsOperations` added method `analysis` + - Added model `ApiKeysOperations` + - Added model `DefaultWafPolicyOperations` + - Added model `NginxDeploymentWafPoliciesOperations` + - Added model `WafPolicyOperations` + +### Breaking Changes + + - Model `NginxDeploymentProperties` deleted or renamed its instance variable `managed_resource_group` + - Deleted or renamed model `ErrorResponseBody` + - Deleted or renamed model `NginxCertificateListResponse` + - Deleted or renamed model `NginxConfiguration` + - Deleted or renamed model `NginxConfigurationListResponse` + - Deleted or renamed model `NginxConfigurationProperties` + - Deleted or renamed model `NginxDeploymentListResponse` + - Deleted or renamed model `OperationResult` + - Deleted or renamed model `ResourceProviderDefaultErrorResponse` + ## 3.1.0b3 (2026-02-10) ### Features Added diff --git a/sdk/nginx/azure-mgmt-nginx/_metadata.json b/sdk/nginx/azure-mgmt-nginx/_metadata.json index b43e5a0d2db4..e3915c03ff0b 100644 --- a/sdk/nginx/azure-mgmt-nginx/_metadata.json +++ b/sdk/nginx/azure-mgmt-nginx/_metadata.json @@ -1,14 +1,10 @@ { - "apiVersion": "2025-03-01-preview", - "commit": "d8f039ebd965e40471a082c547b103dd5dc9a33b", + "apiVersion": "2025-11-01", + "apiVersions": { + "Nginx.NginxPlus": "2025-11-01" + }, + "commit": "6f518a19a4f53c8ccb38b839c6076e3b578d795d", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "typespec_src": "specification/nginx/Nginx.Management", - "emitterVersion": "0.52.1", - "autorest": "3.10.2", - "use": [ - "@autorest/python@6.48.0", - "@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 --package-mode=azure-mgmt --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.48.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", - "readme": "specification/nginx/resource-manager/readme.md" + "emitterVersion": "0.60.2" } \ No newline at end of file diff --git a/sdk/nginx/azure-mgmt-nginx/apiview-properties.json b/sdk/nginx/azure-mgmt-nginx/apiview-properties.json index 655e384bc9b2..b4468ad75df8 100644 --- a/sdk/nginx/azure-mgmt-nginx/apiview-properties.json +++ b/sdk/nginx/azure-mgmt-nginx/apiview-properties.json @@ -1,129 +1,135 @@ { - "CrossLanguagePackageId": null, + "CrossLanguagePackageId": "Nginx.NginxPlus", "CrossLanguageDefinitionId": { - "azure.mgmt.nginx.models.AnalysisCreate": null, - "azure.mgmt.nginx.models.AnalysisDiagnostic": null, - "azure.mgmt.nginx.models.AnalysisResult": null, - "azure.mgmt.nginx.models.AutoUpgradeProfile": null, - "azure.mgmt.nginx.models.DiagnosticItem": null, - "azure.mgmt.nginx.models.ErrorAdditionalInfo": null, - "azure.mgmt.nginx.models.ErrorDetail": null, - "azure.mgmt.nginx.models.ErrorResponse": null, - "azure.mgmt.nginx.models.IdentityProperties": null, - "azure.mgmt.nginx.models.Resource": null, - "azure.mgmt.nginx.models.ProxyResource": null, - "azure.mgmt.nginx.models.NginxCertificate": null, - "azure.mgmt.nginx.models.NginxCertificateErrorResponseBody": null, - "azure.mgmt.nginx.models.NginxCertificateListResponse": null, - "azure.mgmt.nginx.models.NginxCertificateProperties": null, - "azure.mgmt.nginx.models.NginxConfigurationFile": null, - "azure.mgmt.nginx.models.NginxConfigurationListResponse": null, - "azure.mgmt.nginx.models.NginxConfigurationPackage": null, - "azure.mgmt.nginx.models.NginxConfigurationProtectedFileRequest": null, - "azure.mgmt.nginx.models.NginxConfigurationProtectedFileResponse": null, - "azure.mgmt.nginx.models.NginxConfigurationRequest": null, - "azure.mgmt.nginx.models.NginxConfigurationRequestProperties": null, - "azure.mgmt.nginx.models.NginxConfigurationResponse": null, - "azure.mgmt.nginx.models.NginxConfigurationResponseProperties": null, - "azure.mgmt.nginx.models.TrackedResource": null, - "azure.mgmt.nginx.models.NginxDeployment": null, - "azure.mgmt.nginx.models.NginxDeploymentApiKeyListResponse": null, - "azure.mgmt.nginx.models.NginxDeploymentApiKeyRequest": null, - "azure.mgmt.nginx.models.NginxDeploymentApiKeyRequestProperties": null, - "azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse": null, - "azure.mgmt.nginx.models.NginxDeploymentApiKeyResponseProperties": null, - "azure.mgmt.nginx.models.NginxDeploymentDefaultWafPolicyListResponse": null, - "azure.mgmt.nginx.models.NginxDeploymentDefaultWafPolicyProperties": null, - "azure.mgmt.nginx.models.NginxDeploymentListResponse": null, - "azure.mgmt.nginx.models.NginxDeploymentProperties": null, - "azure.mgmt.nginx.models.NginxDeploymentScalingProperties": null, - "azure.mgmt.nginx.models.NginxDeploymentUpdateParameters": null, - "azure.mgmt.nginx.models.NginxDeploymentUpdateProperties": null, - "azure.mgmt.nginx.models.NginxDeploymentUserProfile": null, - "azure.mgmt.nginx.models.NginxDeploymentWafPolicy": null, - "azure.mgmt.nginx.models.NginxDeploymentWafPolicyApplyingStatus": null, - "azure.mgmt.nginx.models.NginxDeploymentWafPolicyCompilingStatus": null, - "azure.mgmt.nginx.models.NginxDeploymentWafPolicyListResponse": null, - "azure.mgmt.nginx.models.NginxDeploymentWafPolicyMetadata": null, - "azure.mgmt.nginx.models.NginxDeploymentWafPolicyMetadataProperties": null, - "azure.mgmt.nginx.models.NginxDeploymentWafPolicyProperties": null, - "azure.mgmt.nginx.models.NginxFrontendIPConfiguration": null, - "azure.mgmt.nginx.models.NginxLogging": null, - "azure.mgmt.nginx.models.NginxNetworkInterfaceConfiguration": null, - "azure.mgmt.nginx.models.NginxNetworkProfile": null, - "azure.mgmt.nginx.models.NginxPrivateIPAddress": null, - "azure.mgmt.nginx.models.NginxPublicIPAddress": null, - "azure.mgmt.nginx.models.NginxStorageAccount": null, - "azure.mgmt.nginx.models.Operation": null, - "azure.mgmt.nginx.models.OperationDisplay": null, - "azure.mgmt.nginx.models.OperationListResult": null, - "azure.mgmt.nginx.models.ResourceSku": null, - "azure.mgmt.nginx.models.ScaleProfile": null, - "azure.mgmt.nginx.models.SystemData": null, - "azure.mgmt.nginx.models.UserIdentityProperties": null, - "azure.mgmt.nginx.models.WebApplicationFirewallComponentVersions": null, - "azure.mgmt.nginx.models.WebApplicationFirewallPackage": null, - "azure.mgmt.nginx.models.WebApplicationFirewallSettings": null, - "azure.mgmt.nginx.models.WebApplicationFirewallStatus": null, - "azure.mgmt.nginx.models.Origin": null, - "azure.mgmt.nginx.models.ActionType": null, - "azure.mgmt.nginx.models.NginxPrivateIPAllocationMethod": null, - "azure.mgmt.nginx.models.CreatedByType": null, - "azure.mgmt.nginx.models.ProvisioningState": null, - "azure.mgmt.nginx.models.ActivationState": null, - "azure.mgmt.nginx.models.IdentityType": null, - "azure.mgmt.nginx.models.Level": null, - "azure.mgmt.nginx.models.NginxDeploymentWafPolicyCompilingStatusCode": null, - "azure.mgmt.nginx.models.NginxDeploymentWafPolicyApplyingStatusCode": null, - "azure.mgmt.nginx.operations.Operations.list": null, - "azure.mgmt.nginx.aio.operations.Operations.list": null, - "azure.mgmt.nginx.operations.DeploymentsOperations.list": null, - "azure.mgmt.nginx.aio.operations.DeploymentsOperations.list": null, - "azure.mgmt.nginx.operations.DeploymentsOperations.list_by_resource_group": null, - "azure.mgmt.nginx.aio.operations.DeploymentsOperations.list_by_resource_group": null, - "azure.mgmt.nginx.operations.DeploymentsOperations.get": null, - "azure.mgmt.nginx.aio.operations.DeploymentsOperations.get": null, - "azure.mgmt.nginx.operations.DeploymentsOperations.begin_create_or_update": null, - "azure.mgmt.nginx.aio.operations.DeploymentsOperations.begin_create_or_update": null, - "azure.mgmt.nginx.operations.DeploymentsOperations.begin_update": null, - "azure.mgmt.nginx.aio.operations.DeploymentsOperations.begin_update": null, - "azure.mgmt.nginx.operations.DeploymentsOperations.begin_delete": null, - "azure.mgmt.nginx.aio.operations.DeploymentsOperations.begin_delete": null, - "azure.mgmt.nginx.operations.ApiKeysOperations.list": null, - "azure.mgmt.nginx.aio.operations.ApiKeysOperations.list": null, - "azure.mgmt.nginx.operations.ApiKeysOperations.get": null, - "azure.mgmt.nginx.aio.operations.ApiKeysOperations.get": null, - "azure.mgmt.nginx.operations.ApiKeysOperations.create_or_update": null, - "azure.mgmt.nginx.aio.operations.ApiKeysOperations.create_or_update": null, - "azure.mgmt.nginx.operations.ApiKeysOperations.delete": null, - "azure.mgmt.nginx.aio.operations.ApiKeysOperations.delete": null, - "azure.mgmt.nginx.operations.CertificatesOperations.list": null, - "azure.mgmt.nginx.aio.operations.CertificatesOperations.list": null, - "azure.mgmt.nginx.operations.CertificatesOperations.get": null, - "azure.mgmt.nginx.aio.operations.CertificatesOperations.get": null, - "azure.mgmt.nginx.operations.CertificatesOperations.begin_create_or_update": null, - "azure.mgmt.nginx.aio.operations.CertificatesOperations.begin_create_or_update": null, - "azure.mgmt.nginx.operations.CertificatesOperations.begin_delete": null, - "azure.mgmt.nginx.aio.operations.CertificatesOperations.begin_delete": null, - "azure.mgmt.nginx.operations.ConfigurationsOperations.list": null, - "azure.mgmt.nginx.aio.operations.ConfigurationsOperations.list": null, - "azure.mgmt.nginx.operations.ConfigurationsOperations.get": null, - "azure.mgmt.nginx.aio.operations.ConfigurationsOperations.get": null, - "azure.mgmt.nginx.operations.ConfigurationsOperations.begin_create_or_update": null, - "azure.mgmt.nginx.aio.operations.ConfigurationsOperations.begin_create_or_update": null, - "azure.mgmt.nginx.operations.ConfigurationsOperations.begin_delete": null, - "azure.mgmt.nginx.aio.operations.ConfigurationsOperations.begin_delete": null, - "azure.mgmt.nginx.operations.ConfigurationsOperations.analysis": null, - "azure.mgmt.nginx.aio.operations.ConfigurationsOperations.analysis": null, - "azure.mgmt.nginx.operations.DefaultWafPolicyOperations.list": null, - "azure.mgmt.nginx.aio.operations.DefaultWafPolicyOperations.list": null, - "azure.mgmt.nginx.operations.WafPolicyOperations.list": null, - "azure.mgmt.nginx.aio.operations.WafPolicyOperations.list": null, - "azure.mgmt.nginx.operations.WafPolicyOperations.get": null, - "azure.mgmt.nginx.aio.operations.WafPolicyOperations.get": null, - "azure.mgmt.nginx.operations.WafPolicyOperations.begin_create": null, - "azure.mgmt.nginx.aio.operations.WafPolicyOperations.begin_create": null, - "azure.mgmt.nginx.operations.WafPolicyOperations.begin_delete": null, - "azure.mgmt.nginx.aio.operations.WafPolicyOperations.begin_delete": null + "azure.mgmt.nginx.models.AnalysisCreate": "Nginx.NginxPlus.AnalysisCreate", + "azure.mgmt.nginx.models.AnalysisCreateConfig": "Nginx.NginxPlus.AnalysisCreateConfig", + "azure.mgmt.nginx.models.AnalysisDiagnostic": "Nginx.NginxPlus.AnalysisDiagnostic", + "azure.mgmt.nginx.models.AnalysisResult": "Nginx.NginxPlus.AnalysisResult", + "azure.mgmt.nginx.models.AnalysisResultData": "Nginx.NginxPlus.AnalysisResultData", + "azure.mgmt.nginx.models.AutoUpgradeProfile": "Nginx.NginxPlus.AutoUpgradeProfile", + "azure.mgmt.nginx.models.DiagnosticItem": "Nginx.NginxPlus.DiagnosticItem", + "azure.mgmt.nginx.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "azure.mgmt.nginx.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "azure.mgmt.nginx.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "azure.mgmt.nginx.models.IdentityProperties": "Nginx.NginxPlus.IdentityProperties", + "azure.mgmt.nginx.models.Resource": "Azure.ResourceManager.CommonTypes.Resource", + "azure.mgmt.nginx.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource", + "azure.mgmt.nginx.models.NginxCertificate": "Nginx.NginxPlus.NginxCertificate", + "azure.mgmt.nginx.models.NginxCertificateErrorResponseBody": "Nginx.NginxPlus.NginxCertificateErrorResponseBody", + "azure.mgmt.nginx.models.NginxCertificateProperties": "Nginx.NginxPlus.NginxCertificateProperties", + "azure.mgmt.nginx.models.NginxConfigurationFile": "Nginx.NginxPlus.NginxConfigurationFile", + "azure.mgmt.nginx.models.NginxConfigurationPackage": "Nginx.NginxPlus.NginxConfigurationPackage", + "azure.mgmt.nginx.models.NginxConfigurationProtectedFileRequest": "Nginx.NginxPlus.NginxConfigurationProtectedFileRequest", + "azure.mgmt.nginx.models.NginxConfigurationProtectedFileResponse": "Nginx.NginxPlus.NginxConfigurationProtectedFileResponse", + "azure.mgmt.nginx.models.NginxConfigurationRequest": "Nginx.NginxPlus.NginxConfigurationRequest", + "azure.mgmt.nginx.models.NginxConfigurationRequestProperties": "Nginx.NginxPlus.NginxConfigurationRequestProperties", + "azure.mgmt.nginx.models.NginxConfigurationResponse": "Nginx.NginxPlus.NginxConfigurationResponse", + "azure.mgmt.nginx.models.NginxConfigurationResponseProperties": "Nginx.NginxPlus.NginxConfigurationResponseProperties", + "azure.mgmt.nginx.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource", + "azure.mgmt.nginx.models.NginxDeployment": "Nginx.NginxPlus.NginxDeployment", + "azure.mgmt.nginx.models.NginxDeploymentApiKeyRequest": "Nginx.NginxPlus.NginxDeploymentApiKeyRequest", + "azure.mgmt.nginx.models.NginxDeploymentApiKeyRequestProperties": "Nginx.NginxPlus.NginxDeploymentApiKeyRequestProperties", + "azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse": "Nginx.NginxPlus.NginxDeploymentApiKeyResponse", + "azure.mgmt.nginx.models.NginxDeploymentApiKeyResponseProperties": "Nginx.NginxPlus.NginxDeploymentApiKeyResponseProperties", + "azure.mgmt.nginx.models.NginxDeploymentDefaultWafPolicyListResponse": "Nginx.NginxPlus.NginxDeploymentDefaultWafPolicyListResponse", + "azure.mgmt.nginx.models.NginxDeploymentDefaultWafPolicyProperties": "Nginx.NginxPlus.NginxDeploymentDefaultWafPolicyProperties", + "azure.mgmt.nginx.models.NginxDeploymentProperties": "Nginx.NginxPlus.NginxDeploymentProperties", + "azure.mgmt.nginx.models.NginxDeploymentPropertiesNginxAppProtect": "Nginx.NginxPlus.NginxDeploymentPropertiesNginxAppProtect", + "azure.mgmt.nginx.models.NginxDeploymentScalingProperties": "Nginx.NginxPlus.NginxDeploymentScalingProperties", + "azure.mgmt.nginx.models.NginxDeploymentScalingPropertiesAutoScaleSettings": "Nginx.NginxPlus.NginxDeploymentScalingPropertiesAutoScaleSettings", + "azure.mgmt.nginx.models.NginxDeploymentUpdateParameters": "Nginx.NginxPlus.NginxDeploymentUpdateParameters", + "azure.mgmt.nginx.models.NginxDeploymentUpdateProperties": "Nginx.NginxPlus.NginxDeploymentUpdateProperties", + "azure.mgmt.nginx.models.NginxDeploymentUpdatePropertiesNginxAppProtect": "Nginx.NginxPlus.NginxDeploymentUpdatePropertiesNginxAppProtect", + "azure.mgmt.nginx.models.NginxDeploymentUserProfile": "Nginx.NginxPlus.NginxDeploymentUserProfile", + "azure.mgmt.nginx.models.NginxDeploymentWafPolicy": "Nginx.NginxPlus.NginxDeploymentWafPolicy", + "azure.mgmt.nginx.models.NginxDeploymentWafPolicyAnalysisCreateRequest": "Nginx.NginxPlus.NginxDeploymentWafPolicyAnalysisCreateRequest", + "azure.mgmt.nginx.models.NginxDeploymentWafPolicyAnalysisData": "Nginx.NginxPlus.NginxDeploymentWafPolicyAnalysisData", + "azure.mgmt.nginx.models.NginxDeploymentWafPolicyAnalysisResponse": "Nginx.NginxPlus.NginxDeploymentWafPolicyAnalysisResponse", + "azure.mgmt.nginx.models.NginxDeploymentWafPolicyApplyingStatus": "Nginx.NginxPlus.NginxDeploymentWafPolicyApplyingStatus", + "azure.mgmt.nginx.models.NginxDeploymentWafPolicyCompilingStatus": "Nginx.NginxPlus.NginxDeploymentWafPolicyCompilingStatus", + "azure.mgmt.nginx.models.NginxDeploymentWafPolicyError": "Nginx.NginxPlus.NginxDeploymentWafPolicyError", + "azure.mgmt.nginx.models.NginxDeploymentWafPolicyMetadata": "Nginx.NginxPlus.NginxDeploymentWafPolicyMetadata", + "azure.mgmt.nginx.models.NginxDeploymentWafPolicyMetadataProperties": "Nginx.NginxPlus.NginxDeploymentWafPolicyMetadataProperties", + "azure.mgmt.nginx.models.NginxDeploymentWafPolicyProperties": "Nginx.NginxPlus.NginxDeploymentWafPolicyProperties", + "azure.mgmt.nginx.models.NginxFrontendIPConfiguration": "Nginx.NginxPlus.NginxFrontendIPConfiguration", + "azure.mgmt.nginx.models.NginxLogging": "Nginx.NginxPlus.NginxLogging", + "azure.mgmt.nginx.models.NginxNetworkInterfaceConfiguration": "Nginx.NginxPlus.NginxNetworkInterfaceConfiguration", + "azure.mgmt.nginx.models.NginxNetworkProfile": "Nginx.NginxPlus.NginxNetworkProfile", + "azure.mgmt.nginx.models.NginxPrivateIPAddress": "Nginx.NginxPlus.NginxPrivateIPAddress", + "azure.mgmt.nginx.models.NginxPublicIPAddress": "Nginx.NginxPlus.NginxPublicIPAddress", + "azure.mgmt.nginx.models.NginxStorageAccount": "Nginx.NginxPlus.NginxStorageAccount", + "azure.mgmt.nginx.models.Operation": "Azure.ResourceManager.CommonTypes.Operation", + "azure.mgmt.nginx.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "azure.mgmt.nginx.models.ResourceSku": "Nginx.NginxPlus.ResourceSku", + "azure.mgmt.nginx.models.ScaleProfile": "Nginx.NginxPlus.ScaleProfile", + "azure.mgmt.nginx.models.ScaleProfileCapacity": "Nginx.NginxPlus.ScaleProfileCapacity", + "azure.mgmt.nginx.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData", + "azure.mgmt.nginx.models.UserIdentityProperties": "Nginx.NginxPlus.UserIdentityProperties", + "azure.mgmt.nginx.models.WebApplicationFirewallComponentVersions": "Nginx.NginxPlus.WebApplicationFirewallComponentVersions", + "azure.mgmt.nginx.models.WebApplicationFirewallPackage": "Nginx.NginxPlus.WebApplicationFirewallPackage", + "azure.mgmt.nginx.models.WebApplicationFirewallSettings": "Nginx.NginxPlus.WebApplicationFirewallSettings", + "azure.mgmt.nginx.models.WebApplicationFirewallStatus": "Nginx.NginxPlus.WebApplicationFirewallStatus", + "azure.mgmt.nginx.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", + "azure.mgmt.nginx.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", + "azure.mgmt.nginx.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", + "azure.mgmt.nginx.models.ProvisioningState": "Nginx.NginxPlus.ProvisioningState", + "azure.mgmt.nginx.models.NginxPrivateIPAllocationMethod": "Nginx.NginxPlus.NginxPrivateIPAllocationMethod", + "azure.mgmt.nginx.models.ActivationState": "Nginx.NginxPlus.ActivationState", + "azure.mgmt.nginx.models.IdentityType": "Nginx.NginxPlus.IdentityType", + "azure.mgmt.nginx.models.NginxDeploymentWafPolicyCompilingStatusCode": "Nginx.NginxPlus.NginxDeploymentWafPolicyCompilingStatusCode", + "azure.mgmt.nginx.models.NginxDeploymentWafPolicyApplyingStatusCode": "Nginx.NginxPlus.NginxDeploymentWafPolicyApplyingStatusCode", + "azure.mgmt.nginx.models.Level": "Nginx.NginxPlus.Level", + "azure.mgmt.nginx.operations.Operations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.nginx.aio.operations.Operations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.nginx.operations.NginxDeploymentWafPoliciesOperations.analysis": "Nginx.NginxPlus.NginxDeploymentWafPolicies.analysis", + "azure.mgmt.nginx.aio.operations.NginxDeploymentWafPoliciesOperations.analysis": "Nginx.NginxPlus.NginxDeploymentWafPolicies.analysis", + "azure.mgmt.nginx.operations.ApiKeysOperations.get": "Nginx.NginxPlus.NginxDeploymentApiKeyResponses.get", + "azure.mgmt.nginx.aio.operations.ApiKeysOperations.get": "Nginx.NginxPlus.NginxDeploymentApiKeyResponses.get", + "azure.mgmt.nginx.operations.ApiKeysOperations.create_or_update": "Nginx.NginxPlus.NginxDeploymentApiKeyResponses.createOrUpdate", + "azure.mgmt.nginx.aio.operations.ApiKeysOperations.create_or_update": "Nginx.NginxPlus.NginxDeploymentApiKeyResponses.createOrUpdate", + "azure.mgmt.nginx.operations.ApiKeysOperations.delete": "Nginx.NginxPlus.NginxDeploymentApiKeyResponses.delete", + "azure.mgmt.nginx.aio.operations.ApiKeysOperations.delete": "Nginx.NginxPlus.NginxDeploymentApiKeyResponses.delete", + "azure.mgmt.nginx.operations.ApiKeysOperations.list": "Nginx.NginxPlus.NginxDeploymentApiKeyResponses.list", + "azure.mgmt.nginx.aio.operations.ApiKeysOperations.list": "Nginx.NginxPlus.NginxDeploymentApiKeyResponses.list", + "azure.mgmt.nginx.operations.DeploymentsOperations.get": "Nginx.NginxPlus.NginxDeployments.get", + "azure.mgmt.nginx.aio.operations.DeploymentsOperations.get": "Nginx.NginxPlus.NginxDeployments.get", + "azure.mgmt.nginx.operations.DeploymentsOperations.begin_create_or_update": "Nginx.NginxPlus.NginxDeployments.createOrUpdate", + "azure.mgmt.nginx.aio.operations.DeploymentsOperations.begin_create_or_update": "Nginx.NginxPlus.NginxDeployments.createOrUpdate", + "azure.mgmt.nginx.operations.DeploymentsOperations.begin_update": "Nginx.NginxPlus.NginxDeployments.update", + "azure.mgmt.nginx.aio.operations.DeploymentsOperations.begin_update": "Nginx.NginxPlus.NginxDeployments.update", + "azure.mgmt.nginx.operations.DeploymentsOperations.begin_delete": "Nginx.NginxPlus.NginxDeployments.delete", + "azure.mgmt.nginx.aio.operations.DeploymentsOperations.begin_delete": "Nginx.NginxPlus.NginxDeployments.delete", + "azure.mgmt.nginx.operations.DeploymentsOperations.list_by_resource_group": "Nginx.NginxPlus.NginxDeployments.listByResourceGroup", + "azure.mgmt.nginx.aio.operations.DeploymentsOperations.list_by_resource_group": "Nginx.NginxPlus.NginxDeployments.listByResourceGroup", + "azure.mgmt.nginx.operations.DeploymentsOperations.list": "Nginx.NginxPlus.NginxDeployments.list", + "azure.mgmt.nginx.aio.operations.DeploymentsOperations.list": "Nginx.NginxPlus.NginxDeployments.list", + "azure.mgmt.nginx.operations.WafPolicyOperations.list": "Nginx.NginxPlus.NginxDeployments.wafPolicyList", + "azure.mgmt.nginx.aio.operations.WafPolicyOperations.list": "Nginx.NginxPlus.NginxDeployments.wafPolicyList", + "azure.mgmt.nginx.operations.WafPolicyOperations.get": "Nginx.NginxPlus.NginxDeploymentWafPolicies.get", + "azure.mgmt.nginx.aio.operations.WafPolicyOperations.get": "Nginx.NginxPlus.NginxDeploymentWafPolicies.get", + "azure.mgmt.nginx.operations.WafPolicyOperations.begin_create": "Nginx.NginxPlus.NginxDeploymentWafPolicies.create", + "azure.mgmt.nginx.aio.operations.WafPolicyOperations.begin_create": "Nginx.NginxPlus.NginxDeploymentWafPolicies.create", + "azure.mgmt.nginx.operations.WafPolicyOperations.begin_delete": "Nginx.NginxPlus.NginxDeploymentWafPolicies.delete", + "azure.mgmt.nginx.aio.operations.WafPolicyOperations.begin_delete": "Nginx.NginxPlus.NginxDeploymentWafPolicies.delete", + "azure.mgmt.nginx.operations.DefaultWafPolicyOperations.list": "Nginx.NginxPlus.NginxDeployments.defaultWafPolicyList", + "azure.mgmt.nginx.aio.operations.DefaultWafPolicyOperations.list": "Nginx.NginxPlus.NginxDeployments.defaultWafPolicyList", + "azure.mgmt.nginx.operations.CertificatesOperations.get": "Nginx.NginxPlus.NginxCertificates.get", + "azure.mgmt.nginx.aio.operations.CertificatesOperations.get": "Nginx.NginxPlus.NginxCertificates.get", + "azure.mgmt.nginx.operations.CertificatesOperations.begin_create_or_update": "Nginx.NginxPlus.NginxCertificates.createOrUpdate", + "azure.mgmt.nginx.aio.operations.CertificatesOperations.begin_create_or_update": "Nginx.NginxPlus.NginxCertificates.createOrUpdate", + "azure.mgmt.nginx.operations.CertificatesOperations.begin_delete": "Nginx.NginxPlus.NginxCertificates.delete", + "azure.mgmt.nginx.aio.operations.CertificatesOperations.begin_delete": "Nginx.NginxPlus.NginxCertificates.delete", + "azure.mgmt.nginx.operations.CertificatesOperations.list": "Nginx.NginxPlus.NginxCertificates.list", + "azure.mgmt.nginx.aio.operations.CertificatesOperations.list": "Nginx.NginxPlus.NginxCertificates.list", + "azure.mgmt.nginx.operations.ConfigurationsOperations.get": "Nginx.NginxPlus.NginxConfigurationResponses.get", + "azure.mgmt.nginx.aio.operations.ConfigurationsOperations.get": "Nginx.NginxPlus.NginxConfigurationResponses.get", + "azure.mgmt.nginx.operations.ConfigurationsOperations.begin_create_or_update": "Nginx.NginxPlus.NginxConfigurationResponses.createOrUpdate", + "azure.mgmt.nginx.aio.operations.ConfigurationsOperations.begin_create_or_update": "Nginx.NginxPlus.NginxConfigurationResponses.createOrUpdate", + "azure.mgmt.nginx.operations.ConfigurationsOperations.begin_delete": "Nginx.NginxPlus.NginxConfigurationResponses.delete", + "azure.mgmt.nginx.aio.operations.ConfigurationsOperations.begin_delete": "Nginx.NginxPlus.NginxConfigurationResponses.delete", + "azure.mgmt.nginx.operations.ConfigurationsOperations.list": "Nginx.NginxPlus.NginxConfigurationResponses.list", + "azure.mgmt.nginx.aio.operations.ConfigurationsOperations.list": "Nginx.NginxPlus.NginxConfigurationResponses.list", + "azure.mgmt.nginx.operations.ConfigurationsOperations.analysis": "Nginx.NginxPlus.NginxConfigurationResponses.analysis", + "azure.mgmt.nginx.aio.operations.ConfigurationsOperations.analysis": "Nginx.NginxPlus.NginxConfigurationResponses.analysis" } } \ No newline at end of file diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/__init__.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/__init__.py index 5e32e9567fbe..c3fe68f5abed 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/__init__.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -12,7 +12,7 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._nginx_management_client import NginxManagementClient # type: ignore +from ._client import NginxManagementClient # type: ignore from ._version import VERSION __version__ = VERSION diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_nginx_management_client.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_client.py similarity index 82% rename from sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_nginx_management_client.py rename to sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_client.py index 3fc1bb390d98..58c867730009 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_nginx_management_client.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_client.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -17,7 +17,6 @@ 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 ._utils.serialization import Deserializer, Serializer from .operations import ( @@ -26,6 +25,7 @@ ConfigurationsOperations, DefaultWafPolicyOperations, DeploymentsOperations, + NginxDeploymentWafPoliciesOperations, Operations, WafPolicyOperations, ) @@ -40,29 +40,33 @@ class NginxManagementClient: # pylint: disable=too-many-instance-attributes :ivar operations: Operations operations :vartype operations: azure.mgmt.nginx.operations.Operations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: azure.mgmt.nginx.operations.DeploymentsOperations + :ivar nginx_deployment_waf_policies: NginxDeploymentWafPoliciesOperations operations + :vartype nginx_deployment_waf_policies: + azure.mgmt.nginx.operations.NginxDeploymentWafPoliciesOperations :ivar api_keys: ApiKeysOperations operations :vartype api_keys: azure.mgmt.nginx.operations.ApiKeysOperations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: azure.mgmt.nginx.operations.DeploymentsOperations + :ivar waf_policy: WafPolicyOperations operations + :vartype waf_policy: azure.mgmt.nginx.operations.WafPolicyOperations + :ivar default_waf_policy: DefaultWafPolicyOperations operations + :vartype default_waf_policy: azure.mgmt.nginx.operations.DefaultWafPolicyOperations :ivar certificates: CertificatesOperations operations :vartype certificates: azure.mgmt.nginx.operations.CertificatesOperations :ivar configurations: ConfigurationsOperations operations :vartype configurations: azure.mgmt.nginx.operations.ConfigurationsOperations - :ivar default_waf_policy: DefaultWafPolicyOperations operations - :vartype default_waf_policy: azure.mgmt.nginx.operations.DefaultWafPolicyOperations - :ivar waf_policy: WafPolicyOperations operations - :vartype waf_policy: azure.mgmt.nginx.operations.WafPolicyOperations - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. 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 None. + :param base_url: Service host. Default value is None. :type base_url: str :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2025-03-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are "2025-11-01" + and None. Default value is "2025-11-01". Note that overriding this default value may result in + unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -77,6 +81,7 @@ def __init__( cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: + _endpoint = "{endpoint}" _cloud = cloud_setting or settings.current.azure_cloud # type: ignore _endpoints = get_arm_endpoints(_cloud) if not base_url: @@ -85,6 +90,7 @@ def __init__( self._config = NginxManagementClientConfiguration( credential=credential, subscription_id=subscription_id, + base_url=cast(str, base_url), cloud_setting=cloud_setting, credential_scopes=credential_scopes, **kwargs @@ -108,29 +114,31 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, _endpoint), 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 = Serializer() + self._deserialize = Deserializer() 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.nginx_deployment_waf_policies = NginxDeploymentWafPoliciesOperations( + 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.waf_policy = WafPolicyOperations(self._client, self._config, self._serialize, self._deserialize) self.default_waf_policy = DefaultWafPolicyOperations( self._client, self._config, self._serialize, self._deserialize ) - self.waf_policy = WafPolicyOperations(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) - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest >>> request = HttpRequest("GET", "https://www.example.org/") - >>> response = client._send_request(request) + >>> response = client.send_request(request) For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request @@ -143,7 +151,11 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: """ request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_configuration.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_configuration.py index b84e58cb0e25..e70c2d4ead36 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_configuration.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_configuration.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -24,15 +24,18 @@ class NginxManagementClientConfiguration: # pylint: disable=too-many-instance-a Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. 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 host. Default value is "https://management.azure.com". + :type base_url: str :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2025-03-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are "2025-11-01" + and None. Default value is "2025-11-01". Note that overriding this default value may result in + unsupported behavior. :paramtype api_version: str """ @@ -40,10 +43,11 @@ def __init__( self, credential: "TokenCredential", subscription_id: str, + base_url: str = "https://management.azure.com", cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2025-03-01-preview") + api_version: str = kwargs.pop("api_version", "2025-11-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -52,6 +56,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url self.cloud_setting = cloud_setting self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) 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 index 0af9b28f6607..8026245c2abc 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_utils/__init__.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_utils/__init__.py @@ -1,6 +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. +# Code generated by Microsoft (R) Python 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/_utils/model_base.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_utils/model_base.py new file mode 100644 index 000000000000..b4433021b4e5 --- /dev/null +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_utils/model_base.py @@ -0,0 +1,1343 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access, broad-except + +import copy +import calendar +import decimal +import functools +import sys +import logging +import base64 +import re +import typing +import enum +import email.utils +from datetime import datetime, date, time, timedelta, timezone +from json import JSONEncoder +import xml.etree.ElementTree as ET +from collections.abc import MutableMapping +from typing_extensions import Self +import isodate +from azure.core.exceptions import DeserializationError +from azure.core import CaseInsensitiveEnumMeta +from azure.core.pipeline import PipelineResponse +from azure.core.serialization import _Null +from azure.core.rest import HttpResponse + +_LOGGER = logging.getLogger(__name__) + +__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] + +TZ_UTC = timezone.utc +_T = typing.TypeVar("_T") +_NONE_TYPE = type(None) + + +def _timedelta_as_isostr(td: timedelta) -> str: + """Converts a datetime.timedelta object into an ISO 8601 formatted string, e.g. 'P4DT12H30M05S' + + Function adapted from the Tin Can Python project: https://github.com/RusticiSoftware/TinCanPython + + :param timedelta td: The timedelta to convert + :rtype: str + :return: ISO8601 version of this timedelta + """ + + # Split seconds to larger units + seconds = td.total_seconds() + minutes, seconds = divmod(seconds, 60) + hours, minutes = divmod(minutes, 60) + days, hours = divmod(hours, 24) + + days, hours, minutes = list(map(int, (days, hours, minutes))) + seconds = round(seconds, 6) + + # Build date + date_str = "" + if days: + date_str = "%sD" % days + + if hours or minutes or seconds: + # Build time + time_str = "T" + + # Hours + bigger_exists = date_str or hours + if bigger_exists: + time_str += "{:02}H".format(hours) + + # Minutes + bigger_exists = bigger_exists or minutes + if bigger_exists: + time_str += "{:02}M".format(minutes) + + # Seconds + try: + if seconds.is_integer(): + seconds_string = "{:02}".format(int(seconds)) + else: + # 9 chars long w/ leading 0, 6 digits after decimal + seconds_string = "%09.6f" % seconds + # Remove trailing zeros + seconds_string = seconds_string.rstrip("0") + except AttributeError: # int.is_integer() raises + seconds_string = "{:02}".format(seconds) + + time_str += "{}S".format(seconds_string) + else: + time_str = "" + + return "P" + date_str + time_str + + +def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: + encoded = base64.b64encode(o).decode() + if format == "base64url": + return encoded.strip("=").replace("+", "-").replace("/", "_") + return encoded + + +def _serialize_datetime(o, format: typing.Optional[str] = None): + if hasattr(o, "year") and hasattr(o, "hour"): + if format == "rfc7231": + return email.utils.format_datetime(o, usegmt=True) + if format == "unix-timestamp": + return int(calendar.timegm(o.utctimetuple())) + + # astimezone() fails for naive times in Python 2.7, so make make sure o is aware (tzinfo is set) + if not o.tzinfo: + iso_formatted = o.replace(tzinfo=TZ_UTC).isoformat() + else: + iso_formatted = o.astimezone(TZ_UTC).isoformat() + # Replace the trailing "+00:00" UTC offset with "Z" (RFC 3339: https://www.ietf.org/rfc/rfc3339.txt) + return iso_formatted.replace("+00:00", "Z") + # Next try datetime.date or datetime.time + return o.isoformat() + + +def _is_readonly(p): + try: + return p._visibility == ["read"] + except AttributeError: + return False + + +class SdkJSONEncoder(JSONEncoder): + """A JSON encoder that's capable of serializing datetime objects and bytes.""" + + def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): + super().__init__(*args, **kwargs) + self.exclude_readonly = exclude_readonly + self.format = format + + def default(self, o): # pylint: disable=too-many-return-statements + if _is_model(o): + if self.exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + return {k: v for k, v in o.items() if k not in readonly_props} + return dict(o.items()) + try: + return super(SdkJSONEncoder, self).default(o) + except TypeError: + if isinstance(o, _Null): + return None + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, self.format) + try: + # First try datetime.datetime + return _serialize_datetime(o, self.format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return super(SdkJSONEncoder, self).default(o) + + +_VALID_DATE = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" + r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") +_VALID_RFC7231 = re.compile( + r"(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s" + r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" +) + +_ARRAY_ENCODE_MAPPING = { + "pipeDelimited": "|", + "spaceDelimited": " ", + "commaDelimited": ",", + "newlineDelimited": "\n", +} + + +def _deserialize_array_encoded(delimit: str, attr): + if isinstance(attr, str): + if attr == "": + return [] + return attr.split(delimit) + return attr + + +def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + attr = attr.upper() + match = _VALID_DATE.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + return date_obj # type: ignore[no-any-return] + + +def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize RFC7231 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + match = _VALID_RFC7231.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + return email.utils.parsedate_to_datetime(attr) + + +def _deserialize_datetime_unix_timestamp(attr: typing.Union[float, datetime]) -> datetime: + """Deserialize unix timestamp into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + return datetime.fromtimestamp(attr, TZ_UTC) + + +def _deserialize_date(attr: typing.Union[str, date]) -> date: + """Deserialize ISO-8601 formatted string into Date object. + :param str attr: response string to be deserialized. + :rtype: date + :returns: The date object from that input + """ + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + if isinstance(attr, date): + return attr + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) # type: ignore + + +def _deserialize_time(attr: typing.Union[str, time]) -> time: + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :returns: The time object from that input + """ + if isinstance(attr, time): + return attr + return isodate.parse_time(attr) # type: ignore[no-any-return] + + +def _deserialize_bytes(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + return bytes(base64.b64decode(attr)) + + +def _deserialize_bytes_base64(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return bytes(base64.b64decode(encoded)) + + +def _deserialize_duration(attr): + if isinstance(attr, timedelta): + return attr + return isodate.parse_duration(attr) + + +def _deserialize_decimal(attr): + if isinstance(attr, decimal.Decimal): + return attr + return decimal.Decimal(str(attr)) + + +def _deserialize_int_as_str(attr): + if isinstance(attr, int): + return attr + return int(attr) + + +_DESERIALIZE_MAPPING = { + datetime: _deserialize_datetime, + date: _deserialize_date, + time: _deserialize_time, + bytes: _deserialize_bytes, + bytearray: _deserialize_bytes, + timedelta: _deserialize_duration, + typing.Any: lambda x: x, + decimal.Decimal: _deserialize_decimal, +} + +_DESERIALIZE_MAPPING_WITHFORMAT = { + "rfc3339": _deserialize_datetime, + "rfc7231": _deserialize_datetime_rfc7231, + "unix-timestamp": _deserialize_datetime_unix_timestamp, + "base64": _deserialize_bytes, + "base64url": _deserialize_bytes_base64, +} + + +def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): + if annotation is int and rf and rf._format == "str": + return _deserialize_int_as_str + if annotation is str and rf and rf._format in _ARRAY_ENCODE_MAPPING: + return functools.partial(_deserialize_array_encoded, _ARRAY_ENCODE_MAPPING[rf._format]) + if rf and rf._format: + return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) + return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore + + +def _get_type_alias_type(module_name: str, alias_name: str): + types = { + k: v + for k, v in sys.modules[module_name].__dict__.items() + if isinstance(v, typing._GenericAlias) # type: ignore + } + if alias_name not in types: + return alias_name + return types[alias_name] + + +def _get_model(module_name: str, model_name: str): + models = {k: v for k, v in sys.modules[module_name].__dict__.items() if isinstance(v, type)} + module_end = module_name.rsplit(".", 1)[0] + models.update({k: v for k, v in sys.modules[module_end].__dict__.items() if isinstance(v, type)}) + if isinstance(model_name, str): + model_name = model_name.split(".")[-1] + if model_name not in models: + return model_name + return models[model_name] + + +_UNSET = object() + + +class _MyMutableMapping(MutableMapping[str, typing.Any]): + def __init__(self, data: dict[str, typing.Any]) -> None: + self._data = data + + def __contains__(self, key: typing.Any) -> bool: + return key in self._data + + def __getitem__(self, key: str) -> typing.Any: + # If this key has been deserialized (for mutable types), we need to handle serialization + if hasattr(self, "_attr_to_rest_field"): + cache_attr = f"_deserialized_{key}" + if hasattr(self, cache_attr): + rf = _get_rest_field(getattr(self, "_attr_to_rest_field"), key) + if rf: + value = self._data.get(key) + if isinstance(value, (dict, list, set)): + # For mutable types, serialize and return + # But also update _data with serialized form and clear flag + # so mutations via this returned value affect _data + serialized = _serialize(value, rf._format) + # If serialized form is same type (no transformation needed), + # return _data directly so mutations work + if isinstance(serialized, type(value)) and serialized == value: + return self._data.get(key) + # Otherwise return serialized copy and clear flag + try: + object.__delattr__(self, cache_attr) + except AttributeError: + pass + # Store serialized form back + self._data[key] = serialized + return serialized + return self._data.__getitem__(key) + + def __setitem__(self, key: str, value: typing.Any) -> None: + # Clear any cached deserialized value when setting through dictionary access + cache_attr = f"_deserialized_{key}" + try: + object.__delattr__(self, cache_attr) + except AttributeError: + pass + self._data.__setitem__(key, value) + + def __delitem__(self, key: str) -> None: + self._data.__delitem__(key) + + def __iter__(self) -> typing.Iterator[typing.Any]: + return self._data.__iter__() + + def __len__(self) -> int: + return self._data.__len__() + + def __ne__(self, other: typing.Any) -> bool: + return not self.__eq__(other) + + def keys(self) -> typing.KeysView[str]: + """ + :returns: a set-like object providing a view on D's keys + :rtype: ~typing.KeysView + """ + return self._data.keys() + + def values(self) -> typing.ValuesView[typing.Any]: + """ + :returns: an object providing a view on D's values + :rtype: ~typing.ValuesView + """ + return self._data.values() + + def items(self) -> typing.ItemsView[str, typing.Any]: + """ + :returns: set-like object providing a view on D's items + :rtype: ~typing.ItemsView + """ + return self._data.items() + + def get(self, key: str, default: typing.Any = None) -> typing.Any: + """ + Get the value for key if key is in the dictionary, else default. + :param str key: The key to look up. + :param any default: The value to return if key is not in the dictionary. Defaults to None + :returns: D[k] if k in D, else d. + :rtype: any + """ + try: + return self[key] + except KeyError: + return default + + @typing.overload + def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ + + @typing.overload + def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs + + @typing.overload + def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Removes specified key and return the corresponding value. + :param str key: The key to pop. + :param any default: The value to return if key is not in the dictionary + :returns: The value corresponding to the key. + :rtype: any + :raises KeyError: If key is not found and default is not given. + """ + if default is _UNSET: + return self._data.pop(key) + return self._data.pop(key, default) + + def popitem(self) -> tuple[str, typing.Any]: + """ + Removes and returns some (key, value) pair + :returns: The (key, value) pair. + :rtype: tuple + :raises KeyError: if D is empty. + """ + return self._data.popitem() + + def clear(self) -> None: + """ + Remove all items from D. + """ + self._data.clear() + + def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ + """ + Updates D from mapping/iterable E and F. + :param any args: Either a mapping object or an iterable of key-value pairs. + """ + self._data.update(*args, **kwargs) + + @typing.overload + def setdefault(self, key: str, default: None = None) -> None: ... + + @typing.overload + def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Same as calling D.get(k, d), and setting D[k]=d if k not found + :param str key: The key to look up. + :param any default: The value to set if key is not in the dictionary + :returns: D[k] if k in D, else d. + :rtype: any + """ + if default is _UNSET: + return self._data.setdefault(key) + return self._data.setdefault(key, default) + + def __eq__(self, other: typing.Any) -> bool: + if isinstance(other, _MyMutableMapping): + return self._data == other._data + try: + other_model = self.__class__(other) + except Exception: + return False + return self._data == other_model._data + + def __repr__(self) -> str: + return str(self._data) + + +def _is_model(obj: typing.Any) -> bool: + return getattr(obj, "_is_model", False) + + +def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements + if isinstance(o, list): + if format in _ARRAY_ENCODE_MAPPING and all(isinstance(x, str) for x in o): + return _ARRAY_ENCODE_MAPPING[format].join(o) + return [_serialize(x, format) for x in o] + if isinstance(o, dict): + return {k: _serialize(v, format) for k, v in o.items()} + if isinstance(o, set): + return {_serialize(x, format) for x in o} + if isinstance(o, tuple): + return tuple(_serialize(x, format) for x in o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, format) + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, enum.Enum): + return o.value + if isinstance(o, int): + if format == "str": + return str(o) + return o + try: + # First try datetime.datetime + return _serialize_datetime(o, format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return o + + +def _get_rest_field(attr_to_rest_field: dict[str, "_RestField"], rest_name: str) -> typing.Optional["_RestField"]: + try: + return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) + except StopIteration: + return None + + +def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: + if not rf: + return _serialize(value, None) + if rf._is_multipart_file_input: + return value + if rf._is_model: + return _deserialize(rf._type, value) + if isinstance(value, ET.Element): + value = _deserialize(rf._type, value) + return _serialize(value, rf._format) + + +class Model(_MyMutableMapping): + _is_model = True + # label whether current class's _attr_to_rest_field has been calculated + # could not see _attr_to_rest_field directly because subclass inherits it from parent class + _calculated: set[str] = set() + + def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: + class_name = self.__class__.__name__ + if len(args) > 1: + raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") + dict_to_pass = { + rest_field._rest_name: rest_field._default + for rest_field in self._attr_to_rest_field.values() + if rest_field._default is not _UNSET + } + if args: # pylint: disable=too-many-nested-blocks + if isinstance(args[0], ET.Element): + existed_attr_keys = [] + model_meta = getattr(self, "_xml", {}) + + for rf in self._attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and args[0].get(xml_name) is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + # unwrapped array could either use prop items meta/prop meta + if prop_meta.get("itemsName"): + xml_name = prop_meta.get("itemsName") + xml_ns = prop_meta.get("itemNs") + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = args[0].findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, items) + continue + + # text element is primitive type + if prop_meta.get("text", False): + if args[0].text is not None: + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].text) + continue + + # wrapped element could be normal property or array, it should only have one element + item = args[0].find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, item) + + # rest thing is additional properties + for e in args[0]: + if e.tag not in existed_attr_keys: + dict_to_pass[e.tag] = _convert_element(e) + else: + dict_to_pass.update( + {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} + ) + else: + non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] + if non_attr_kwargs: + # actual type errors only throw the first wrong keyword arg they see, so following that. + raise TypeError(f"{class_name}.__init__() got an unexpected keyword argument '{non_attr_kwargs[0]}'") + dict_to_pass.update( + { + self._attr_to_rest_field[k]._rest_name: _create_value(self._attr_to_rest_field[k], v) + for k, v in kwargs.items() + if v is not None + } + ) + super().__init__(dict_to_pass) + + def copy(self) -> "Model": + return Model(self.__dict__) + + def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: + if f"{cls.__module__}.{cls.__qualname__}" not in cls._calculated: + # we know the last nine classes in mro are going to be 'Model', '_MyMutableMapping', 'MutableMapping', + # 'Mapping', 'Collection', 'Sized', 'Iterable', 'Container' and 'object' + mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order + attr_to_rest_field: dict[str, _RestField] = { # map attribute name to rest_field property + k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") + } + annotations = { + k: v + for mro_class in mros + if hasattr(mro_class, "__annotations__") + for k, v in mro_class.__annotations__.items() + } + for attr, rf in attr_to_rest_field.items(): + rf._module = cls.__module__ + if not rf._type: + rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) + if not rf._rest_name_input: + rf._rest_name_input = attr + cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) + cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") + + return super().__new__(cls) + + def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: + for base in cls.__bases__: + if hasattr(base, "__mapping__"): + base.__mapping__[discriminator or cls.__name__] = cls # type: ignore + + @classmethod + def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: + for v in cls.__dict__.values(): + if isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators: + return v + return None + + @classmethod + def _deserialize(cls, data, exist_discriminators): + if not hasattr(cls, "__mapping__"): + return cls(data) + discriminator = cls._get_discriminator(exist_discriminators) + if discriminator is None: + return cls(data) + exist_discriminators.append(discriminator._rest_name) + if isinstance(data, ET.Element): + model_meta = getattr(cls, "_xml", {}) + prop_meta = getattr(discriminator, "_xml", {}) + xml_name = prop_meta.get("name", discriminator._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + if data.get(xml_name) is not None: + discriminator_value = data.get(xml_name) + else: + discriminator_value = data.find(xml_name).text # pyright: ignore + else: + discriminator_value = data.get(discriminator._rest_name) + mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member + return mapped_cls._deserialize(data, exist_discriminators) + + def as_dict(self, *, exclude_readonly: bool = False) -> dict[str, typing.Any]: + """Return a dict that can be turned into json using json.dump. + + :keyword bool exclude_readonly: Whether to remove the readonly properties. + :returns: A dict JSON compatible object + :rtype: dict + """ + + result = {} + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] + for k, v in self.items(): + if exclude_readonly and k in readonly_props: # pyright: ignore + continue + is_multipart_file_input = False + try: + is_multipart_file_input = next( + rf for rf in self._attr_to_rest_field.values() if rf._rest_name == k + )._is_multipart_file_input + except StopIteration: + pass + result[k] = v if is_multipart_file_input else Model._as_dict_value(v, exclude_readonly=exclude_readonly) + return result + + @staticmethod + def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: + if v is None or isinstance(v, _Null): + return None + if isinstance(v, (list, tuple, set)): + return type(v)(Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v) + if isinstance(v, dict): + return {dk: Model._as_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} + return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v + + +def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): + if _is_model(obj): + return obj + return _deserialize(model_deserializer, obj) + + +def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): + if obj is None: + return obj + return _deserialize_with_callable(if_obj_deserializer, obj) + + +def _deserialize_with_union(deserializers, obj): + for deserializer in deserializers: + try: + return _deserialize(deserializer, obj) + except DeserializationError: + pass + raise DeserializationError() + + +def _deserialize_dict( + value_deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj: dict[typing.Any, typing.Any], +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = {child.tag: child for child in obj} + return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} + + +def _deserialize_multiple_sequence( + entry_deserializers: list[typing.Optional[typing.Callable]], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) + + +def _is_array_encoded_deserializer(deserializer: functools.partial) -> bool: + return ( + isinstance(deserializer, functools.partial) + and isinstance(deserializer.args[0], functools.partial) + and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable + ) + + +def _deserialize_sequence( + deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = list(obj) + + # encoded string may be deserialized to sequence + if isinstance(obj, str) and isinstance(deserializer, functools.partial): + # for list[str] + if _is_array_encoded_deserializer(deserializer): + return deserializer(obj) + + # for list[Union[...]] + if isinstance(deserializer.args[0], list): + for sub_deserializer in deserializer.args[0]: + if _is_array_encoded_deserializer(sub_deserializer): + return sub_deserializer(obj) + + return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) + + +def _sorted_annotations(types: list[typing.Any]) -> list[typing.Any]: + return sorted( + types, + key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), + ) + + +def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-statements, too-many-branches + annotation: typing.Any, + module: typing.Optional[str], + rf: typing.Optional["_RestField"] = None, +) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + if not annotation: + return None + + # is it a type alias? + if isinstance(annotation, str): + if module is not None: + annotation = _get_type_alias_type(module, annotation) + + # is it a forward ref / in quotes? + if isinstance(annotation, (str, typing.ForwardRef)): + try: + model_name = annotation.__forward_arg__ # type: ignore + except AttributeError: + model_name = annotation + if module is not None: + annotation = _get_model(module, model_name) # type: ignore + + try: + if module and _is_model(annotation): + if rf: + rf._is_model = True + + return functools.partial(_deserialize_model, annotation) # pyright: ignore + except Exception: + pass + + # is it a literal? + try: + if annotation.__origin__ is typing.Literal: # pyright: ignore + return None + except AttributeError: + pass + + # is it optional? + try: + if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore + if len(annotation.__args__) <= 2: # pyright: ignore + if_obj_deserializer = _get_deserialize_callable_from_annotation( + next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_with_optional, if_obj_deserializer) + # the type is Optional[Union[...]], we need to remove the None type from the Union + annotation_copy = copy.copy(annotation) + annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a is not _NONE_TYPE] # pyright: ignore + return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) + except AttributeError: + pass + + # is it union? + if getattr(annotation, "__origin__", None) is typing.Union: + # initial ordering is we make `string` the last deserialization option, because it is often them most generic + deserializers = [ + _get_deserialize_callable_from_annotation(arg, module, rf) + for arg in _sorted_annotations(annotation.__args__) # pyright: ignore + ] + + return functools.partial(_deserialize_with_union, deserializers) + + try: + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() == "dict": + value_deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[1], module, rf # pyright: ignore + ) + + return functools.partial( + _deserialize_dict, + value_deserializer, + module, + ) + except (AttributeError, IndexError): + pass + try: + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() in ["list", "set", "tuple", "sequence"]: + if len(annotation.__args__) > 1: # pyright: ignore + entry_deserializers = [ + _get_deserialize_callable_from_annotation(dt, module, rf) + for dt in annotation.__args__ # pyright: ignore + ] + return functools.partial(_deserialize_multiple_sequence, entry_deserializers, module) + deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[0], module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_sequence, deserializer, module) + except (TypeError, IndexError, AttributeError, SyntaxError): + pass + + def _deserialize_default( + deserializer, + obj, + ): + if obj is None: + return obj + try: + return _deserialize_with_callable(deserializer, obj) + except Exception: + pass + return obj + + if get_deserializer(annotation, rf): + return functools.partial(_deserialize_default, get_deserializer(annotation, rf)) + + return functools.partial(_deserialize_default, annotation) + + +def _deserialize_with_callable( + deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], + value: typing.Any, +): # pylint: disable=too-many-return-statements + try: + if value is None or isinstance(value, _Null): + return None + if isinstance(value, ET.Element): + if deserializer is str: + return value.text or "" + if deserializer is int: + return int(value.text) if value.text else None + if deserializer is float: + return float(value.text) if value.text else None + if deserializer is bool: + return value.text == "true" if value.text else None + if deserializer and deserializer in _DESERIALIZE_MAPPING.values(): + return deserializer(value.text) if value.text else None + if deserializer and deserializer in _DESERIALIZE_MAPPING_WITHFORMAT.values(): + return deserializer(value.text) if value.text else None + if deserializer is None: + return value + if deserializer in [int, float, bool]: + return deserializer(value) + if isinstance(deserializer, CaseInsensitiveEnumMeta): + try: + return deserializer(value.text if isinstance(value, ET.Element) else value) + except ValueError: + # for unknown value, return raw value + return value.text if isinstance(value, ET.Element) else value + if isinstance(deserializer, type) and issubclass(deserializer, Model): + return deserializer._deserialize(value, []) + return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) + except Exception as e: + raise DeserializationError() from e + + +def _deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + if isinstance(value, PipelineResponse): + value = value.http_response.json() + if rf is None and format: + rf = _RestField(format=format) + if not isinstance(deserializer, functools.partial): + deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) + return _deserialize_with_callable(deserializer, value) + + +def _failsafe_deserialize( + deserializer: typing.Any, + response: HttpResponse, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + try: + return _deserialize(deserializer, response.json(), module, rf, format) + except Exception: # pylint: disable=broad-except + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +def _failsafe_deserialize_xml( + deserializer: typing.Any, + response: HttpResponse, +) -> typing.Any: + try: + return _deserialize_xml(deserializer, response.text()) + except Exception: # pylint: disable=broad-except + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +class _RestField: + def __init__( + self, + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + is_discriminator: bool = False, + visibility: typing.Optional[list[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[dict[str, typing.Any]] = None, + ): + self._type = type + self._rest_name_input = name + self._module: typing.Optional[str] = None + self._is_discriminator = is_discriminator + self._visibility = visibility + self._is_model = False + self._default = default + self._format = format + self._is_multipart_file_input = is_multipart_file_input + self._xml = xml if xml is not None else {} + + @property + def _class_type(self) -> typing.Any: + result = getattr(self._type, "args", [None])[0] + # type may be wrapped by nested functools.partial so we need to check for that + if isinstance(result, functools.partial): + return getattr(result, "args", [None])[0] + return result + + @property + def _rest_name(self) -> str: + if self._rest_name_input is None: + raise ValueError("Rest name was never set") + return self._rest_name_input + + def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin + # by this point, type and rest_name will have a value bc we default + # them in __new__ of the Model class + # Use _data.get() directly to avoid triggering __getitem__ which clears the cache + item = obj._data.get(self._rest_name) + if item is None: + return item + if self._is_model: + return item + + # For mutable types, we want mutations to directly affect _data + # Check if we've already deserialized this value + cache_attr = f"_deserialized_{self._rest_name}" + if hasattr(obj, cache_attr): + # Return the value from _data directly (it's been deserialized in place) + return obj._data.get(self._rest_name) + + deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) + + # For mutable types, store the deserialized value back in _data + # so mutations directly affect _data + if isinstance(deserialized, (dict, list, set)): + obj._data[self._rest_name] = deserialized + object.__setattr__(obj, cache_attr, True) # Mark as deserialized + return deserialized + + return deserialized + + def __set__(self, obj: Model, value) -> None: + # Clear the cached deserialized object when setting a new value + cache_attr = f"_deserialized_{self._rest_name}" + if hasattr(obj, cache_attr): + object.__delattr__(obj, cache_attr) + + if value is None: + # we want to wipe out entries if users set attr to None + try: + obj.__delitem__(self._rest_name) + except KeyError: + pass + return + if self._is_model: + if not _is_model(value): + value = _deserialize(self._type, value) + obj.__setitem__(self._rest_name, value) + return + obj.__setitem__(self._rest_name, _serialize(value, self._format)) + + def _get_deserialize_callable_from_annotation( + self, annotation: typing.Any + ) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + return _get_deserialize_callable_from_annotation(annotation, self._module, self) + + +def rest_field( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[list[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField( + name=name, + type=type, + visibility=visibility, + default=default, + format=format, + is_multipart_file_input=is_multipart_file_input, + xml=xml, + ) + + +def rest_discriminator( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[list[str]] = None, + xml: typing.Optional[dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) + + +def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: + """Serialize a model to XML. + + :param Model model: The model to serialize. + :param bool exclude_readonly: Whether to exclude readonly properties. + :returns: The XML representation of the model. + :rtype: str + """ + return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore + + +def _get_element( + o: typing.Any, + exclude_readonly: bool = False, + parent_meta: typing.Optional[dict[str, typing.Any]] = None, + wrapped_element: typing.Optional[ET.Element] = None, +) -> typing.Union[ET.Element, list[ET.Element]]: + if _is_model(o): + model_meta = getattr(o, "_xml", {}) + + # if prop is a model, then use the prop element directly, else generate a wrapper of model + if wrapped_element is None: + wrapped_element = _create_xml_element( + model_meta.get("name", o.__class__.__name__), + model_meta.get("prefix"), + model_meta.get("ns"), + ) + + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + + for k, v in o.items(): + # do not serialize readonly properties + if exclude_readonly and k in readonly_props: + continue + + prop_rest_field = _get_rest_field(o._attr_to_rest_field, k) + if prop_rest_field: + prop_meta = getattr(prop_rest_field, "_xml").copy() + # use the wire name as xml name if no specific name is set + if prop_meta.get("name") is None: + prop_meta["name"] = k + else: + # additional properties will not have rest field, use the wire name as xml name + prop_meta = {"name": k} + + # if no ns for prop, use model's + if prop_meta.get("ns") is None and model_meta.get("ns"): + prop_meta["ns"] = model_meta.get("ns") + prop_meta["prefix"] = model_meta.get("prefix") + + if prop_meta.get("unwrapped", False): + # unwrapped could only set on array + wrapped_element.extend(_get_element(v, exclude_readonly, prop_meta)) + elif prop_meta.get("text", False): + # text could only set on primitive type + wrapped_element.text = _get_primitive_type_value(v) + elif prop_meta.get("attribute", False): + xml_name = prop_meta.get("name", k) + if prop_meta.get("ns"): + ET.register_namespace(prop_meta.get("prefix"), prop_meta.get("ns")) # pyright: ignore + xml_name = "{" + prop_meta.get("ns") + "}" + xml_name # pyright: ignore + # attribute should be primitive type + wrapped_element.set(xml_name, _get_primitive_type_value(v)) + else: + # other wrapped prop element + wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) + return wrapped_element + if isinstance(o, list): + return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore + if isinstance(o, dict): + result = [] + for k, v in o.items(): + result.append( + _get_wrapped_element( + v, + exclude_readonly, + { + "name": k, + "ns": parent_meta.get("ns") if parent_meta else None, + "prefix": parent_meta.get("prefix") if parent_meta else None, + }, + ) + ) + return result + + # primitive case need to create element based on parent_meta + if parent_meta: + return _get_wrapped_element( + o, + exclude_readonly, + { + "name": parent_meta.get("itemsName", parent_meta.get("name")), + "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), + "ns": parent_meta.get("itemsNs", parent_meta.get("ns")), + }, + ) + + raise ValueError("Could not serialize value into xml: " + o) + + +def _get_wrapped_element( + v: typing.Any, + exclude_readonly: bool, + meta: typing.Optional[dict[str, typing.Any]], +) -> ET.Element: + wrapped_element = _create_xml_element( + meta.get("name") if meta else None, meta.get("prefix") if meta else None, meta.get("ns") if meta else None + ) + if isinstance(v, (dict, list)): + wrapped_element.extend(_get_element(v, exclude_readonly, meta)) + elif _is_model(v): + _get_element(v, exclude_readonly, meta, wrapped_element) + else: + wrapped_element.text = _get_primitive_type_value(v) + return wrapped_element # type: ignore[no-any-return] + + +def _get_primitive_type_value(v) -> str: + if v is True: + return "true" + if v is False: + return "false" + if isinstance(v, _Null): + return "" + return str(v) + + +def _create_xml_element( + tag: typing.Any, prefix: typing.Optional[str] = None, ns: typing.Optional[str] = None +) -> ET.Element: + if prefix and ns: + ET.register_namespace(prefix, ns) + if ns: + return ET.Element("{" + ns + "}" + tag) + return ET.Element(tag) + + +def _deserialize_xml( + deserializer: typing.Any, + value: str, +) -> typing.Any: + element = ET.fromstring(value) # nosec + return _deserialize(deserializer, element) + + +def _convert_element(e: ET.Element): + # dict case + if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: + dict_result: dict[str, typing.Any] = {} + for child in e: + if dict_result.get(child.tag) is not None: + if isinstance(dict_result[child.tag], list): + dict_result[child.tag].append(_convert_element(child)) + else: + dict_result[child.tag] = [dict_result[child.tag], _convert_element(child)] + else: + dict_result[child.tag] = _convert_element(child) + dict_result.update(e.attrib) + return dict_result + # array case + if len(e) > 0: + array_result: list[typing.Any] = [] + for child in e: + array_result.append(_convert_element(child)) + return array_result + # primitive case + return e.text diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_utils/serialization.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_utils/serialization.py index 6da830e0cf4a..81ec1de5922b 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_utils/serialization.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_utils/serialization.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python 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/_validation.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_validation.py new file mode 100644 index 000000000000..f5af3a4eb8a2 --- /dev/null +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_validation.py @@ -0,0 +1,66 @@ +# -------------------------------------------------------------------------- +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools + + +def api_version_validation(**kwargs): + params_added_on = kwargs.pop("params_added_on", {}) + method_added_on = kwargs.pop("method_added_on", "") + api_versions_list = kwargs.pop("api_versions_list", []) + + def _index_with_default(value: str, default: int = -1) -> int: + """Get the index of value in lst, or return default if not found. + + :param value: The value to search for in the api_versions_list. + :type value: str + :param default: The default value to return if the value is not found. + :type default: int + :return: The index of the value in the list, or the default value if not found. + :rtype: int + """ + try: + return api_versions_list.index(value) + except ValueError: + return default + + def decorator(func): + @functools.wraps(func) + def wrapper(*args, **kwargs): + try: + # this assumes the client has an _api_version attribute + client = args[0] + client_api_version = client._config.api_version # pylint: disable=protected-access + except AttributeError: + return func(*args, **kwargs) + + if _index_with_default(method_added_on) > _index_with_default(client_api_version): + raise ValueError( + f"'{func.__name__}' is not available in API version " + f"{client_api_version}. Pass service API version {method_added_on} or newer to your client." + ) + + unsupported = { + parameter: api_version + for api_version, parameters in params_added_on.items() + for parameter in parameters + if parameter in kwargs and _index_with_default(api_version) > _index_with_default(client_api_version) + } + if unsupported: + raise ValueError( + "".join( + [ + f"'{param}' is not available in API version {client_api_version}. " + f"Use service API version {version} or newer.\n" + for param, version in unsupported.items() + ] + ) + ) + return func(*args, **kwargs) + + return wrapper + + return decorator 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 978d841f3d46..4594e838eeb4 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.0b3" +VERSION = "4.0.0" diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/__init__.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/__init__.py index d817f89f4a33..69e220375ebf 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/__init__.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -12,7 +12,7 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._nginx_management_client import NginxManagementClient # type: ignore +from ._client import NginxManagementClient # type: ignore try: from ._patch import __all__ as _patch_all 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/_client.py similarity index 83% rename from sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_nginx_management_client.py rename to sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_client.py index 5ed3e937ad29..3533f879681e 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/_client.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -17,7 +17,6 @@ from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from azure.mgmt.core.tools import get_arm_endpoints -from .. import models as _models from .._utils.serialization import Deserializer, Serializer from ._configuration import NginxManagementClientConfiguration from .operations import ( @@ -26,6 +25,7 @@ ConfigurationsOperations, DefaultWafPolicyOperations, DeploymentsOperations, + NginxDeploymentWafPoliciesOperations, Operations, WafPolicyOperations, ) @@ -40,29 +40,33 @@ class NginxManagementClient: # pylint: disable=too-many-instance-attributes :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 nginx_deployment_waf_policies: NginxDeploymentWafPoliciesOperations operations + :vartype nginx_deployment_waf_policies: + azure.mgmt.nginx.aio.operations.NginxDeploymentWafPoliciesOperations :ivar api_keys: ApiKeysOperations operations :vartype api_keys: azure.mgmt.nginx.aio.operations.ApiKeysOperations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: azure.mgmt.nginx.aio.operations.DeploymentsOperations + :ivar waf_policy: WafPolicyOperations operations + :vartype waf_policy: azure.mgmt.nginx.aio.operations.WafPolicyOperations + :ivar default_waf_policy: DefaultWafPolicyOperations operations + :vartype default_waf_policy: azure.mgmt.nginx.aio.operations.DefaultWafPolicyOperations :ivar certificates: CertificatesOperations operations :vartype certificates: azure.mgmt.nginx.aio.operations.CertificatesOperations :ivar configurations: ConfigurationsOperations operations :vartype configurations: azure.mgmt.nginx.aio.operations.ConfigurationsOperations - :ivar default_waf_policy: DefaultWafPolicyOperations operations - :vartype default_waf_policy: azure.mgmt.nginx.aio.operations.DefaultWafPolicyOperations - :ivar waf_policy: WafPolicyOperations operations - :vartype waf_policy: azure.mgmt.nginx.aio.operations.WafPolicyOperations - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. 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 None. + :param base_url: Service host. Default value is None. :type base_url: str :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2025-03-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are "2025-11-01" + and None. Default value is "2025-11-01". Note that overriding this default value may result in + unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -77,6 +81,7 @@ def __init__( cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: + _endpoint = "{endpoint}" _cloud = cloud_setting or settings.current.azure_cloud # type: ignore _endpoints = get_arm_endpoints(_cloud) if not base_url: @@ -85,6 +90,7 @@ def __init__( self._config = NginxManagementClientConfiguration( credential=credential, subscription_id=subscription_id, + base_url=cast(str, base_url), cloud_setting=cloud_setting, credential_scopes=credential_scopes, **kwargs @@ -109,24 +115,26 @@ def __init__( self._config.http_logging_policy, ] self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( - base_url=cast(str, base_url), policies=_policies, **kwargs + base_url=cast(str, _endpoint), 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 = Serializer() + self._deserialize = Deserializer() 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.nginx_deployment_waf_policies = NginxDeploymentWafPoliciesOperations( + 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.waf_policy = WafPolicyOperations(self._client, self._config, self._serialize, self._deserialize) self.default_waf_policy = DefaultWafPolicyOperations( self._client, self._config, self._serialize, self._deserialize ) - self.waf_policy = WafPolicyOperations(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) - def _send_request( + def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. @@ -134,7 +142,7 @@ def _send_request( >>> from azure.core.rest import HttpRequest >>> request = HttpRequest("GET", "https://www.example.org/") - >>> response = await client._send_request(request) + >>> response = await client.send_request(request) For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request @@ -147,7 +155,11 @@ def _send_request( """ request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_configuration.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_configuration.py index c37b2098d746..56ac17a54898 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_configuration.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_configuration.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -24,15 +24,18 @@ class NginxManagementClientConfiguration: # pylint: disable=too-many-instance-a Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. 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 host. Default value is "https://management.azure.com". + :type base_url: str :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2025-03-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are "2025-11-01" + and None. Default value is "2025-11-01". Note that overriding this default value may result in + unsupported behavior. :paramtype api_version: str """ @@ -40,10 +43,11 @@ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, + base_url: str = "https://management.azure.com", cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2025-03-01-preview") + api_version: str = kwargs.pop("api_version", "2025-11-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -52,6 +56,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url self.cloud_setting = cloud_setting self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) 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 8896f281e12d..7521d12a90da 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -13,12 +13,13 @@ 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 ._default_waf_policy_operations import DefaultWafPolicyOperations # type: ignore -from ._waf_policy_operations import WafPolicyOperations # type: ignore +from ._operations import NginxDeploymentWafPoliciesOperations # type: ignore +from ._operations import ApiKeysOperations # type: ignore +from ._operations import DeploymentsOperations # type: ignore +from ._operations import WafPolicyOperations # type: ignore +from ._operations import DefaultWafPolicyOperations # type: ignore +from ._operations import CertificatesOperations # type: ignore +from ._operations import ConfigurationsOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -26,12 +27,13 @@ __all__ = [ "Operations", - "DeploymentsOperations", + "NginxDeploymentWafPoliciesOperations", "ApiKeysOperations", + "DeploymentsOperations", + "WafPolicyOperations", + "DefaultWafPolicyOperations", "CertificatesOperations", "ConfigurationsOperations", - "DefaultWafPolicyOperations", - "WafPolicyOperations", ] __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 deleted file mode 100644 index 968a7e0cea4f..000000000000 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_api_keys_operations.py +++ /dev/null @@ -1,427 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, 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, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... 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 - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ApiKeysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.nginx.aio.NginxManagementClient`'s - :attr:`api_keys` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncItemPaged["_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( - self, - resource_group_name: str, - deployment_name: str, - api_key_name: str, - body: Optional[_models.NginxDeploymentApiKeyRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NginxDeploymentApiKeyResponse: - """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 - :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 - :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 - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NginxDeploymentApiKeyResponse or the result of cls(response) - :rtype: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - deployment_name: str, - api_key_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NginxDeploymentApiKeyResponse: - """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 - :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 - :param body: The API Key object containing fields (e.g. secret text, expiration date) to upsert - the key. Default value is None. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NginxDeploymentApiKeyResponse or the result of cls(response) - :rtype: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - deployment_name: str, - api_key_name: str, - body: Optional[Union[_models.NginxDeploymentApiKeyRequest, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.NginxDeploymentApiKeyResponse: - """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 - :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 - :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] - :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if body else None - cls: ClsType[_models.NginxDeploymentApiKeyResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "NginxDeploymentApiKeyRequest") - else: - _json = None - - _request = build_create_or_update_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, - content_type=content_type, - json=_json, - content=_content, - 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, 201]: - 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_async - async def delete(self, resource_group_name: str, deployment_name: str, api_key_name: str, **kwargs: Any) -> None: - """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 - :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: None or the result of cls(response) - :rtype: None - :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[None] = kwargs.pop("cls", None) - - _request = build_delete_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, 204]: - 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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore 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 deleted file mode 100644 index d9829f200ab2..000000000000 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,560 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._certificates_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) -from .._configuration import NginxManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.nginx.aio.NginxManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncItemPaged["_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( - self, resource_group_name: str, deployment_name: str, certificate_name: str, **kwargs: Any - ) -> _models.NginxCertificate: - """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 - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :param certificate_name: The name of certificate. Required. - :type certificate_name: str - :return: NginxCertificate or the result of cls(response) - :rtype: ~azure.mgmt.nginx.models.NginxCertificate - :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.NginxCertificate] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - certificate_name=certificate_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("NginxCertificate", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - deployment_name: str, - certificate_name: str, - body: Optional[Union[_models.NginxCertificate, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if body else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "NginxCertificate") - else: - _json = None - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["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, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - deployment_name: str, - certificate_name: str, - body: Optional[_models.NginxCertificate] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.NginxCertificate]: - """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 - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :param certificate_name: The name of certificate. Required. - :type certificate_name: str - :param body: The certificate. Default value is None. - :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". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either NginxCertificate or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxCertificate] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - deployment_name: str, - certificate_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.NginxCertificate]: - """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 - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :param certificate_name: The name of certificate. Required. - :type certificate_name: str - :param body: The certificate. Default value is None. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either NginxCertificate or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxCertificate] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - deployment_name: str, - certificate_name: str, - body: Optional[Union[_models.NginxCertificate, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.NginxCertificate]: - """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 - :param deployment_name: The name of targeted NGINX deployment. Required. - :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. - :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) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxCertificate] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if body else None - cls: ClsType[_models.NginxCertificate] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - certificate_name=certificate_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("NginxCertificate", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.NginxCertificate].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.NginxCertificate]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, deployment_name: str, certificate_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, deployment_name: str, certificate_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """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 - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :param certificate_name: The name of certificate. Required. - :type certificate_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - certificate_name=certificate_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore 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 deleted file mode 100644 index 9f63ad4022d0..000000000000 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_configurations_operations.py +++ /dev/null @@ -1,719 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._configurations_operations import ( - build_analysis_request, - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) -from .._configuration import NginxManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ConfigurationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.nginx.aio.NginxManagementClient`'s - :attr:`configurations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.NginxConfigurationResponse"]: - """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 - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :return: An iterator like instance of either NginxConfigurationResponse or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.nginx.models.NginxConfigurationResponse] - :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.NginxConfigurationListResponse] = 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("NginxConfigurationListResponse", 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, configuration_name: str, **kwargs: Any - ) -> _models.NginxConfigurationResponse: - """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 - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :param configuration_name: The name of configuration, only 'default' is supported value due to - the singleton of NGINX conf. Required. - :type configuration_name: str - :return: NginxConfigurationResponse or the result of cls(response) - :rtype: ~azure.mgmt.nginx.models.NginxConfigurationResponse - :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.NginxConfigurationResponse] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - configuration_name=configuration_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("NginxConfigurationResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - deployment_name: str, - configuration_name: str, - body: Optional[Union[_models.NginxConfigurationRequest, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if body else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "NginxConfigurationRequest") - else: - _json = None - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - configuration_name=configuration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["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, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - deployment_name: str, - configuration_name: str, - body: Optional[_models.NginxConfigurationRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.NginxConfigurationResponse]: - """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 - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :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 - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either NginxConfigurationResponse or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxConfigurationResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - deployment_name: str, - configuration_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.NginxConfigurationResponse]: - """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 - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :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: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either NginxConfigurationResponse or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxConfigurationResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - deployment_name: str, - configuration_name: str, - body: Optional[Union[_models.NginxConfigurationRequest, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.NginxConfigurationResponse]: - """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 - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :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] - :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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if body else None - cls: ClsType[_models.NginxConfigurationResponse] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - configuration_name=configuration_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("NginxConfigurationResponse", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.NginxConfigurationResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.NginxConfigurationResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, deployment_name: str, configuration_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - configuration_name=configuration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, deployment_name: str, configuration_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """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 - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :param configuration_name: The name of configuration, only 'default' is supported value due to - the singleton of NGINX conf. Required. - :type configuration_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - configuration_name=configuration_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - async def analysis( - self, - resource_group_name: str, - deployment_name: str, - configuration_name: str, - body: Optional[_models.AnalysisCreate] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AnalysisResult: - """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 - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :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 to analyze. Default value is None. - :type body: ~azure.mgmt.nginx.models.AnalysisCreate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AnalysisResult or the result of cls(response) - :rtype: ~azure.mgmt.nginx.models.AnalysisResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def analysis( - self, - resource_group_name: str, - deployment_name: str, - configuration_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AnalysisResult: - """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 - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :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 to analyze. Default value is None. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: AnalysisResult or the result of cls(response) - :rtype: ~azure.mgmt.nginx.models.AnalysisResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def analysis( - self, - resource_group_name: str, - deployment_name: str, - configuration_name: str, - body: Optional[Union[_models.AnalysisCreate, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.AnalysisResult: - """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 - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :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 to analyze. Is either a AnalysisCreate type or a IO[bytes] - type. Default value is None. - :type body: ~azure.mgmt.nginx.models.AnalysisCreate or IO[bytes] - :return: AnalysisResult or the result of cls(response) - :rtype: ~azure.mgmt.nginx.models.AnalysisResult - :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if body else None - cls: ClsType[_models.AnalysisResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "AnalysisCreate") - else: - _json = None - - _request = build_analysis_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - configuration_name=configuration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _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("AnalysisResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_default_waf_policy_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_default_waf_policy_operations.py deleted file mode 100644 index b4de3705aef2..000000000000 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_default_waf_policy_operations.py +++ /dev/null @@ -1,114 +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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._default_waf_policy_operations import build_list_request -from .._configuration import NginxManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class DefaultWafPolicyOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.nginx.aio.NginxManagementClient`'s - :attr:`default_waf_policy` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def list( - self, resource_group_name: str, deployment_name: str, **kwargs: Any - ) -> _models.NginxDeploymentDefaultWafPolicyListResponse: - """Get the Nginx Waf Policy of given Nginx deployment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :return: NginxDeploymentDefaultWafPolicyListResponse or the result of cls(response) - :rtype: ~azure.mgmt.nginx.models.NginxDeploymentDefaultWafPolicyListResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.NginxDeploymentDefaultWafPolicyListResponse] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("NginxDeploymentDefaultWafPolicyListResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_deployments_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_deployments_operations.py deleted file mode 100644 index e9f80c89d41c..000000000000 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_deployments_operations.py +++ /dev/null @@ -1,825 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._deployments_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_request, - build_update_request, -) -from .._configuration import NginxManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class DeploymentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.nginx.aio.NginxManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_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 - ) -> AsyncItemPaged["_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. - - :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: NginxDeployment or the result of cls(response) - :rtype: ~azure.mgmt.nginx.models.NginxDeployment - :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.NginxDeployment] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("NginxDeployment", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - deployment_name: str, - body: Optional[Union[_models.NginxDeployment, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if body else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "NginxDeployment") - else: - _json = None - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["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, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - deployment_name: str, - body: Optional[_models.NginxDeployment] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.NginxDeployment]: - """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: The Nginx deployment. Default value is None. - :type body: ~azure.mgmt.nginx.models.NginxDeployment - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either NginxDeployment or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxDeployment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - deployment_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.NginxDeployment]: - """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: The Nginx deployment. Default value is None. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either NginxDeployment or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxDeployment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - deployment_name: str, - body: Optional[Union[_models.NginxDeployment, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.NginxDeployment]: - """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: The Nginx deployment. Is either a NginxDeployment type or a IO[bytes] type. - Default value is None. - :type body: ~azure.mgmt.nginx.models.NginxDeployment or IO[bytes] - :return: An instance of AsyncLROPoller that returns either NginxDeployment or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxDeployment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if body else None - cls: ClsType[_models.NginxDeployment] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("NginxDeployment", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.NginxDeployment].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.NginxDeployment]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - deployment_name: str, - body: Optional[Union[_models.NginxDeploymentUpdateParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if body else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "NginxDeploymentUpdateParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - deployment_name: str, - body: Optional[_models.NginxDeploymentUpdateParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.NginxDeployment]: - """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: The Nginx deployment update parameters. Default value is None. - :type body: ~azure.mgmt.nginx.models.NginxDeploymentUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either NginxDeployment or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxDeployment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - deployment_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.NginxDeployment]: - """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: The Nginx deployment update parameters. Default value is None. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either NginxDeployment or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxDeployment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - deployment_name: str, - body: Optional[Union[_models.NginxDeploymentUpdateParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.NginxDeployment]: - """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: The Nginx deployment update parameters. Is either a - NginxDeploymentUpdateParameters type or a IO[bytes] type. Default value is None. - :type body: ~azure.mgmt.nginx.models.NginxDeploymentUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either NginxDeployment or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxDeployment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if body else None - cls: ClsType[_models.NginxDeployment] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("NginxDeployment", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.NginxDeployment].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.NginxDeployment]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete(self, resource_group_name: str, deployment_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """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 - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore 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 75514c04338c..d48735ca2204 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 @@ -1,12 +1,15 @@ +# pylint: disable=too-many-lines # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar +from io import IOBase +import json +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import AsyncPipelineClient @@ -17,21 +20,56 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from ..._utils.serialization import Deserializer, Serializer -from ...operations._operations import build_list_request +from ..._validation import api_version_validation +from ...operations._operations import ( + build_api_keys_create_or_update_request, + build_api_keys_delete_request, + build_api_keys_get_request, + build_api_keys_list_request, + build_certificates_create_or_update_request, + build_certificates_delete_request, + build_certificates_get_request, + build_certificates_list_request, + build_configurations_analysis_request, + build_configurations_create_or_update_request, + build_configurations_delete_request, + build_configurations_get_request, + build_configurations_list_request, + build_default_waf_policy_list_request, + build_deployments_create_or_update_request, + build_deployments_delete_request, + build_deployments_get_request, + build_deployments_list_by_resource_group_request, + build_deployments_list_request, + build_deployments_update_request, + build_nginx_deployment_waf_policies_analysis_request, + build_operations_list_request, + build_waf_policy_create_request, + build_waf_policy_delete_request, + build_waf_policy_get_request, + build_waf_policy_list_request, +) from .._configuration import NginxManagementClientConfiguration T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] List = list @@ -45,8 +83,6 @@ class Operations: :attr:`operations` attribute. """ - models = _models - def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") @@ -58,15 +94,689 @@ def __init__(self, *args, **kwargs) -> None: def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Operation"]: """List the operations for the provider. - :return: An iterator like instance of either Operation or the result of cls(response) + :return: An iterator like instance of Operation :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.nginx.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Operation]] = 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_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Operation], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class NginxDeploymentWafPoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.nginx.aio.NginxManagementClient`'s + :attr:`nginx_deployment_waf_policies` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def analysis( + self, + resource_group_name: str, + deployment_name: str, + waf_policy_name: str, + body: Optional[_models.NginxDeploymentWafPolicyAnalysisCreateRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NginxDeploymentWafPolicyAnalysisResponse: + """Analyze an Nginx Waf Policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param waf_policy_name: The name of Waf Policy. Required. + :type waf_policy_name: str + :param body: The content of the action request. Default value is None. + :type body: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyAnalysisCreateRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: NginxDeploymentWafPolicyAnalysisResponse. The NginxDeploymentWafPolicyAnalysisResponse + is compatible with MutableMapping + :rtype: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyAnalysisResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def analysis( + self, + resource_group_name: str, + deployment_name: str, + waf_policy_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NginxDeploymentWafPolicyAnalysisResponse: + """Analyze an Nginx Waf Policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param waf_policy_name: The name of Waf Policy. Required. + :type waf_policy_name: str + :param body: The content of the action request. Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: NginxDeploymentWafPolicyAnalysisResponse. The NginxDeploymentWafPolicyAnalysisResponse + is compatible with MutableMapping + :rtype: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyAnalysisResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def analysis( + self, + resource_group_name: str, + deployment_name: str, + waf_policy_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NginxDeploymentWafPolicyAnalysisResponse: + """Analyze an Nginx Waf Policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param waf_policy_name: The name of Waf Policy. Required. + :type waf_policy_name: str + :param body: The content of the action request. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: NginxDeploymentWafPolicyAnalysisResponse. The NginxDeploymentWafPolicyAnalysisResponse + is compatible with MutableMapping + :rtype: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyAnalysisResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2025-11-01", + params_added_on={ + "2025-11-01": [ + "api_version", + "subscription_id", + "resource_group_name", + "deployment_name", + "waf_policy_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2025-11-01"], + ) + async def analysis( + self, + resource_group_name: str, + deployment_name: str, + waf_policy_name: str, + body: Optional[Union[_models.NginxDeploymentWafPolicyAnalysisCreateRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.NginxDeploymentWafPolicyAnalysisResponse: + """Analyze an Nginx Waf Policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param waf_policy_name: The name of Waf Policy. Required. + :type waf_policy_name: str + :param body: The content of the action request. Is one of the following types: + NginxDeploymentWafPolicyAnalysisCreateRequest, JSON, IO[bytes] Default value is None. + :type body: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyAnalysisCreateRequest or JSON or + IO[bytes] + :return: NginxDeploymentWafPolicyAnalysisResponse. The NginxDeploymentWafPolicyAnalysisResponse + is compatible with MutableMapping + :rtype: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyAnalysisResponse + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None + cls: ClsType[_models.NginxDeploymentWafPolicyAnalysisResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_nginx_deployment_waf_policies_analysis_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + waf_policy_name=waf_policy_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NginxDeploymentWafPolicyAnalysisResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ApiKeysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.nginx.aio.NginxManagementClient`'s + :attr:`api_keys` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, deployment_name: str, 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. The NginxDeploymentApiKeyResponse is compatible with + MutableMapping + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.NginxDeploymentApiKeyResponse] = kwargs.pop("cls", None) + + _request = build_api_keys_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NginxDeploymentApiKeyResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + deployment_name: str, + api_key_name: str, + body: Optional[_models.NginxDeploymentApiKeyRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NginxDeploymentApiKeyResponse: + """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 + :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 + :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 + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: NginxDeploymentApiKeyResponse. The NginxDeploymentApiKeyResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + deployment_name: str, + api_key_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NginxDeploymentApiKeyResponse: + """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 + :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 + :param body: The API Key object containing fields (e.g. secret text, expiration date) to upsert + the key. Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: NginxDeploymentApiKeyResponse. The NginxDeploymentApiKeyResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + deployment_name: str, + api_key_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NginxDeploymentApiKeyResponse: + """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 + :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 + :param body: The API Key object containing fields (e.g. secret text, expiration date) to upsert + the key. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: NginxDeploymentApiKeyResponse. The NginxDeploymentApiKeyResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + deployment_name: str, + api_key_name: str, + body: Optional[Union[_models.NginxDeploymentApiKeyRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.NginxDeploymentApiKeyResponse: + """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 + :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 + :param body: The API Key object containing fields (e.g. secret text, expiration date) to upsert + the key. Is one of the following types: NginxDeploymentApiKeyRequest, JSON, IO[bytes] Default + value is None. + :type body: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyRequest or JSON or IO[bytes] + :return: NginxDeploymentApiKeyResponse. The NginxDeploymentApiKeyResponse is compatible with + MutableMapping + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None + cls: ClsType[_models.NginxDeploymentApiKeyResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_api_keys_create_or_update_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + api_key_name=api_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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, 201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NginxDeploymentApiKeyResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, resource_group_name: str, deployment_name: str, api_key_name: str, **kwargs: Any) -> None: + """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 + :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: None + :rtype: None + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_api_keys_delete_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, deployment_name: str, **kwargs: Any + ) -> AsyncItemPaged["_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 NginxDeploymentApiKeyResponse + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.NginxDeploymentApiKeyResponse]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -79,12 +789,20 @@ def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - _request = build_list_request( - api_version=api_version, + _request = build_api_keys_list_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -99,16 +817,24 @@ def prepare_request(next_link=None): _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" + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.NginxDeploymentApiKeyResponse], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) async def get_next(next_link=None): _request = prepare_request(next_link) @@ -121,12 +847,2895 @@ async def get_next(next_link=None): 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( + error = _failsafe_deserialize( _models.ErrorResponse, - pipeline_response, + response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged(get_next, extract_data) + + +class DeploymentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.nginx.aio.NginxManagementClient`'s + :attr:`deployments` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, resource_group_name: str, deployment_name: str, **kwargs: Any) -> _models.NginxDeployment: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :return: NginxDeployment. The NginxDeployment is compatible with MutableMapping + :rtype: ~azure.mgmt.nginx.models.NginxDeployment + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.NginxDeployment] = kwargs.pop("cls", None) + + _request = build_deployments_get_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NginxDeployment, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + deployment_name: str, + body: Optional[Union[_models.NginxDeployment, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_deployments_create_or_update_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + 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.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + body: Optional[_models.NginxDeployment] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NginxDeployment]: + """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: The Nginx deployment. Default value is None. + :type body: ~azure.mgmt.nginx.models.NginxDeployment + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns NginxDeployment. The NginxDeployment is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxDeployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NginxDeployment]: + """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: The Nginx deployment. Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns NginxDeployment. The NginxDeployment is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxDeployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NginxDeployment]: + """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: The Nginx deployment. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns NginxDeployment. The NginxDeployment is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxDeployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + body: Optional[Union[_models.NginxDeployment, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.NginxDeployment]: + """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: The Nginx deployment. Is one of the following types: NginxDeployment, JSON, + IO[bytes] Default value is None. + :type body: ~azure.mgmt.nginx.models.NginxDeployment or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns NginxDeployment. The NginxDeployment is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxDeployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None + cls: ClsType[_models.NginxDeployment] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.NginxDeployment, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.NginxDeployment].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.NginxDeployment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + deployment_name: str, + body: Optional[Union[_models.NginxDeploymentUpdateParameters, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_deployments_update_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + 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.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + deployment_name: str, + body: Optional[_models.NginxDeploymentUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NginxDeployment]: + """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: The Nginx deployment update parameters. Default value is None. + :type body: ~azure.mgmt.nginx.models.NginxDeploymentUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns NginxDeployment. The NginxDeployment is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxDeployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + deployment_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NginxDeployment]: + """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: The Nginx deployment update parameters. Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns NginxDeployment. The NginxDeployment is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxDeployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + deployment_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NginxDeployment]: + """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: The Nginx deployment update parameters. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns NginxDeployment. The NginxDeployment is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxDeployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + deployment_name: str, + body: Optional[Union[_models.NginxDeploymentUpdateParameters, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.NginxDeployment]: + """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: The Nginx deployment update parameters. Is one of the following types: + NginxDeploymentUpdateParameters, JSON, IO[bytes] Default value is None. + :type body: ~azure.mgmt.nginx.models.NginxDeploymentUpdateParameters or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns NginxDeployment. The NginxDeployment is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxDeployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None + cls: ClsType[_models.NginxDeployment] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.NginxDeployment, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.NginxDeployment].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.NginxDeployment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, deployment_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_deployments_delete_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + 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.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, deployment_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_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 NginxDeployment + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.nginx.models.NginxDeployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.NginxDeployment]] = 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_deployments_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.NginxDeployment], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.NginxDeployment"]: + """List the NGINX deployments resources. + + :return: An iterator like instance of NginxDeployment + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.nginx.models.NginxDeployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.NginxDeployment]] = 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_deployments_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.NginxDeployment], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class WafPolicyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.nginx.aio.NginxManagementClient`'s + :attr:`waf_policy` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, deployment_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.NginxDeploymentWafPolicyMetadata"]: + """List Waf Policies of given Nginx deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :return: An iterator like instance of NginxDeploymentWafPolicyMetadata + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.nginx.models.NginxDeploymentWafPolicyMetadata] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.NginxDeploymentWafPolicyMetadata]] = 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_waf_policy_list_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.NginxDeploymentWafPolicyMetadata], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + 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, waf_policy_name: str, **kwargs: Any + ) -> _models.NginxDeploymentWafPolicy: + """Get the Nginx Waf Policy of given Nginx deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param waf_policy_name: The name of Waf Policy. Required. + :type waf_policy_name: str + :return: NginxDeploymentWafPolicy. The NginxDeploymentWafPolicy is compatible with + MutableMapping + :rtype: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.NginxDeploymentWafPolicy] = kwargs.pop("cls", None) + + _request = build_waf_policy_get_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + waf_policy_name=waf_policy_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NginxDeploymentWafPolicy, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + deployment_name: str, + waf_policy_name: str, + body: Optional[Union[_models.NginxDeploymentWafPolicy, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_waf_policy_create_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + waf_policy_name=waf_policy_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + 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["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + deployment_name: str, + waf_policy_name: str, + body: Optional[_models.NginxDeploymentWafPolicy] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NginxDeploymentWafPolicy]: + """Create or update the Nginx Waf Policy for given Nginx deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param waf_policy_name: The name of Waf Policy. Required. + :type waf_policy_name: str + :param body: Resource create parameters. Default value is None. + :type body: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns NginxDeploymentWafPolicy. The + NginxDeploymentWafPolicy is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxDeploymentWafPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + deployment_name: str, + waf_policy_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NginxDeploymentWafPolicy]: + """Create or update the Nginx Waf Policy for given Nginx deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param waf_policy_name: The name of Waf Policy. Required. + :type waf_policy_name: str + :param body: Resource create parameters. Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns NginxDeploymentWafPolicy. The + NginxDeploymentWafPolicy is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxDeploymentWafPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + deployment_name: str, + waf_policy_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NginxDeploymentWafPolicy]: + """Create or update the Nginx Waf Policy for given Nginx deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param waf_policy_name: The name of Waf Policy. Required. + :type waf_policy_name: str + :param body: Resource create parameters. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns NginxDeploymentWafPolicy. The + NginxDeploymentWafPolicy is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxDeploymentWafPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + deployment_name: str, + waf_policy_name: str, + body: Optional[Union[_models.NginxDeploymentWafPolicy, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.NginxDeploymentWafPolicy]: + """Create or update the Nginx Waf Policy for given Nginx deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param waf_policy_name: The name of Waf Policy. Required. + :type waf_policy_name: str + :param body: Resource create parameters. Is one of the following types: + NginxDeploymentWafPolicy, JSON, IO[bytes] Default value is None. + :type body: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicy or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns NginxDeploymentWafPolicy. The + NginxDeploymentWafPolicy is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxDeploymentWafPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None + cls: ClsType[_models.NginxDeploymentWafPolicy] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + waf_policy_name=waf_policy_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.NginxDeploymentWafPolicy, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.NginxDeploymentWafPolicy].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.NginxDeploymentWafPolicy]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, deployment_name: str, waf_policy_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_waf_policy_delete_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + waf_policy_name=waf_policy_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + 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.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, deployment_name: str, waf_policy_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Nginx Waf Policy of given Nginx deployment to default. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param waf_policy_name: The name of Waf Policy. Required. + :type waf_policy_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + waf_policy_name=waf_policy_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class DefaultWafPolicyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.nginx.aio.NginxManagementClient`'s + :attr:`default_waf_policy` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def list( + self, resource_group_name: str, deployment_name: str, **kwargs: Any + ) -> _models.NginxDeploymentDefaultWafPolicyListResponse: + """Get the Nginx Waf Policy of given Nginx deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :return: NginxDeploymentDefaultWafPolicyListResponse. The + NginxDeploymentDefaultWafPolicyListResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.nginx.models.NginxDeploymentDefaultWafPolicyListResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.NginxDeploymentDefaultWafPolicyListResponse] = kwargs.pop("cls", None) + + _request = build_default_waf_policy_list_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NginxDeploymentDefaultWafPolicyListResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class CertificatesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.nginx.aio.NginxManagementClient`'s + :attr:`certificates` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, deployment_name: str, certificate_name: str, **kwargs: Any + ) -> _models.NginxCertificate: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :return: NginxCertificate. The NginxCertificate is compatible with MutableMapping + :rtype: ~azure.mgmt.nginx.models.NginxCertificate + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.NginxCertificate] = kwargs.pop("cls", None) + + _request = build_certificates_get_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NginxCertificate, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + deployment_name: str, + certificate_name: str, + body: Optional[Union[_models.NginxCertificate, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_certificates_create_or_update_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + 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.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + certificate_name: str, + body: Optional[_models.NginxCertificate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NginxCertificate]: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :param body: The certificate. Default value is None. + :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". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns NginxCertificate. The NginxCertificate is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxCertificate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + certificate_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NginxCertificate]: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :param body: The certificate. Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns NginxCertificate. The NginxCertificate is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxCertificate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + certificate_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NginxCertificate]: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :param body: The certificate. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns NginxCertificate. The NginxCertificate is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxCertificate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + certificate_name: str, + body: Optional[Union[_models.NginxCertificate, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.NginxCertificate]: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :param body: The certificate. Is one of the following types: NginxCertificate, JSON, IO[bytes] + Default value is None. + :type body: ~azure.mgmt.nginx.models.NginxCertificate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns NginxCertificate. The NginxCertificate is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxCertificate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None + cls: ClsType[_models.NginxCertificate] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + certificate_name=certificate_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.NginxCertificate, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.NginxCertificate].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.NginxCertificate]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, deployment_name: str, certificate_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_certificates_delete_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + 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.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, deployment_name: str, certificate_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + certificate_name=certificate_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, deployment_name: str, **kwargs: Any + ) -> AsyncItemPaged["_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 NginxCertificate + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.nginx.models.NginxCertificate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.NginxCertificate]] = 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_certificates_list_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.NginxCertificate], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.nginx.aio.NginxManagementClient`'s + :attr:`configurations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, deployment_name: str, configuration_name: str, **kwargs: Any + ) -> _models.NginxConfigurationResponse: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param configuration_name: The name of configuration, only 'default' is supported value due to + the singleton of NGINX conf. Required. + :type configuration_name: str + :return: NginxConfigurationResponse. The NginxConfigurationResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.nginx.models.NginxConfigurationResponse + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.NginxConfigurationResponse] = kwargs.pop("cls", None) + + _request = build_configurations_get_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NginxConfigurationResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + deployment_name: str, + configuration_name: str, + body: Optional[Union[_models.NginxConfigurationRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_configurations_create_or_update_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + 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.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + configuration_name: str, + body: Optional[_models.NginxConfigurationRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NginxConfigurationResponse]: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :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 + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns NginxConfigurationResponse. The + NginxConfigurationResponse is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxConfigurationResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + configuration_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NginxConfigurationResponse]: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns NginxConfigurationResponse. The + NginxConfigurationResponse is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxConfigurationResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + configuration_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NginxConfigurationResponse]: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :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: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns NginxConfigurationResponse. The + NginxConfigurationResponse is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxConfigurationResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + configuration_name: str, + body: Optional[Union[_models.NginxConfigurationRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.NginxConfigurationResponse]: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :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 one of the following types: NginxConfigurationRequest, + JSON, IO[bytes] Default value is None. + :type body: ~azure.mgmt.nginx.models.NginxConfigurationRequest or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns NginxConfigurationResponse. The + NginxConfigurationResponse is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxConfigurationResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None + cls: ClsType[_models.NginxConfigurationResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + configuration_name=configuration_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.NginxConfigurationResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.NginxConfigurationResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.NginxConfigurationResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, deployment_name: str, configuration_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_configurations_delete_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + 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.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, deployment_name: str, configuration_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param configuration_name: The name of configuration, only 'default' is supported value due to + the singleton of NGINX conf. Required. + :type configuration_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + configuration_name=configuration_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, deployment_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.NginxConfigurationResponse"]: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :return: An iterator like instance of NginxConfigurationResponse + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.nginx.models.NginxConfigurationResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.NginxConfigurationResponse]] = 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_configurations_list_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.NginxConfigurationResponse], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @overload + async def analysis( + self, + resource_group_name: str, + deployment_name: str, + configuration_name: str, + body: Optional[_models.AnalysisCreate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AnalysisResult: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :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 to analyze. Default value is None. + :type body: ~azure.mgmt.nginx.models.AnalysisCreate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AnalysisResult. The AnalysisResult is compatible with MutableMapping + :rtype: ~azure.mgmt.nginx.models.AnalysisResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def analysis( + self, + resource_group_name: str, + deployment_name: str, + configuration_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AnalysisResult: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :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 to analyze. Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AnalysisResult. The AnalysisResult is compatible with MutableMapping + :rtype: ~azure.mgmt.nginx.models.AnalysisResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def analysis( + self, + resource_group_name: str, + deployment_name: str, + configuration_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AnalysisResult: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :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 to analyze. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AnalysisResult. The AnalysisResult is compatible with MutableMapping + :rtype: ~azure.mgmt.nginx.models.AnalysisResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def analysis( + self, + resource_group_name: str, + deployment_name: str, + configuration_name: str, + body: Optional[Union[_models.AnalysisCreate, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.AnalysisResult: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :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 to analyze. Is one of the following types: AnalysisCreate, + JSON, IO[bytes] Default value is None. + :type body: ~azure.mgmt.nginx.models.AnalysisCreate or JSON or IO[bytes] + :return: AnalysisResult. The AnalysisResult is compatible with MutableMapping + :rtype: ~azure.mgmt.nginx.models.AnalysisResult + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None + cls: ClsType[_models.AnalysisResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_configurations_analysis_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AnalysisResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_waf_policy_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_waf_policy_operations.py deleted file mode 100644 index a16b80dd45a7..000000000000 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_waf_policy_operations.py +++ /dev/null @@ -1,563 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._waf_policy_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_request, -) -from .._configuration import NginxManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class WafPolicyOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.nginx.aio.NginxManagementClient`'s - :attr:`waf_policy` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.NginxDeploymentWafPolicyMetadata"]: - """List Waf Policies of given Nginx deployment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :return: An iterator like instance of either NginxDeploymentWafPolicyMetadata or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.nginx.models.NginxDeploymentWafPolicyMetadata] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.NginxDeploymentWafPolicyListResponse] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("NginxDeploymentWafPolicyListResponse", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, deployment_name: str, waf_policy_name: str, **kwargs: Any - ) -> _models.NginxDeploymentWafPolicy: - """Get the Nginx Waf Policy of given Nginx deployment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :param waf_policy_name: The name of Waf Policy. Required. - :type waf_policy_name: str - :return: NginxDeploymentWafPolicy or the result of cls(response) - :rtype: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicy - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.NginxDeploymentWafPolicy] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - waf_policy_name=waf_policy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("NginxDeploymentWafPolicy", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - resource_group_name: str, - deployment_name: str, - waf_policy_name: str, - body: Optional[Union[_models.NginxDeploymentWafPolicy, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if body else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "NginxDeploymentWafPolicy") - else: - _json = None - - _request = build_create_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - waf_policy_name=waf_policy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - 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, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - resource_group_name: str, - deployment_name: str, - waf_policy_name: str, - body: Optional[_models.NginxDeploymentWafPolicy] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.NginxDeploymentWafPolicy]: - """Create or update the Nginx Waf Policy for given Nginx deployment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :param waf_policy_name: The name of Waf Policy. Required. - :type waf_policy_name: str - :param body: The Nginx Deployment Waf Policy. Default value is None. - :type body: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicy - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either NginxDeploymentWafPolicy or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxDeploymentWafPolicy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - deployment_name: str, - waf_policy_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.NginxDeploymentWafPolicy]: - """Create or update the Nginx Waf Policy for given Nginx deployment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :param waf_policy_name: The name of Waf Policy. Required. - :type waf_policy_name: str - :param body: The Nginx Deployment Waf Policy. Default value is None. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either NginxDeploymentWafPolicy or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxDeploymentWafPolicy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - deployment_name: str, - waf_policy_name: str, - body: Optional[Union[_models.NginxDeploymentWafPolicy, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.NginxDeploymentWafPolicy]: - """Create or update the Nginx Waf Policy for given Nginx deployment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :param waf_policy_name: The name of Waf Policy. Required. - :type waf_policy_name: str - :param body: The Nginx Deployment Waf Policy. Is either a NginxDeploymentWafPolicy type or a - IO[bytes] type. Default value is None. - :type body: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicy or IO[bytes] - :return: An instance of AsyncLROPoller that returns either NginxDeploymentWafPolicy or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.nginx.models.NginxDeploymentWafPolicy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if body else None - cls: ClsType[_models.NginxDeploymentWafPolicy] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_initial( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - waf_policy_name=waf_policy_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("NginxDeploymentWafPolicy", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.NginxDeploymentWafPolicy].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.NginxDeploymentWafPolicy]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, deployment_name: str, waf_policy_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - waf_policy_name=waf_policy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, deployment_name: str, waf_policy_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Reset the Nginx Waf Policy of given Nginx deployment to default. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :param waf_policy_name: The name of Waf Policy. Required. - :type waf_policy_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - waf_policy_name=waf_policy_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore 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 cdadaaa31762..46513360b0e1 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -13,10 +13,12 @@ from ._patch import * # pylint: disable=unused-wildcard-import -from ._models_py3 import ( # type: ignore +from ._models import ( # type: ignore AnalysisCreate, + AnalysisCreateConfig, AnalysisDiagnostic, AnalysisResult, + AnalysisResultData, AutoUpgradeProfile, DiagnosticItem, ErrorAdditionalInfo, @@ -25,10 +27,8 @@ IdentityProperties, NginxCertificate, NginxCertificateErrorResponseBody, - NginxCertificateListResponse, NginxCertificateProperties, NginxConfigurationFile, - NginxConfigurationListResponse, NginxConfigurationPackage, NginxConfigurationProtectedFileRequest, NginxConfigurationProtectedFileResponse, @@ -37,23 +37,27 @@ NginxConfigurationResponse, NginxConfigurationResponseProperties, NginxDeployment, - NginxDeploymentApiKeyListResponse, NginxDeploymentApiKeyRequest, NginxDeploymentApiKeyRequestProperties, NginxDeploymentApiKeyResponse, NginxDeploymentApiKeyResponseProperties, NginxDeploymentDefaultWafPolicyListResponse, NginxDeploymentDefaultWafPolicyProperties, - NginxDeploymentListResponse, NginxDeploymentProperties, + NginxDeploymentPropertiesNginxAppProtect, NginxDeploymentScalingProperties, + NginxDeploymentScalingPropertiesAutoScaleSettings, NginxDeploymentUpdateParameters, NginxDeploymentUpdateProperties, + NginxDeploymentUpdatePropertiesNginxAppProtect, NginxDeploymentUserProfile, NginxDeploymentWafPolicy, + NginxDeploymentWafPolicyAnalysisCreateRequest, + NginxDeploymentWafPolicyAnalysisData, + NginxDeploymentWafPolicyAnalysisResponse, NginxDeploymentWafPolicyApplyingStatus, NginxDeploymentWafPolicyCompilingStatus, - NginxDeploymentWafPolicyListResponse, + NginxDeploymentWafPolicyError, NginxDeploymentWafPolicyMetadata, NginxDeploymentWafPolicyMetadataProperties, NginxDeploymentWafPolicyProperties, @@ -66,11 +70,11 @@ NginxStorageAccount, Operation, OperationDisplay, - OperationListResult, ProxyResource, Resource, ResourceSku, ScaleProfile, + ScaleProfileCapacity, SystemData, TrackedResource, UserIdentityProperties, @@ -80,7 +84,7 @@ WebApplicationFirewallStatus, ) -from ._nginx_management_client_enums import ( # type: ignore +from ._enums import ( # type: ignore ActionType, ActivationState, CreatedByType, @@ -98,8 +102,10 @@ __all__ = [ "AnalysisCreate", + "AnalysisCreateConfig", "AnalysisDiagnostic", "AnalysisResult", + "AnalysisResultData", "AutoUpgradeProfile", "DiagnosticItem", "ErrorAdditionalInfo", @@ -108,10 +114,8 @@ "IdentityProperties", "NginxCertificate", "NginxCertificateErrorResponseBody", - "NginxCertificateListResponse", "NginxCertificateProperties", "NginxConfigurationFile", - "NginxConfigurationListResponse", "NginxConfigurationPackage", "NginxConfigurationProtectedFileRequest", "NginxConfigurationProtectedFileResponse", @@ -120,23 +124,27 @@ "NginxConfigurationResponse", "NginxConfigurationResponseProperties", "NginxDeployment", - "NginxDeploymentApiKeyListResponse", "NginxDeploymentApiKeyRequest", "NginxDeploymentApiKeyRequestProperties", "NginxDeploymentApiKeyResponse", "NginxDeploymentApiKeyResponseProperties", "NginxDeploymentDefaultWafPolicyListResponse", "NginxDeploymentDefaultWafPolicyProperties", - "NginxDeploymentListResponse", "NginxDeploymentProperties", + "NginxDeploymentPropertiesNginxAppProtect", "NginxDeploymentScalingProperties", + "NginxDeploymentScalingPropertiesAutoScaleSettings", "NginxDeploymentUpdateParameters", "NginxDeploymentUpdateProperties", + "NginxDeploymentUpdatePropertiesNginxAppProtect", "NginxDeploymentUserProfile", "NginxDeploymentWafPolicy", + "NginxDeploymentWafPolicyAnalysisCreateRequest", + "NginxDeploymentWafPolicyAnalysisData", + "NginxDeploymentWafPolicyAnalysisResponse", "NginxDeploymentWafPolicyApplyingStatus", "NginxDeploymentWafPolicyCompilingStatus", - "NginxDeploymentWafPolicyListResponse", + "NginxDeploymentWafPolicyError", "NginxDeploymentWafPolicyMetadata", "NginxDeploymentWafPolicyMetadataProperties", "NginxDeploymentWafPolicyProperties", @@ -149,11 +157,11 @@ "NginxStorageAccount", "Operation", "OperationDisplay", - "OperationListResult", "ProxyResource", "Resource", "ResourceSku", "ScaleProfile", + "ScaleProfileCapacity", "SystemData", "TrackedResource", "UserIdentityProperties", 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/_enums.py similarity index 74% rename from sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/_nginx_management_client_enums.py rename to sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/_enums.py index 30340d9c0ce6..4d58d17e3cdc 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/_enums.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -11,41 +11,56 @@ class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" + """Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal + only APIs. + """ INTERNAL = "Internal" + """Actions are for internal-only APIs.""" class ActivationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The activation state of the WAF. Use 'Enabled' to enable the WAF and 'Disabled' to disable it.""" ENABLED = "Enabled" + """ENABLED.""" DISABLED = "Disabled" + """DISABLED.""" class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" + """The kind of entity that created the resource.""" USER = "User" + """The entity was created by a user.""" APPLICATION = "Application" + """The entity was created by an application.""" MANAGED_IDENTITY = "ManagedIdentity" + """The entity was created by a managed identity.""" KEY = "Key" + """The entity was created by a key.""" class IdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Identity Type.""" SYSTEM_ASSIGNED = "SystemAssigned" + """SYSTEM_ASSIGNED.""" USER_ASSIGNED = "UserAssigned" + """USER_ASSIGNED.""" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + """SYSTEM_ASSIGNED_USER_ASSIGNED.""" NONE = "None" + """NONE.""" class Level(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Warning or Info.""" INFO = "Info" + """INFO.""" WARNING = "Warning" + """WARNING.""" class NginxDeploymentWafPolicyApplyingStatusCode( # pylint: disable=name-too-long @@ -72,9 +87,9 @@ class NginxDeploymentWafPolicyCompilingStatusCode( # pylint: disable=name-too-l """Machine readable code indicating the compilation status of a WAF Policy.""" NOT_STARTED = "NotStarted" - """The compilation of the custom waf policy has not started""" + """The compilation of the custom waf policy has not started.""" IN_PROGRESS = "InProgress" - """The compilation of the custom waf policy is in progress""" + """The compilation of the custom waf policy is in progress.""" SUCCEEDED = "Succeeded" """The compilation of the custom waf policy is completed successfully and can now be referenced in the nginx config.""" @@ -86,7 +101,9 @@ class NginxPrivateIPAllocationMethod(str, Enum, metaclass=CaseInsensitiveEnumMet """Nginx Private IP Allocation Method.""" STATIC = "Static" + """STATIC.""" DYNAMIC = "Dynamic" + """DYNAMIC.""" class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -95,19 +112,31 @@ class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ USER = "user" + """Indicates the operation is initiated by a user.""" SYSTEM = "system" + """Indicates the operation is initiated by a system.""" USER_SYSTEM = "user,system" + """Indicates the operation is initiated by a user or system.""" class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning State.""" ACCEPTED = "Accepted" + """ACCEPTED.""" CREATING = "Creating" + """CREATING.""" UPDATING = "Updating" + """UPDATING.""" DELETING = "Deleting" + """DELETING.""" SUCCEEDED = "Succeeded" + """SUCCEEDED.""" FAILED = "Failed" + """FAILED.""" CANCELED = "Canceled" + """CANCELED.""" DELETED = "Deleted" + """DELETED.""" NOT_SPECIFIED = "NotSpecified" + """NOT_SPECIFIED.""" diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/_models.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/_models.py new file mode 100644 index 000000000000..b3952d2dbaa5 --- /dev/null +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/_models.py @@ -0,0 +1,2705 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=useless-super-delegation + +import datetime +from typing import Any, Mapping, Optional, TYPE_CHECKING, Union, overload + +from .._utils.model_base import Model as _Model, rest_field + +if TYPE_CHECKING: + from .. import models as _models + + +class AnalysisCreate(_Model): + """The request body for creating an analysis for an NGINX configuration. + + :ivar config: Required. + :vartype config: ~azure.mgmt.nginx.models.AnalysisCreateConfig + """ + + config: "_models.AnalysisCreateConfig" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + + @overload + def __init__( + self, + *, + config: "_models.AnalysisCreateConfig", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AnalysisCreateConfig(_Model): + """AnalysisCreateConfig. + + :ivar root_file: The root file of the NGINX config file(s). It must match one of the files' + filepath. + :vartype root_file: str + :ivar files: + :vartype files: list[~azure.mgmt.nginx.models.NginxConfigurationFile] + :ivar protected_files: + :vartype protected_files: list[~azure.mgmt.nginx.models.NginxConfigurationProtectedFileRequest] + :ivar package: Nginx Configuration Package. + :vartype package: ~azure.mgmt.nginx.models.NginxConfigurationPackage + """ + + root_file: Optional[str] = rest_field(name="rootFile", visibility=["read", "create", "update", "delete", "query"]) + """The root file of the NGINX config file(s). It must match one of the files' filepath.""" + files: Optional[list["_models.NginxConfigurationFile"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + protected_files: Optional[list["_models.NginxConfigurationProtectedFileRequest"]] = rest_field( + name="protectedFiles", visibility=["read", "create", "update", "delete", "query"] + ) + package: Optional["_models.NginxConfigurationPackage"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Nginx Configuration Package.""" + + @overload + def __init__( + self, + *, + root_file: Optional[str] = None, + files: Optional[list["_models.NginxConfigurationFile"]] = None, + protected_files: Optional[list["_models.NginxConfigurationProtectedFileRequest"]] = None, + package: Optional["_models.NginxConfigurationPackage"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AnalysisDiagnostic(_Model): + """An error object found during the analysis of an NGINX configuration. + + :ivar id: Unique identifier for the error. + :vartype id: str + :ivar directive: Required. + :vartype directive: str + :ivar description: Required. + :vartype description: str + :ivar file: the filepath of the most relevant config file. Required. + :vartype file: str + :ivar line: Required. + :vartype line: float + :ivar message: Required. + :vartype message: str + :ivar rule: Required. + :vartype rule: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Unique identifier for the error.""" + directive: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + description: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + file: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """the filepath of the most relevant config file. Required.""" + line: float = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + message: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + rule: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + + @overload + def __init__( + self, + *, + directive: str, + description: str, + file: str, + line: float, + message: str, + rule: str, + id: Optional[str] = None, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AnalysisResult(_Model): + """The response body for an analysis request. Contains the status of the analysis and any errors. + + :ivar status: The status of the analysis. Required. + :vartype status: str + :ivar data: + :vartype data: ~azure.mgmt.nginx.models.AnalysisResultData + """ + + status: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The status of the analysis. Required.""" + data: Optional["_models.AnalysisResultData"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + + @overload + def __init__( + self, + *, + status: str, + data: Optional["_models.AnalysisResultData"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AnalysisResultData(_Model): + """AnalysisResultData. + + :ivar errors: + :vartype errors: list[~azure.mgmt.nginx.models.AnalysisDiagnostic] + :ivar diagnostics: + :vartype diagnostics: list[~azure.mgmt.nginx.models.DiagnosticItem] + """ + + errors: Optional[list["_models.AnalysisDiagnostic"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + diagnostics: Optional[list["_models.DiagnosticItem"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + + @overload + def __init__( + self, + *, + errors: Optional[list["_models.AnalysisDiagnostic"]] = None, + diagnostics: Optional[list["_models.DiagnosticItem"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AutoUpgradeProfile(_Model): + """Autoupgrade settings of a deployment. + + :ivar upgrade_channel: Channel used for autoupgrade. Required. + :vartype upgrade_channel: str + """ + + upgrade_channel: str = rest_field(name="upgradeChannel", visibility=["read", "create", "update", "delete", "query"]) + """Channel used for autoupgrade. Required.""" + + @overload + def __init__( + self, + *, + upgrade_channel: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DiagnosticItem(_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. + + :ivar id: Unique identifier for the diagnostic. + :vartype id: str + :ivar directive: Required. + :vartype directive: str + :ivar description: Required. + :vartype description: str + :ivar file: The filepath of the most relevant config file. Required. + :vartype file: str + :ivar line: Required. + :vartype line: float + :ivar message: Required. + :vartype message: str + :ivar rule: Required. + :vartype rule: str + :ivar level: Warning or Info. Required. Known values are: "Info" and "Warning". + :vartype level: str or ~azure.mgmt.nginx.models.Level + :ivar category: Category of warning like Best-practices, Recommendation, Security etc. + :vartype category: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Unique identifier for the diagnostic.""" + directive: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + description: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + file: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The filepath of the most relevant config file. Required.""" + line: float = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + message: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + rule: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + level: Union[str, "_models.Level"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Warning or Info. Required. Known values are: \"Info\" and \"Warning\".""" + category: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Category of warning like Best-practices, Recommendation, Security etc.""" + + @overload + def __init__( + self, + *, + directive: str, + description: str, + file: str, + line: float, + message: str, + rule: str, + level: Union[str, "_models.Level"], + id: Optional[str] = None, # pylint: disable=redefined-builtin + category: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ErrorAdditionalInfo(_Model): + """The resource management error additional info. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + type: Optional[str] = rest_field(visibility=["read"]) + """The additional info type.""" + info: Optional[Any] = rest_field(visibility=["read"]) + """The additional info.""" + + +class ErrorDetail(_Model): + """The error detail. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.nginx.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.nginx.models.ErrorAdditionalInfo] + """ + + code: Optional[str] = rest_field(visibility=["read"]) + """The error code.""" + message: Optional[str] = rest_field(visibility=["read"]) + """The error message.""" + target: Optional[str] = rest_field(visibility=["read"]) + """The error target.""" + details: Optional[list["_models.ErrorDetail"]] = rest_field(visibility=["read"]) + """The error details.""" + additional_info: Optional[list["_models.ErrorAdditionalInfo"]] = rest_field( + name="additionalInfo", visibility=["read"] + ) + """The error additional info.""" + + +class ErrorResponse(_Model): + """Error response. + + :ivar error: The error object. + :vartype error: ~azure.mgmt.nginx.models.ErrorDetail + """ + + error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The error object.""" + + @overload + def __init__( + self, + *, + error: Optional["_models.ErrorDetail"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class IdentityProperties(_Model): + """Identity Properties. + + :ivar principal_id: + :vartype principal_id: str + :ivar tenant_id: + :vartype tenant_id: str + :ivar type: Identity Type. Known values are: "SystemAssigned", "UserAssigned", "SystemAssigned, + UserAssigned", and "None". + :vartype type: str or ~azure.mgmt.nginx.models.IdentityType + :ivar user_assigned_identities: Dictionary of . + :vartype user_assigned_identities: dict[str, ~azure.mgmt.nginx.models.UserIdentityProperties] + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) + type: Optional[Union[str, "_models.IdentityType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Identity Type. Known values are: \"SystemAssigned\", \"UserAssigned\", \"SystemAssigned, + UserAssigned\", and \"None\".""" + user_assigned_identities: Optional[dict[str, "_models.UserIdentityProperties"]] = rest_field( + name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"] + ) + """Dictionary of .""" + + @overload + def __init__( + self, + *, + type: Optional[Union[str, "_models.IdentityType"]] = None, + user_assigned_identities: Optional[dict[str, "_models.UserIdentityProperties"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Resource(_Model): + """Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /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 + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or + \"Microsoft.Storage/storageAccounts\".""" + system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) + """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" + + +class ProxyResource(Resource): + """Proxy Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /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 + """ + + +class NginxCertificate(ProxyResource): + """Nginx Certificate. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /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 properties: Nginx Certificate Properties. + :vartype properties: ~azure.mgmt.nginx.models.NginxCertificateProperties + :ivar location: The geo-location where the resource lives. + :vartype location: str + """ + + properties: Optional["_models.NginxCertificateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Nginx Certificate Properties.""" + location: Optional[str] = rest_field(visibility=["read", "create"]) + """The geo-location where the resource lives.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.NginxCertificateProperties"] = None, + location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxCertificateErrorResponseBody(_Model): + """Nginx Certificate Error Response Body. + + :ivar code: + :vartype code: str + :ivar message: + :vartype message: str + """ + + code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + + @overload + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxCertificateProperties(_Model): + """Nginx Certificate Properties. + + :ivar provisioning_state: Provisioning State. Known values are: "Accepted", "Creating", + "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", and "NotSpecified". + :vartype provisioning_state: str or ~azure.mgmt.nginx.models.ProvisioningState + :ivar key_virtual_path: + :vartype key_virtual_path: str + :ivar certificate_virtual_path: + :vartype certificate_virtual_path: str + :ivar key_vault_secret_id: + :vartype key_vault_secret_id: str + :ivar sha1_thumbprint: + :vartype sha1_thumbprint: str + :ivar key_vault_secret_version: + :vartype key_vault_secret_version: str + :ivar key_vault_secret_created: + :vartype key_vault_secret_created: ~datetime.datetime + :ivar certificate_error: Nginx Certificate Error Response Body. + :vartype certificate_error: ~azure.mgmt.nginx.models.NginxCertificateErrorResponseBody + """ + + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning State. Known values are: \"Accepted\", \"Creating\", \"Updating\", \"Deleting\", + \"Succeeded\", \"Failed\", \"Canceled\", \"Deleted\", and \"NotSpecified\".""" + key_virtual_path: Optional[str] = rest_field( + name="keyVirtualPath", visibility=["read", "create", "update", "delete", "query"] + ) + certificate_virtual_path: Optional[str] = rest_field( + name="certificateVirtualPath", visibility=["read", "create", "update", "delete", "query"] + ) + key_vault_secret_id: Optional[str] = rest_field( + name="keyVaultSecretId", visibility=["read", "create", "update", "delete", "query"] + ) + sha1_thumbprint: Optional[str] = rest_field(name="sha1Thumbprint", visibility=["read"]) + key_vault_secret_version: Optional[str] = rest_field(name="keyVaultSecretVersion", visibility=["read"]) + key_vault_secret_created: Optional[datetime.datetime] = rest_field( + name="keyVaultSecretCreated", visibility=["read"], format="rfc3339" + ) + certificate_error: Optional["_models.NginxCertificateErrorResponseBody"] = rest_field( + name="certificateError", visibility=["read", "create", "update", "delete", "query"] + ) + """Nginx Certificate Error Response Body.""" + + @overload + def __init__( + self, + *, + key_virtual_path: Optional[str] = None, + certificate_virtual_path: Optional[str] = None, + key_vault_secret_id: Optional[str] = None, + certificate_error: Optional["_models.NginxCertificateErrorResponseBody"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxConfigurationFile(_Model): + """Nginx Configuration File. + + :ivar content: + :vartype content: str + :ivar virtual_path: + :vartype virtual_path: str + """ + + content: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + virtual_path: Optional[str] = rest_field( + name="virtualPath", visibility=["read", "create", "update", "delete", "query"] + ) + + @overload + def __init__( + self, + *, + content: Optional[str] = None, + virtual_path: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxConfigurationPackage(_Model): + """Nginx Configuration Package. + + :ivar data: + :vartype data: str + :ivar protected_files: + :vartype protected_files: list[str] + """ + + data: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + protected_files: Optional[list[str]] = rest_field( + name="protectedFiles", visibility=["read", "create", "update", "delete", "query"] + ) + + @overload + def __init__( + self, + *, + data: Optional[str] = None, + protected_files: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxConfigurationProtectedFileRequest(_Model): + """Nginx Configuration Protected File Request. + + :ivar content: The content of the protected file. This value is a PUT only value. If you + perform a GET request on this value, it will be empty because it is a protected file. + :vartype content: str + :ivar virtual_path: The virtual path of the protected file. + :vartype virtual_path: str + :ivar content_hash: The hash of the content of the file. This value is used to determine if the + file has changed. + :vartype content_hash: str + """ + + content: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The content of the protected file. This value is a PUT only value. If you perform a GET request + on this value, it will be empty because it is a protected file.""" + virtual_path: Optional[str] = rest_field( + name="virtualPath", visibility=["read", "create", "update", "delete", "query"] + ) + """The virtual path of the protected file.""" + content_hash: Optional[str] = rest_field( + name="contentHash", visibility=["read", "create", "update", "delete", "query"] + ) + """The hash of the content of the file. This value is used to determine if the file has changed.""" + + @overload + def __init__( + self, + *, + content: Optional[str] = None, + virtual_path: Optional[str] = None, + content_hash: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxConfigurationProtectedFileResponse(_Model): + """Nginx Configuration Protected File Response. + + :ivar virtual_path: The virtual path of the protected file. + :vartype virtual_path: str + :ivar content_hash: The hash of the content of the file. This value is used to determine if the + file has changed. + :vartype content_hash: str + """ + + virtual_path: Optional[str] = rest_field( + name="virtualPath", visibility=["read", "create", "update", "delete", "query"] + ) + """The virtual path of the protected file.""" + content_hash: Optional[str] = rest_field( + name="contentHash", visibility=["read", "create", "update", "delete", "query"] + ) + """The hash of the content of the file. This value is used to determine if the file has changed.""" + + @overload + def __init__( + self, + *, + virtual_path: Optional[str] = None, + content_hash: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxConfigurationRequest(_Model): + """Nginx Configuration Request. + + :ivar id: + :vartype id: str + :ivar name: + :vartype name: str + :ivar type: + :vartype type: str + :ivar properties: Nginx Configuration Request Properties. + :vartype properties: ~azure.mgmt.nginx.models.NginxConfigurationRequestProperties + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.nginx.models.SystemData + """ + + id: Optional[str] = rest_field(visibility=["read"]) + name: Optional[str] = rest_field(visibility=["read"]) + type: Optional[str] = rest_field(visibility=["read"]) + properties: Optional["_models.NginxConfigurationRequestProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Nginx Configuration Request Properties.""" + system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) + """Metadata pertaining to creation and last modification of the resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.NginxConfigurationRequestProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxConfigurationRequestProperties(_Model): + """Nginx Configuration Request Properties. + + :ivar provisioning_state: Provisioning State. Known values are: "Accepted", "Creating", + "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", and "NotSpecified". + :vartype provisioning_state: str or ~azure.mgmt.nginx.models.ProvisioningState + :ivar files: + :vartype files: list[~azure.mgmt.nginx.models.NginxConfigurationFile] + :ivar protected_files: + :vartype protected_files: list[~azure.mgmt.nginx.models.NginxConfigurationProtectedFileRequest] + :ivar package: Nginx Configuration Package. + :vartype package: ~azure.mgmt.nginx.models.NginxConfigurationPackage + :ivar root_file: + :vartype root_file: str + """ + + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning State. Known values are: \"Accepted\", \"Creating\", \"Updating\", \"Deleting\", + \"Succeeded\", \"Failed\", \"Canceled\", \"Deleted\", and \"NotSpecified\".""" + files: Optional[list["_models.NginxConfigurationFile"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + protected_files: Optional[list["_models.NginxConfigurationProtectedFileRequest"]] = rest_field( + name="protectedFiles", visibility=["read", "create", "update", "delete", "query"] + ) + package: Optional["_models.NginxConfigurationPackage"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Nginx Configuration Package.""" + root_file: Optional[str] = rest_field(name="rootFile", visibility=["read", "create", "update", "delete", "query"]) + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxConfigurationResponse(ProxyResource): + """Nginx Configuration Response. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /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 properties: Nginx Configuration Response Properties. + :vartype properties: ~azure.mgmt.nginx.models.NginxConfigurationResponseProperties + """ + + properties: Optional["_models.NginxConfigurationResponseProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Nginx Configuration Response Properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.NginxConfigurationResponseProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxConfigurationResponseProperties(_Model): + """Nginx Configuration Response Properties. + + :ivar provisioning_state: Provisioning State. Known values are: "Accepted", "Creating", + "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", and "NotSpecified". + :vartype provisioning_state: str or ~azure.mgmt.nginx.models.ProvisioningState + :ivar files: + :vartype files: list[~azure.mgmt.nginx.models.NginxConfigurationFile] + :ivar protected_files: + :vartype protected_files: + list[~azure.mgmt.nginx.models.NginxConfigurationProtectedFileResponse] + :ivar package: Nginx Configuration Package. + :vartype package: ~azure.mgmt.nginx.models.NginxConfigurationPackage + :ivar root_file: + :vartype root_file: str + """ + + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning State. Known values are: \"Accepted\", \"Creating\", \"Updating\", \"Deleting\", + \"Succeeded\", \"Failed\", \"Canceled\", \"Deleted\", and \"NotSpecified\".""" + files: Optional[list["_models.NginxConfigurationFile"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + protected_files: Optional[list["_models.NginxConfigurationProtectedFileResponse"]] = rest_field( + name="protectedFiles", visibility=["read", "create", "update", "delete", "query"] + ) + package: Optional["_models.NginxConfigurationPackage"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Nginx Configuration Package.""" + root_file: Optional[str] = rest_field(name="rootFile", visibility=["read", "create", "update", "delete", "query"]) + + @overload + def __init__( + self, + *, + files: Optional[list["_models.NginxConfigurationFile"]] = None, + protected_files: Optional[list["_models.NginxConfigurationProtectedFileResponse"]] = None, + package: Optional["_models.NginxConfigurationPackage"] = None, + root_file: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TrackedResource(Resource): + """Tracked Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /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 + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + location: str = rest_field(visibility=["read", "create"]) + """The geo-location where the resource lives. Required.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxDeployment(TrackedResource): + """Nginx Deployment. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /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 properties: Nginx Deployment Properties. + :vartype properties: ~azure.mgmt.nginx.models.NginxDeploymentProperties + :ivar identity: Identity Properties. + :vartype identity: ~azure.mgmt.nginx.models.IdentityProperties + :ivar sku: Resource Sku. + :vartype sku: ~azure.mgmt.nginx.models.ResourceSku + """ + + properties: Optional["_models.NginxDeploymentProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Nginx Deployment Properties.""" + identity: Optional["_models.IdentityProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Identity Properties.""" + sku: Optional["_models.ResourceSku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Sku.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.NginxDeploymentProperties"] = None, + identity: Optional["_models.IdentityProperties"] = None, + sku: Optional["_models.ResourceSku"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxDeploymentApiKeyRequest(_Model): + """Nginx Deployment Api Key Request. + + :ivar id: + :vartype id: str + :ivar name: + :vartype name: str + :ivar type: + :vartype type: str + :ivar properties: Nginx Deployment Api Key Request Properties. + :vartype properties: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyRequestProperties + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.nginx.models.SystemData + """ + + id: Optional[str] = rest_field(visibility=["read"]) + name: Optional[str] = rest_field(visibility=["read"]) + type: Optional[str] = rest_field(visibility=["read"]) + properties: Optional["_models.NginxDeploymentApiKeyRequestProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Nginx Deployment Api Key Request Properties.""" + system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) + """Metadata pertaining to creation and last modification of the resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.NginxDeploymentApiKeyRequestProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxDeploymentApiKeyRequestProperties(_Model): + """Nginx Deployment Api Key Request Properties. + + :ivar secret_text: Secret text to be used as a Dataplane API Key. This is a write only property + that can never be read back, but the first three characters will be returned in the 'hint' + 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 + """ + + secret_text: Optional[str] = rest_field( + name="secretText", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + end_date_time: Optional[datetime.datetime] = rest_field( + name="endDateTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The time after which this Dataplane API Key is no longer valid.""" + + @overload + def __init__( + self, + *, + secret_text: Optional[str] = None, + end_date_time: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxDeploymentApiKeyResponse(ProxyResource): + """Nginx Deployment Api Key Response. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /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 properties: Nginx Deployment Api Key Response Properties. + :vartype properties: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponseProperties + """ + + properties: Optional["_models.NginxDeploymentApiKeyResponseProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Nginx Deployment Api Key Response Properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.NginxDeploymentApiKeyResponseProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxDeploymentApiKeyResponseProperties(_Model): + """Nginx Deployment Api Key Response Properties. + + :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 + """ + + hint: Optional[str] = rest_field(visibility=["read"]) + """The first three characters of the secret text to help identify it in use. This property is + read-only.""" + end_date_time: Optional[datetime.datetime] = rest_field( + name="endDateTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The time after which this Dataplane API Key is no longer valid.""" + + @overload + def __init__( + self, + *, + end_date_time: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxDeploymentDefaultWafPolicyListResponse(_Model): # pylint: disable=name-too-long + """Nginx Deployment Default Waf Policy List Response. + + :ivar value: + :vartype value: list[~azure.mgmt.nginx.models.NginxDeploymentDefaultWafPolicyProperties] + :ivar next_link: + :vartype next_link: str + """ + + value: Optional[list["_models.NginxDeploymentDefaultWafPolicyProperties"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + next_link: Optional[str] = rest_field(name="nextLink", visibility=["read", "create", "update", "delete", "query"]) + + @overload + def __init__( + self, + *, + value: Optional[list["_models.NginxDeploymentDefaultWafPolicyProperties"]] = None, + next_link: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxDeploymentDefaultWafPolicyProperties(_Model): # pylint: disable=name-too-long + """Nginx Deployment Default Waf Policy Properties. + + :ivar content: + :vartype content: bytes + :ivar filepath: + :vartype filepath: str + """ + + content: Optional[bytes] = rest_field(visibility=["read"], format="base64") + filepath: Optional[str] = rest_field(visibility=["read"]) + + +class NginxDeploymentProperties(_Model): + """Nginx Deployment Properties. + + :ivar provisioning_state: Provisioning State. Known values are: "Accepted", "Creating", + "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", and "NotSpecified". + :vartype provisioning_state: str or ~azure.mgmt.nginx.models.ProvisioningState + :ivar nginx_version: + :vartype nginx_version: str + :ivar network_profile: Nginx Network Profile. + :vartype network_profile: ~azure.mgmt.nginx.models.NginxNetworkProfile + :ivar ip_address: The IP address of the deployment. + :vartype ip_address: str + :ivar enable_diagnostics_support: + :vartype enable_diagnostics_support: bool + :ivar logging: Nginx Logging. + :vartype logging: ~azure.mgmt.nginx.models.NginxLogging + :ivar scaling_properties: Information on how the deployment will be scaled. + :vartype scaling_properties: ~azure.mgmt.nginx.models.NginxDeploymentScalingProperties + :ivar auto_upgrade_profile: Autoupgrade settings of a deployment. + :vartype auto_upgrade_profile: ~azure.mgmt.nginx.models.AutoUpgradeProfile + :ivar user_profile: Nginx Deployment User Profile. + :vartype user_profile: ~azure.mgmt.nginx.models.NginxDeploymentUserProfile + :ivar nginx_app_protect: Settings for NGINX App Protect (NAP). + :vartype nginx_app_protect: ~azure.mgmt.nginx.models.NginxDeploymentPropertiesNginxAppProtect + :ivar dataplane_api_endpoint: Dataplane API endpoint for the caller to update the NGINX state + of the deployment. + :vartype dataplane_api_endpoint: str + """ + + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning State. Known values are: \"Accepted\", \"Creating\", \"Updating\", \"Deleting\", + \"Succeeded\", \"Failed\", \"Canceled\", \"Deleted\", and \"NotSpecified\".""" + nginx_version: Optional[str] = rest_field(name="nginxVersion", visibility=["read"]) + network_profile: Optional["_models.NginxNetworkProfile"] = rest_field( + name="networkProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Nginx Network Profile.""" + ip_address: Optional[str] = rest_field(name="ipAddress", visibility=["read"]) + """The IP address of the deployment.""" + enable_diagnostics_support: Optional[bool] = rest_field( + name="enableDiagnosticsSupport", visibility=["read", "create", "update", "delete", "query"] + ) + logging: Optional["_models.NginxLogging"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Nginx Logging.""" + scaling_properties: Optional["_models.NginxDeploymentScalingProperties"] = rest_field( + name="scalingProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """Information on how the deployment will be scaled.""" + auto_upgrade_profile: Optional["_models.AutoUpgradeProfile"] = rest_field( + name="autoUpgradeProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Autoupgrade settings of a deployment.""" + user_profile: Optional["_models.NginxDeploymentUserProfile"] = rest_field( + name="userProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Nginx Deployment User Profile.""" + nginx_app_protect: Optional["_models.NginxDeploymentPropertiesNginxAppProtect"] = rest_field( + name="nginxAppProtect", visibility=["read", "create", "update", "delete", "query"] + ) + """Settings for NGINX App Protect (NAP).""" + dataplane_api_endpoint: Optional[str] = rest_field(name="dataplaneApiEndpoint", visibility=["read"]) + """Dataplane API endpoint for the caller to update the NGINX state of the deployment.""" + + @overload + def __init__( + self, + *, + network_profile: Optional["_models.NginxNetworkProfile"] = None, + enable_diagnostics_support: Optional[bool] = None, + logging: Optional["_models.NginxLogging"] = None, + scaling_properties: Optional["_models.NginxDeploymentScalingProperties"] = None, + auto_upgrade_profile: Optional["_models.AutoUpgradeProfile"] = None, + user_profile: Optional["_models.NginxDeploymentUserProfile"] = None, + nginx_app_protect: Optional["_models.NginxDeploymentPropertiesNginxAppProtect"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxDeploymentPropertiesNginxAppProtect(_Model): + """Settings for NGINX App Protect (NAP). + + :ivar web_application_firewall_settings: Settings for the NGINX App Protect Web Application + Firewall (WAF). Required. + :vartype web_application_firewall_settings: + ~azure.mgmt.nginx.models.WebApplicationFirewallSettings + :ivar web_application_firewall_status: The status of the NGINX App Protect Web Application + Firewall. + :vartype web_application_firewall_status: ~azure.mgmt.nginx.models.WebApplicationFirewallStatus + """ + + web_application_firewall_settings: "_models.WebApplicationFirewallSettings" = rest_field( + name="webApplicationFirewallSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Settings for the NGINX App Protect Web Application Firewall (WAF). Required.""" + web_application_firewall_status: Optional["_models.WebApplicationFirewallStatus"] = rest_field( + name="webApplicationFirewallStatus", visibility=["read"] + ) + """The status of the NGINX App Protect Web Application Firewall.""" + + @overload + def __init__( + self, + *, + web_application_firewall_settings: "_models.WebApplicationFirewallSettings", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxDeploymentScalingProperties(_Model): + """Information on how the deployment will be scaled. + + :ivar capacity: + :vartype capacity: int + :ivar auto_scale_settings: The settings for enabling automatic scaling of the deployment. If + this field is specified, 'scale.capacity' must be empty. + :vartype auto_scale_settings: + ~azure.mgmt.nginx.models.NginxDeploymentScalingPropertiesAutoScaleSettings + """ + + capacity: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + auto_scale_settings: Optional["_models.NginxDeploymentScalingPropertiesAutoScaleSettings"] = rest_field( + name="autoScaleSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """The settings for enabling automatic scaling of the deployment. If this field is specified, + 'scale.capacity' must be empty.""" + + __flattened_items = ["profiles"] + + @overload + def __init__( + self, + *, + capacity: Optional[int] = None, + auto_scale_settings: Optional["_models.NginxDeploymentScalingPropertiesAutoScaleSettings"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.auto_scale_settings is None: + return None + return getattr(self.auto_scale_settings, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.auto_scale_settings is None: + self.auto_scale_settings = self._attr_to_rest_field["auto_scale_settings"]._class_type() + setattr(self.auto_scale_settings, key, value) + else: + super().__setattr__(key, value) + + +class NginxDeploymentScalingPropertiesAutoScaleSettings(_Model): # pylint: disable=name-too-long + """The settings for enabling automatic scaling of the deployment. If this field is specified, + 'scale.capacity' must be empty. + + :ivar profiles: Required. + :vartype profiles: list[~azure.mgmt.nginx.models.ScaleProfile] + """ + + profiles: list["_models.ScaleProfile"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + + @overload + def __init__( + self, + *, + profiles: list["_models.ScaleProfile"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxDeploymentUpdateParameters(_Model): + """Nginx Deployment Update Parameters. + + :ivar identity: Identity Properties. + :vartype identity: ~azure.mgmt.nginx.models.IdentityProperties + :ivar tags: Dictionary of . + :vartype tags: dict[str, str] + :ivar sku: Resource Sku. + :vartype sku: ~azure.mgmt.nginx.models.ResourceSku + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar properties: Nginx Deployment Update Properties. + :vartype properties: ~azure.mgmt.nginx.models.NginxDeploymentUpdateProperties + """ + + identity: Optional["_models.IdentityProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Identity Properties.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Dictionary of .""" + sku: Optional["_models.ResourceSku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Sku.""" + location: Optional[str] = rest_field(visibility=["read", "create"]) + """The geo-location where the resource lives.""" + properties: Optional["_models.NginxDeploymentUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Nginx Deployment Update Properties.""" + + @overload + def __init__( + self, + *, + identity: Optional["_models.IdentityProperties"] = None, + tags: Optional[dict[str, str]] = None, + sku: Optional["_models.ResourceSku"] = None, + location: Optional[str] = None, + properties: Optional["_models.NginxDeploymentUpdateProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxDeploymentUpdateProperties(_Model): + """Nginx Deployment Update Properties. + + :ivar enable_diagnostics_support: + :vartype enable_diagnostics_support: bool + :ivar logging: Nginx Logging. + :vartype logging: ~azure.mgmt.nginx.models.NginxLogging + :ivar scaling_properties: Information on how the deployment will be scaled. + :vartype scaling_properties: ~azure.mgmt.nginx.models.NginxDeploymentScalingProperties + :ivar user_profile: Nginx Deployment User Profile. + :vartype user_profile: ~azure.mgmt.nginx.models.NginxDeploymentUserProfile + :ivar network_profile: Nginx Network Profile. + :vartype network_profile: ~azure.mgmt.nginx.models.NginxNetworkProfile + :ivar auto_upgrade_profile: Autoupgrade settings of a deployment. + :vartype auto_upgrade_profile: ~azure.mgmt.nginx.models.AutoUpgradeProfile + :ivar nginx_app_protect: Update settings for NGINX App Protect (NAP). + :vartype nginx_app_protect: + ~azure.mgmt.nginx.models.NginxDeploymentUpdatePropertiesNginxAppProtect + """ + + enable_diagnostics_support: Optional[bool] = rest_field( + name="enableDiagnosticsSupport", visibility=["read", "create", "update", "delete", "query"] + ) + logging: Optional["_models.NginxLogging"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Nginx Logging.""" + scaling_properties: Optional["_models.NginxDeploymentScalingProperties"] = rest_field( + name="scalingProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """Information on how the deployment will be scaled.""" + user_profile: Optional["_models.NginxDeploymentUserProfile"] = rest_field( + name="userProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Nginx Deployment User Profile.""" + network_profile: Optional["_models.NginxNetworkProfile"] = rest_field( + name="networkProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Nginx Network Profile.""" + auto_upgrade_profile: Optional["_models.AutoUpgradeProfile"] = rest_field( + name="autoUpgradeProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Autoupgrade settings of a deployment.""" + nginx_app_protect: Optional["_models.NginxDeploymentUpdatePropertiesNginxAppProtect"] = rest_field( + name="nginxAppProtect", visibility=["read", "create", "update", "delete", "query"] + ) + """Update settings for NGINX App Protect (NAP).""" + + __flattened_items = ["web_application_firewall_settings"] + + @overload + def __init__( + self, + *, + enable_diagnostics_support: Optional[bool] = None, + logging: Optional["_models.NginxLogging"] = None, + scaling_properties: Optional["_models.NginxDeploymentScalingProperties"] = None, + user_profile: Optional["_models.NginxDeploymentUserProfile"] = None, + network_profile: Optional["_models.NginxNetworkProfile"] = None, + auto_upgrade_profile: Optional["_models.AutoUpgradeProfile"] = None, + nginx_app_protect: Optional["_models.NginxDeploymentUpdatePropertiesNginxAppProtect"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.nginx_app_protect is None: + return None + return getattr(self.nginx_app_protect, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.nginx_app_protect is None: + self.nginx_app_protect = self._attr_to_rest_field["nginx_app_protect"]._class_type() + setattr(self.nginx_app_protect, key, value) + else: + super().__setattr__(key, value) + + +class NginxDeploymentUpdatePropertiesNginxAppProtect(_Model): # pylint: disable=name-too-long + """Update settings for NGINX App Protect (NAP). + + :ivar web_application_firewall_settings: Settings for the NGINX App Protect Web Application + Firewall (WAF). + :vartype web_application_firewall_settings: + ~azure.mgmt.nginx.models.WebApplicationFirewallSettings + """ + + web_application_firewall_settings: Optional["_models.WebApplicationFirewallSettings"] = rest_field( + name="webApplicationFirewallSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Settings for the NGINX App Protect Web Application Firewall (WAF).""" + + @overload + def __init__( + self, + *, + web_application_firewall_settings: Optional["_models.WebApplicationFirewallSettings"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxDeploymentUserProfile(_Model): + """Nginx Deployment User Profile. + + :ivar preferred_email: The preferred support contact email address of the user used for sending + alerts and notification. Can be an empty string or a valid email address. + :vartype preferred_email: str + """ + + preferred_email: Optional[str] = rest_field( + name="preferredEmail", visibility=["read", "create", "update", "delete", "query"] + ) + """The preferred support contact email address of the user used for sending alerts and + notification. Can be an empty string or a valid email address.""" + + @overload + def __init__( + self, + *, + preferred_email: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxDeploymentWafPolicy(ProxyResource): + """Nginx Deployment Waf Policy. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /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 properties: Nginx Deployment Waf Policy Properties. + :vartype properties: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyProperties + """ + + properties: Optional["_models.NginxDeploymentWafPolicyProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Nginx Deployment Waf Policy Properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.NginxDeploymentWafPolicyProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxDeploymentWafPolicyAnalysisCreateRequest(_Model): # pylint: disable=name-too-long + """Nginx Deployment Waf Policy Analysis Create Request. + + :ivar content: The byte content of the policy. + :vartype content: bytes + :ivar filepath: The absolute file path of the policy as in the virtual machine. + :vartype filepath: str + """ + + content: Optional[bytes] = rest_field(visibility=["read", "create", "update", "delete", "query"], format="base64") + """The byte content of the policy.""" + filepath: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The absolute file path of the policy as in the virtual machine.""" + + @overload + def __init__( + self, + *, + content: Optional[bytes] = None, + filepath: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxDeploymentWafPolicyAnalysisData(_Model): + """Nginx Deployment Waf Policy Analysis Data. + + :ivar errors: List of errors found during analysis. + :vartype errors: list[~azure.mgmt.nginx.models.NginxDeploymentWafPolicyError] + """ + + errors: Optional[list["_models.NginxDeploymentWafPolicyError"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """List of errors found during analysis.""" + + @overload + def __init__( + self, + *, + errors: Optional[list["_models.NginxDeploymentWafPolicyError"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxDeploymentWafPolicyAnalysisResponse(_Model): + """Nginx Deployment Waf Policy Analysis Response. + + :ivar status: The status of the analysis. The possible values can be arbitrary. + :vartype status: str + :ivar data: The analysis data containing errors. + :vartype data: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyAnalysisData + """ + + status: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The status of the analysis. The possible values can be arbitrary.""" + data: Optional["_models.NginxDeploymentWafPolicyAnalysisData"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The analysis data containing errors.""" + + @overload + def __init__( + self, + *, + status: Optional[str] = None, + data: Optional["_models.NginxDeploymentWafPolicyAnalysisData"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxDeploymentWafPolicyApplyingStatus(_Model): + """Nginx Deployment Waf Policy Applying Status. + + :ivar code: Machine readable code indicating the applying status code of a WAF Policy. Known + values are: "NotApplied", "Applying", "Succeeded", "Failed", and "Removing". + :vartype code: str or ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyApplyingStatusCode + :ivar display_status: A readable string of the current status, and sometimes have the reason + for the current state. + :vartype display_status: str + :ivar time: The date and time in UTC the current applying status was set. + :vartype time: str + """ + + code: Optional[Union[str, "_models.NginxDeploymentWafPolicyApplyingStatusCode"]] = rest_field(visibility=["read"]) + """Machine readable code indicating the applying status code of a WAF Policy. Known values are: + \"NotApplied\", \"Applying\", \"Succeeded\", \"Failed\", and \"Removing\".""" + display_status: Optional[str] = rest_field(name="displayStatus", visibility=["read"]) + """A readable string of the current status, and sometimes have the reason for the current state.""" + time: Optional[str] = rest_field(visibility=["read"]) + """The date and time in UTC the current applying status was set.""" + + +class NginxDeploymentWafPolicyCompilingStatus(_Model): + """Nginx Deployment Waf Policy Compiling Status. + + :ivar code: Machine readable code indicating the compilation status of a WAF Policy. Known + values are: "NotStarted", "InProgress", "Succeeded", and "Failed". + :vartype code: str or ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyCompilingStatusCode + :ivar display_status: A readable string of the current status, and sometimes have the reason + for the current state. If the CompilingStatus is Failed the Display Status will be The waf + Policy failed to compile. + :vartype display_status: str + :ivar time: The date and time the policy was compiled in UTC. + :vartype time: str + """ + + code: Optional[Union[str, "_models.NginxDeploymentWafPolicyCompilingStatusCode"]] = rest_field(visibility=["read"]) + """Machine readable code indicating the compilation status of a WAF Policy. Known values are: + \"NotStarted\", \"InProgress\", \"Succeeded\", and \"Failed\".""" + display_status: Optional[str] = rest_field(name="displayStatus", visibility=["read"]) + """A readable string of the current status, and sometimes have the reason for the current state. + If the CompilingStatus is Failed the Display Status will be The waf Policy failed to compile.""" + time: Optional[str] = rest_field(visibility=["read"]) + """The date and time the policy was compiled in UTC.""" + + +class NginxDeploymentWafPolicyError(_Model): + """Nginx Deployment Waf Policy Error. + + :ivar code: Error code. + :vartype code: str + :ivar field: Field that caused the error. + :vartype field: str + :ivar message: Error message. + :vartype message: str + """ + + code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Error code.""" + field: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Field that caused the error.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Error message.""" + + @overload + def __init__( + self, + *, + code: Optional[str] = None, + field: Optional[str] = None, + message: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxDeploymentWafPolicyMetadata(_Model): + """Nginx Deployment Waf Policy Metadata. + + :ivar id: + :vartype id: str + :ivar name: + :vartype name: str + :ivar type: + :vartype type: str + :ivar properties: Nginx Deployment Waf Policy Metadata Properties. + :vartype properties: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyMetadataProperties + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.nginx.models.SystemData + """ + + id: Optional[str] = rest_field(visibility=["read"]) + name: Optional[str] = rest_field(visibility=["read"]) + type: Optional[str] = rest_field(visibility=["read"]) + properties: Optional["_models.NginxDeploymentWafPolicyMetadataProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Nginx Deployment Waf Policy Metadata Properties.""" + system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) + """Metadata pertaining to creation and last modification of the resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.NginxDeploymentWafPolicyMetadataProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxDeploymentWafPolicyMetadataProperties(_Model): # pylint: disable=name-too-long + """Nginx Deployment Waf Policy Metadata Properties. + + :ivar filepath: + :vartype filepath: str + :ivar provisioning_state: Provisioning State. Known values are: "Accepted", "Creating", + "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", and "NotSpecified". + :vartype provisioning_state: str or ~azure.mgmt.nginx.models.ProvisioningState + :ivar compiling_state: Nginx Deployment Waf Policy Compiling Status. + :vartype compiling_state: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyCompilingStatus + :ivar applying_state: Nginx Deployment Waf Policy Applying Status. + :vartype applying_state: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyApplyingStatus + """ + + filepath: Optional[str] = rest_field(visibility=["read"]) + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning State. Known values are: \"Accepted\", \"Creating\", \"Updating\", \"Deleting\", + \"Succeeded\", \"Failed\", \"Canceled\", \"Deleted\", and \"NotSpecified\".""" + compiling_state: Optional["_models.NginxDeploymentWafPolicyCompilingStatus"] = rest_field( + name="compilingState", visibility=["read"] + ) + """Nginx Deployment Waf Policy Compiling Status.""" + applying_state: Optional["_models.NginxDeploymentWafPolicyApplyingStatus"] = rest_field( + name="applyingState", visibility=["read"] + ) + """Nginx Deployment Waf Policy Applying Status.""" + + +class NginxDeploymentWafPolicyProperties(_Model): + """Nginx Deployment Waf Policy Properties. + + :ivar provisioning_state: Provisioning State. Known values are: "Accepted", "Creating", + "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", and "NotSpecified". + :vartype provisioning_state: str or ~azure.mgmt.nginx.models.ProvisioningState + :ivar content: The byte content of the Policy. + :vartype content: bytes + :ivar filepath: The file path where the Policy is to be saved. + :vartype filepath: str + :ivar compiling_state: Nginx Deployment Waf Policy Compiling Status. + :vartype compiling_state: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyCompilingStatus + :ivar applying_state: Nginx Deployment Waf Policy Applying Status. + :vartype applying_state: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyApplyingStatus + """ + + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning State. Known values are: \"Accepted\", \"Creating\", \"Updating\", \"Deleting\", + \"Succeeded\", \"Failed\", \"Canceled\", \"Deleted\", and \"NotSpecified\".""" + content: Optional[bytes] = rest_field(visibility=["read", "create", "update", "delete", "query"], format="base64") + """The byte content of the Policy.""" + filepath: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The file path where the Policy is to be saved.""" + compiling_state: Optional["_models.NginxDeploymentWafPolicyCompilingStatus"] = rest_field( + name="compilingState", visibility=["read"] + ) + """Nginx Deployment Waf Policy Compiling Status.""" + applying_state: Optional["_models.NginxDeploymentWafPolicyApplyingStatus"] = rest_field( + name="applyingState", visibility=["read"] + ) + """Nginx Deployment Waf Policy Applying Status.""" + + @overload + def __init__( + self, + *, + content: Optional[bytes] = None, + filepath: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxFrontendIPConfiguration(_Model): + """Nginx Frontend IP Configuration. + + :ivar public_ip_addresses: + :vartype public_ip_addresses: list[~azure.mgmt.nginx.models.NginxPublicIPAddress] + :ivar private_ip_addresses: + :vartype private_ip_addresses: list[~azure.mgmt.nginx.models.NginxPrivateIPAddress] + """ + + public_ip_addresses: Optional[list["_models.NginxPublicIPAddress"]] = rest_field( + name="publicIPAddresses", visibility=["read", "create", "update", "delete", "query"] + ) + private_ip_addresses: Optional[list["_models.NginxPrivateIPAddress"]] = rest_field( + name="privateIPAddresses", visibility=["read", "create", "update", "delete", "query"] + ) + + @overload + def __init__( + self, + *, + public_ip_addresses: Optional[list["_models.NginxPublicIPAddress"]] = None, + private_ip_addresses: Optional[list["_models.NginxPrivateIPAddress"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxLogging(_Model): + """Nginx Logging. + + :ivar storage_account: Nginx Storage Account. + :vartype storage_account: ~azure.mgmt.nginx.models.NginxStorageAccount + """ + + storage_account: Optional["_models.NginxStorageAccount"] = rest_field( + name="storageAccount", visibility=["read", "create", "update", "delete", "query"] + ) + """Nginx Storage Account.""" + + @overload + def __init__( + self, + *, + storage_account: Optional["_models.NginxStorageAccount"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxNetworkInterfaceConfiguration(_Model): + """Nginx Network Interface Configuration. + + :ivar subnet_id: + :vartype subnet_id: str + """ + + subnet_id: Optional[str] = rest_field(name="subnetId", visibility=["read", "create", "update", "delete", "query"]) + + @overload + def __init__( + self, + *, + subnet_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxNetworkProfile(_Model): + """Nginx Network Profile. + + :ivar front_end_ip_configuration: Nginx Frontend IP Configuration. + :vartype front_end_ip_configuration: ~azure.mgmt.nginx.models.NginxFrontendIPConfiguration + :ivar network_interface_configuration: Nginx Network Interface Configuration. + :vartype network_interface_configuration: + ~azure.mgmt.nginx.models.NginxNetworkInterfaceConfiguration + """ + + front_end_ip_configuration: Optional["_models.NginxFrontendIPConfiguration"] = rest_field( + name="frontEndIPConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """Nginx Frontend IP Configuration.""" + network_interface_configuration: Optional["_models.NginxNetworkInterfaceConfiguration"] = rest_field( + name="networkInterfaceConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """Nginx Network Interface Configuration.""" + + @overload + def __init__( + self, + *, + front_end_ip_configuration: Optional["_models.NginxFrontendIPConfiguration"] = None, + network_interface_configuration: Optional["_models.NginxNetworkInterfaceConfiguration"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxPrivateIPAddress(_Model): + """Nginx Private IP Address. + + :ivar private_ip_address: + :vartype private_ip_address: str + :ivar private_ip_allocation_method: Nginx Private IP Allocation Method. Known values are: + "Static" and "Dynamic". + :vartype private_ip_allocation_method: str or + ~azure.mgmt.nginx.models.NginxPrivateIPAllocationMethod + :ivar subnet_id: + :vartype subnet_id: str + """ + + private_ip_address: Optional[str] = rest_field( + name="privateIPAddress", visibility=["read", "create", "update", "delete", "query"] + ) + private_ip_allocation_method: Optional[Union[str, "_models.NginxPrivateIPAllocationMethod"]] = rest_field( + name="privateIPAllocationMethod", visibility=["read", "create", "update", "delete", "query"] + ) + """Nginx Private IP Allocation Method. Known values are: \"Static\" and \"Dynamic\".""" + subnet_id: Optional[str] = rest_field(name="subnetId", visibility=["read", "create", "update", "delete", "query"]) + + @overload + def __init__( + self, + *, + private_ip_address: Optional[str] = None, + private_ip_allocation_method: Optional[Union[str, "_models.NginxPrivateIPAllocationMethod"]] = None, + subnet_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxPublicIPAddress(_Model): + """Nginx Public IP Address. + + :ivar id: + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NginxStorageAccount(_Model): + """Nginx Storage Account. + + :ivar account_name: + :vartype account_name: str + :ivar container_name: + :vartype container_name: str + """ + + account_name: Optional[str] = rest_field( + name="accountName", visibility=["read", "create", "update", "delete", "query"] + ) + container_name: Optional[str] = rest_field( + name="containerName", visibility=["read", "create", "update", "delete", "query"] + ) + + @overload + def __init__( + self, + *, + account_name: Optional[str] = None, + container_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Operation(_Model): + """REST API Operation. + + :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 Azure Resource Manager/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: Extensible 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 + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + \"Microsoft.Compute/virtualMachines/write\", + \"Microsoft.Compute/virtualMachines/capture/action\".""" + is_data_action: Optional[bool] = rest_field(name="isDataAction", visibility=["read"]) + """Whether the operation applies to data-plane. This is \"true\" for data-plane operations and + \"false\" for Azure Resource Manager/control-plane operations.""" + display: Optional["_models.OperationDisplay"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Localized display information for this particular operation.""" + origin: Optional[Union[str, "_models.Origin"]] = rest_field(visibility=["read"]) + """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\".""" + action_type: Optional[Union[str, "_models.ActionType"]] = rest_field(name="actionType", visibility=["read"]) + """Extensible enum. Indicates the action type. \"Internal\" refers to actions that are for + internal only APIs. \"Internal\"""" + + @overload + def __init__( + self, + *, + display: Optional["_models.OperationDisplay"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationDisplay(_Model): + """Localized display information for an operation. + + :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 + """ + + provider: Optional[str] = rest_field(visibility=["read"]) + """The localized friendly form of the resource provider name, e.g. \"Microsoft Monitoring + Insights\" or \"Microsoft Compute\".""" + resource: Optional[str] = rest_field(visibility=["read"]) + """The localized friendly name of the resource type related to this operation. E.g. \"Virtual + Machines\" or \"Job Schedule Collections\".""" + operation: Optional[str] = rest_field(visibility=["read"]) + """The concise, localized friendly name for the operation; suitable for dropdowns. E.g. \"Create + or Update Virtual Machine\", \"Restart Virtual Machine\".""" + description: Optional[str] = rest_field(visibility=["read"]) + """The short, localized friendly description of the operation; suitable for tool tips and detailed + views.""" + + +class ResourceSku(_Model): + """Resource Sku. + + :ivar name: Name of the SKU. Required. + :vartype name: str + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the SKU. Required.""" + + @overload + def __init__( + self, + *, + name: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ScaleProfile(_Model): + """The autoscale profile. + + :ivar name: Required. + :vartype name: str + :ivar capacity: The capacity parameters of the profile. Required. + :vartype capacity: ~azure.mgmt.nginx.models.ScaleProfileCapacity + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + capacity: "_models.ScaleProfileCapacity" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The capacity parameters of the profile. Required.""" + + @overload + def __init__( + self, + *, + name: str, + capacity: "_models.ScaleProfileCapacity", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ScaleProfileCapacity(_Model): + """The capacity parameters of the profile. + + :ivar min: The minimum number of NCUs the deployment can be autoscaled to. Required. + :vartype min: int + :ivar max: The maximum number of NCUs the deployment can be autoscaled to. Required. + :vartype max: int + """ + + min: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The minimum number of NCUs the deployment can be autoscaled to. Required.""" + max: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The maximum number of NCUs the deployment can be autoscaled to. Required.""" + + @overload + def __init__( + self, + *, + min: int, # pylint: disable=redefined-builtin + max: int, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SystemData(_Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.nginx.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.nginx.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + created_by: Optional[str] = rest_field(name="createdBy", visibility=["read", "create", "update", "delete", "query"]) + """The identity that created the resource.""" + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="createdByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that created the resource. Known values are: \"User\", \"Application\", + \"ManagedIdentity\", and \"Key\".""" + created_at: Optional[datetime.datetime] = rest_field( + name="createdAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource creation (UTC).""" + last_modified_by: Optional[str] = rest_field( + name="lastModifiedBy", visibility=["read", "create", "update", "delete", "query"] + ) + """The identity that last modified the resource.""" + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="lastModifiedByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that last modified the resource. Known values are: \"User\", + \"Application\", \"ManagedIdentity\", and \"Key\".""" + last_modified_at: Optional[datetime.datetime] = rest_field( + name="lastModifiedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource last modification (UTC).""" + + @overload + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UserIdentityProperties(_Model): + """User Identity Properties. + + :ivar principal_id: + :vartype principal_id: str + :ivar client_id: + :vartype client_id: str + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + client_id: Optional[str] = rest_field(name="clientId", visibility=["read"]) + + +class WebApplicationFirewallComponentVersions(_Model): + """Versions of the NGINX App Protect Web Application Firewall (WAF) components. + + :ivar waf_engine_version: The version of the NGINX App Protect Web Application Firewall (WAF) + engine. Required. + :vartype waf_engine_version: str + :ivar waf_nginx_version: The version of the NGINX App Protect Web Application Firewall (WAF) + module for NGINX. Required. + :vartype waf_nginx_version: str + """ + + waf_engine_version: str = rest_field( + name="wafEngineVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """The version of the NGINX App Protect Web Application Firewall (WAF) engine. Required.""" + waf_nginx_version: str = rest_field( + name="wafNginxVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """The version of the NGINX App Protect Web Application Firewall (WAF) module for NGINX. Required.""" + + @overload + def __init__( + self, + *, + waf_engine_version: str, + waf_nginx_version: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebApplicationFirewallPackage(_Model): + """NGINX App Protect Web Application Firewall (WAF) Package. Contains the version and revision + date of the package. + + :ivar version: The version of the NGINX App Protect Web Application Firewall (WAF) package. + Required. + :vartype version: str + :ivar revision_datetime: The date and time of the package revision. Required. + :vartype revision_datetime: ~datetime.datetime + """ + + version: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The version of the NGINX App Protect Web Application Firewall (WAF) package. Required.""" + revision_datetime: datetime.datetime = rest_field( + name="revisionDatetime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The date and time of the package revision. Required.""" + + @overload + def __init__( + self, + *, + version: str, + revision_datetime: datetime.datetime, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebApplicationFirewallSettings(_Model): + """Settings for the NGINX App Protect Web Application Firewall (WAF). + + :ivar activation_state: The activation state of the WAF. Use 'Enabled' to enable the WAF and + 'Disabled' to disable it. Known values are: "Enabled" and "Disabled". + :vartype activation_state: str or ~azure.mgmt.nginx.models.ActivationState + """ + + activation_state: Optional[Union[str, "_models.ActivationState"]] = rest_field( + name="activationState", visibility=["read", "create", "update", "delete", "query"] + ) + """The activation state of the WAF. Use 'Enabled' to enable the WAF and 'Disabled' to disable it. + Known values are: \"Enabled\" and \"Disabled\".""" + + @overload + def __init__( + self, + *, + activation_state: Optional[Union[str, "_models.ActivationState"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebApplicationFirewallStatus(_Model): + """The status of the NGINX App Protect Web Application Firewall. + + :ivar waf_release: NGINX App Protect WAF release version. + :vartype waf_release: str + :ivar attack_signatures_package: Package containing attack signatures for the NGINX App Protect + Web Application Firewall (WAF). + :vartype attack_signatures_package: ~azure.mgmt.nginx.models.WebApplicationFirewallPackage + :ivar bot_signatures_package: Package containing bot signatures for the NGINX App Protect Web + Application Firewall (WAF). + :vartype bot_signatures_package: ~azure.mgmt.nginx.models.WebApplicationFirewallPackage + :ivar threat_campaigns_package: Package containing threat campaigns for the NGINX App Protect + Web Application Firewall (WAF). + :vartype threat_campaigns_package: ~azure.mgmt.nginx.models.WebApplicationFirewallPackage + :ivar component_versions: Versions of the NGINX App Protect Web Application Firewall (WAF) + components. + :vartype component_versions: ~azure.mgmt.nginx.models.WebApplicationFirewallComponentVersions + """ + + waf_release: Optional[str] = rest_field( + name="wafRelease", visibility=["read", "create", "update", "delete", "query"] + ) + """NGINX App Protect WAF release version.""" + attack_signatures_package: Optional["_models.WebApplicationFirewallPackage"] = rest_field( + name="attackSignaturesPackage", visibility=["read"] + ) + """Package containing attack signatures for the NGINX App Protect Web Application Firewall (WAF).""" + bot_signatures_package: Optional["_models.WebApplicationFirewallPackage"] = rest_field( + name="botSignaturesPackage", visibility=["read"] + ) + """Package containing bot signatures for the NGINX App Protect Web Application Firewall (WAF).""" + threat_campaigns_package: Optional["_models.WebApplicationFirewallPackage"] = rest_field( + name="threatCampaignsPackage", visibility=["read"] + ) + """Package containing threat campaigns for the NGINX App Protect Web Application Firewall (WAF).""" + component_versions: Optional["_models.WebApplicationFirewallComponentVersions"] = rest_field( + name="componentVersions", visibility=["read"] + ) + """Versions of the NGINX App Protect Web Application Firewall (WAF) components.""" + + @overload + def __init__( + self, + *, + waf_release: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) 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 deleted file mode 100644 index 5bd7389da9c2..000000000000 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/_models_py3.py +++ /dev/null @@ -1,2694 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from collections.abc import MutableMapping -import datetime -from typing import Any, Optional, TYPE_CHECKING, Union - -from .._utils import serialization as _serialization - -if TYPE_CHECKING: - from .. import models as _models -JSON = MutableMapping[str, Any] - - -class AnalysisCreate(_serialization.Model): - """The request body for creating an analysis for an NGINX configuration. - - :ivar root_file: The root file of the NGINX config file(s). It must match one of the files' - filepath. - :vartype root_file: str - :ivar files: - :vartype files: list[~azure.mgmt.nginx.models.NginxConfigurationFile] - :ivar protected_files: - :vartype protected_files: list[~azure.mgmt.nginx.models.NginxConfigurationProtectedFileRequest] - :ivar package: Nginx Configuration Package. - :vartype package: ~azure.mgmt.nginx.models.NginxConfigurationPackage - """ - - _attribute_map = { - "root_file": {"key": "config.rootFile", "type": "str"}, - "files": {"key": "config.files", "type": "[NginxConfigurationFile]"}, - "protected_files": {"key": "config.protectedFiles", "type": "[NginxConfigurationProtectedFileRequest]"}, - "package": {"key": "config.package", "type": "NginxConfigurationPackage"}, - } - - def __init__( - self, - *, - root_file: Optional[str] = None, - files: Optional[list["_models.NginxConfigurationFile"]] = None, - protected_files: Optional[list["_models.NginxConfigurationProtectedFileRequest"]] = None, - package: Optional["_models.NginxConfigurationPackage"] = None, - **kwargs: Any - ) -> None: - """ - :keyword root_file: The root file of the NGINX config file(s). It must match one of the files' - filepath. - :paramtype root_file: str - :keyword files: - :paramtype files: list[~azure.mgmt.nginx.models.NginxConfigurationFile] - :keyword protected_files: - :paramtype protected_files: - list[~azure.mgmt.nginx.models.NginxConfigurationProtectedFileRequest] - :keyword package: Nginx Configuration Package. - :paramtype package: ~azure.mgmt.nginx.models.NginxConfigurationPackage - """ - super().__init__(**kwargs) - self.root_file = root_file - self.files = files - self.protected_files = protected_files - self.package = package - - -class AnalysisDiagnostic(_serialization.Model): - """An error object found during the analysis of an NGINX configuration. - - All required parameters must be populated in order to send to server. - - :ivar id: Unique identifier for the error. - :vartype id: str - :ivar directive: Required. - :vartype directive: str - :ivar description: Required. - :vartype description: str - :ivar file: the filepath of the most relevant config file. Required. - :vartype file: str - :ivar line: Required. - :vartype line: float - :ivar message: Required. - :vartype message: str - :ivar rule: Required. - :vartype rule: str - """ - - _validation = { - "directive": {"required": True}, - "description": {"required": True}, - "file": {"required": True}, - "line": {"required": True}, - "message": {"required": True}, - "rule": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "directive": {"key": "directive", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "file": {"key": "file", "type": "str"}, - "line": {"key": "line", "type": "float"}, - "message": {"key": "message", "type": "str"}, - "rule": {"key": "rule", "type": "str"}, - } - - def __init__( - self, - *, - directive: str, - description: str, - file: str, - line: float, - message: str, - rule: str, - id: Optional[str] = None, # pylint: disable=redefined-builtin - **kwargs: Any - ) -> None: - """ - :keyword id: Unique identifier for the error. - :paramtype id: str - :keyword directive: Required. - :paramtype directive: str - :keyword description: Required. - :paramtype description: str - :keyword file: the filepath of the most relevant config file. Required. - :paramtype file: str - :keyword line: Required. - :paramtype line: float - :keyword message: Required. - :paramtype message: str - :keyword rule: Required. - :paramtype rule: str - """ - super().__init__(**kwargs) - self.id = id - self.directive = directive - self.description = description - self.file = file - self.line = line - self.message = message - self.rule = rule - - -class AnalysisResult(_serialization.Model): - """The response body for an analysis request. Contains the status of the analysis and any errors. - - All required parameters must be populated in order to send to server. - - :ivar status: The status of the analysis. Required. - :vartype status: str - :ivar errors: - :vartype errors: list[~azure.mgmt.nginx.models.AnalysisDiagnostic] - :ivar diagnostics: - :vartype diagnostics: list[~azure.mgmt.nginx.models.DiagnosticItem] - """ - - _validation = { - "status": {"required": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "str"}, - "errors": {"key": "data.errors", "type": "[AnalysisDiagnostic]"}, - "diagnostics": {"key": "data.diagnostics", "type": "[DiagnosticItem]"}, - } - - def __init__( - self, - *, - status: str, - errors: Optional[list["_models.AnalysisDiagnostic"]] = None, - diagnostics: Optional[list["_models.DiagnosticItem"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword status: The status of the analysis. Required. - :paramtype status: str - :keyword errors: - :paramtype errors: list[~azure.mgmt.nginx.models.AnalysisDiagnostic] - :keyword diagnostics: - :paramtype diagnostics: list[~azure.mgmt.nginx.models.DiagnosticItem] - """ - super().__init__(**kwargs) - self.status = status - self.errors = errors - self.diagnostics = diagnostics - - -class AutoUpgradeProfile(_serialization.Model): - """Autoupgrade settings of a deployment. - - All required parameters must be populated in order to send to server. - - :ivar upgrade_channel: Channel used for autoupgrade. Required. - :vartype upgrade_channel: str - """ - - _validation = { - "upgrade_channel": {"required": True}, - } - - _attribute_map = { - "upgrade_channel": {"key": "upgradeChannel", "type": "str"}, - } - - def __init__(self, *, upgrade_channel: str, **kwargs: Any) -> None: - """ - :keyword upgrade_channel: Channel used for autoupgrade. Required. - :paramtype upgrade_channel: str - """ - super().__init__(**kwargs) - self.upgrade_channel = upgrade_channel - - -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. - - All required parameters must be populated in order to send to server. - - :ivar id: Unique identifier for the diagnostic. - :vartype id: str - :ivar directive: Required. - :vartype directive: str - :ivar description: Required. - :vartype description: str - :ivar file: The filepath of the most relevant config file. Required. - :vartype file: str - :ivar line: Required. - :vartype line: float - :ivar message: Required. - :vartype message: str - :ivar rule: Required. - :vartype rule: str - :ivar level: Warning or Info. Required. Known values are: "Info" and "Warning". - :vartype level: str or ~azure.mgmt.nginx.models.Level - :ivar category: Category of warning like Best-practices, Recommendation, Security etc. - :vartype category: str - """ - - _validation = { - "directive": {"required": True}, - "description": {"required": True}, - "file": {"required": True}, - "line": {"required": True}, - "message": {"required": True}, - "rule": {"required": True}, - "level": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "directive": {"key": "directive", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "file": {"key": "file", "type": "str"}, - "line": {"key": "line", "type": "float"}, - "message": {"key": "message", "type": "str"}, - "rule": {"key": "rule", "type": "str"}, - "level": {"key": "level", "type": "str"}, - "category": {"key": "category", "type": "str"}, - } - - def __init__( - self, - *, - directive: str, - description: str, - file: str, - line: float, - message: str, - rule: str, - level: Union[str, "_models.Level"], - id: Optional[str] = None, # pylint: disable=redefined-builtin - category: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Unique identifier for the diagnostic. - :paramtype id: str - :keyword directive: Required. - :paramtype directive: str - :keyword description: Required. - :paramtype description: str - :keyword file: The filepath of the most relevant config file. Required. - :paramtype file: str - :keyword line: Required. - :paramtype line: float - :keyword message: Required. - :paramtype message: str - :keyword rule: Required. - :paramtype rule: str - :keyword level: Warning or Info. Required. Known values are: "Info" and "Warning". - :paramtype level: str or ~azure.mgmt.nginx.models.Level - :keyword category: Category of warning like Best-practices, Recommendation, Security etc. - :paramtype category: str - """ - super().__init__(**kwargs) - self.id = id - self.directive = directive - self.description = description - self.file = file - self.line = line - self.message = message - self.rule = rule - self.level = level - self.category = category - - -class ErrorAdditionalInfo(_serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: JSON - """ - - _validation = { - "type": {"readonly": True}, - "info": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "info": {"key": "info", "type": "object"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.info: Optional[JSON] = None - - -class ErrorDetail(_serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.mgmt.nginx.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.nginx.models.ErrorAdditionalInfo] - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "target": {"readonly": True}, - "details": {"readonly": True}, - "additional_info": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[ErrorDetail]"}, - "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - 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): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. (This also follows the OData error response format.). - - :ivar error: The error object. - :vartype error: ~azure.mgmt.nginx.models.ErrorDetail - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.nginx.models.ErrorDetail - """ - super().__init__(**kwargs) - self.error = error - - -class IdentityProperties(_serialization.Model): - """Identity Properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: - :vartype principal_id: str - :ivar tenant_id: - :vartype tenant_id: str - :ivar type: Identity Type. Known values are: "SystemAssigned", "UserAssigned", "SystemAssigned, - UserAssigned", and "None". - :vartype type: str or ~azure.mgmt.nginx.models.IdentityType - :ivar user_assigned_identities: Dictionary of :code:``. - :vartype user_assigned_identities: dict[str, ~azure.mgmt.nginx.models.UserIdentityProperties] - """ - - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserIdentityProperties}"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.IdentityType"]] = None, - user_assigned_identities: Optional[dict[str, "_models.UserIdentityProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Identity Type. Known values are: "SystemAssigned", "UserAssigned", - "SystemAssigned, UserAssigned", and "None". - :paramtype type: str or ~azure.mgmt.nginx.models.IdentityType - :keyword user_assigned_identities: Dictionary of :code:``. - :paramtype user_assigned_identities: dict[str, ~azure.mgmt.nginx.models.UserIdentityProperties] - """ - super().__init__(**kwargs) - self.principal_id: Optional[str] = None - self.tenant_id: Optional[str] = None - self.type = type - self.user_assigned_identities = user_assigned_identities - - -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: 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 - """ - - _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"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.system_data: Optional["_models.SystemData"] = None - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. - - 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 - """ - - -class NginxCertificate(ProxyResource): - """Nginx Certificate. - - 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 properties: Nginx Certificate Properties. - :vartype properties: ~azure.mgmt.nginx.models.NginxCertificateProperties - :ivar location: The geo-location where the resource lives. - :vartype location: str - """ - - _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"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "NginxCertificateProperties"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__( - self, - *, - properties: Optional["_models.NginxCertificateProperties"] = None, - location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Nginx Certificate Properties. - :paramtype properties: ~azure.mgmt.nginx.models.NginxCertificateProperties - :keyword location: The geo-location where the resource lives. - :paramtype location: str - """ - super().__init__(**kwargs) - self.properties = properties - self.location = location - - -class NginxCertificateErrorResponseBody(_serialization.Model): - """Nginx Certificate Error Response Body. - - :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): - """Nginx Certificate List Response. - - 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 NginxCertificateProperties(_serialization.Model): - """Nginx Certificate Properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Provisioning State. Known values are: "Accepted", "Creating", - "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", and "NotSpecified". - :vartype provisioning_state: str or ~azure.mgmt.nginx.models.ProvisioningState - :ivar key_virtual_path: - :vartype key_virtual_path: str - :ivar certificate_virtual_path: - :vartype certificate_virtual_path: str - :ivar key_vault_secret_id: - :vartype key_vault_secret_id: str - :ivar sha1_thumbprint: - :vartype sha1_thumbprint: str - :ivar key_vault_secret_version: - :vartype key_vault_secret_version: str - :ivar key_vault_secret_created: - :vartype key_vault_secret_created: ~datetime.datetime - :ivar certificate_error: Nginx Certificate Error Response Body. - :vartype certificate_error: ~azure.mgmt.nginx.models.NginxCertificateErrorResponseBody - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "sha1_thumbprint": {"readonly": True}, - "key_vault_secret_version": {"readonly": True}, - "key_vault_secret_created": {"readonly": True}, - } - - _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"}, - } - - def __init__( - self, - *, - key_virtual_path: Optional[str] = None, - certificate_virtual_path: Optional[str] = None, - key_vault_secret_id: Optional[str] = None, - certificate_error: Optional["_models.NginxCertificateErrorResponseBody"] = None, - **kwargs: Any - ) -> None: - """ - :keyword key_virtual_path: - :paramtype key_virtual_path: str - :keyword certificate_virtual_path: - :paramtype certificate_virtual_path: str - :keyword key_vault_secret_id: - :paramtype key_vault_secret_id: str - :keyword certificate_error: Nginx Certificate Error Response Body. - :paramtype certificate_error: ~azure.mgmt.nginx.models.NginxCertificateErrorResponseBody - """ - super().__init__(**kwargs) - 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: Optional[str] = None - self.key_vault_secret_version: Optional[str] = None - self.key_vault_secret_created: Optional[datetime.datetime] = None - self.certificate_error = certificate_error - - -class NginxConfigurationFile(_serialization.Model): - """Nginx Configuration File. - - :ivar content: - :vartype content: str - :ivar virtual_path: - :vartype virtual_path: str - """ - - _attribute_map = { - "content": {"key": "content", "type": "str"}, - "virtual_path": {"key": "virtualPath", "type": "str"}, - } - - def __init__(self, *, content: Optional[str] = None, virtual_path: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword content: - :paramtype content: str - :keyword virtual_path: - :paramtype virtual_path: str - """ - super().__init__(**kwargs) - self.content = content - self.virtual_path = virtual_path - - -class NginxConfigurationListResponse(_serialization.Model): - """Response 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: 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: list["_models.NginxConfigurationResponse"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The NginxConfigurationResponse items on this page. Required. - :paramtype value: list[~azure.mgmt.nginx.models.NginxConfigurationResponse] - :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 NginxConfigurationPackage(_serialization.Model): - """Nginx Configuration Package. - - :ivar data: - :vartype data: str - :ivar protected_files: - :vartype protected_files: list[str] - """ - - _attribute_map = { - "data": {"key": "data", "type": "str"}, - "protected_files": {"key": "protectedFiles", "type": "[str]"}, - } - - def __init__( - self, *, data: Optional[str] = None, protected_files: Optional[list[str]] = None, **kwargs: Any - ) -> None: - """ - :keyword data: - :paramtype data: str - :keyword protected_files: - :paramtype protected_files: list[str] - """ - super().__init__(**kwargs) - self.data = data - self.protected_files = protected_files - - -class NginxConfigurationProtectedFileRequest(_serialization.Model): - """Nginx Configuration Protected File Request. - - :ivar content: The content of the protected file. This value is a PUT only value. If you - perform a GET request on this value, it will be empty because it is a protected file. - :vartype content: str - :ivar virtual_path: The virtual path of the protected file. - :vartype virtual_path: str - :ivar content_hash: The hash of the content of the file. This value is used to determine if the - file has changed. - :vartype content_hash: str - """ - - _attribute_map = { - "content": {"key": "content", "type": "str"}, - "virtual_path": {"key": "virtualPath", "type": "str"}, - "content_hash": {"key": "contentHash", "type": "str"}, - } - - def __init__( - self, - *, - content: Optional[str] = None, - virtual_path: Optional[str] = None, - content_hash: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword content: The content of the protected file. This value is a PUT only value. If you - perform a GET request on this value, it will be empty because it is a protected file. - :paramtype content: str - :keyword virtual_path: The virtual path of the protected file. - :paramtype virtual_path: str - :keyword content_hash: The hash of the content of the file. This value is used to determine if - the file has changed. - :paramtype content_hash: str - """ - super().__init__(**kwargs) - self.content = content - self.virtual_path = virtual_path - self.content_hash = content_hash - - -class NginxConfigurationProtectedFileResponse(_serialization.Model): - """Nginx Configuration Protected File Response. - - :ivar virtual_path: The virtual path of the protected file. - :vartype virtual_path: str - :ivar content_hash: The hash of the content of the file. This value is used to determine if the - file has changed. - :vartype content_hash: str - """ - - _attribute_map = { - "virtual_path": {"key": "virtualPath", "type": "str"}, - "content_hash": {"key": "contentHash", "type": "str"}, - } - - def __init__( - self, *, virtual_path: Optional[str] = None, content_hash: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword virtual_path: The virtual path of the protected file. - :paramtype virtual_path: str - :keyword content_hash: The hash of the content of the file. This value is used to determine if - the file has changed. - :paramtype content_hash: str - """ - super().__init__(**kwargs) - self.virtual_path = virtual_path - self.content_hash = content_hash - - -class NginxConfigurationRequest(_serialization.Model): - """Nginx Configuration Request. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: - :vartype id: str - :ivar name: - :vartype name: str - :ivar type: - :vartype type: str - :ivar properties: Nginx Configuration Request Properties. - :vartype properties: ~azure.mgmt.nginx.models.NginxConfigurationRequestProperties - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.nginx.models.SystemData - """ - - _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: Nginx Configuration Request Properties. - :paramtype properties: ~azure.mgmt.nginx.models.NginxConfigurationRequestProperties - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.properties = properties - self.system_data: Optional["_models.SystemData"] = None - - -class NginxConfigurationRequestProperties(_serialization.Model): - """Nginx Configuration Request Properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Provisioning State. Known values are: "Accepted", "Creating", - "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", and "NotSpecified". - :vartype provisioning_state: str or ~azure.mgmt.nginx.models.ProvisioningState - :ivar files: - :vartype files: list[~azure.mgmt.nginx.models.NginxConfigurationFile] - :ivar protected_files: - :vartype protected_files: list[~azure.mgmt.nginx.models.NginxConfigurationProtectedFileRequest] - :ivar package: Nginx Configuration 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: Nginx Configuration Package. - :paramtype package: ~azure.mgmt.nginx.models.NginxConfigurationPackage - :keyword root_file: - :paramtype root_file: str - """ - super().__init__(**kwargs) - 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 NginxConfigurationResponse(ProxyResource): - """Nginx Configuration Response. - - 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 properties: Nginx Configuration Response Properties. - :vartype properties: ~azure.mgmt.nginx.models.NginxConfigurationResponseProperties - """ - - _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"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "NginxConfigurationResponseProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.NginxConfigurationResponseProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Nginx Configuration Response Properties. - :paramtype properties: ~azure.mgmt.nginx.models.NginxConfigurationResponseProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class NginxConfigurationResponseProperties(_serialization.Model): - """Nginx Configuration Response Properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Provisioning State. Known values are: "Accepted", "Creating", - "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", and "NotSpecified". - :vartype provisioning_state: str or ~azure.mgmt.nginx.models.ProvisioningState - :ivar files: - :vartype files: list[~azure.mgmt.nginx.models.NginxConfigurationFile] - :ivar protected_files: - :vartype protected_files: - list[~azure.mgmt.nginx.models.NginxConfigurationProtectedFileResponse] - :ivar package: Nginx Configuration 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"}, - } - - def __init__( - self, - *, - files: Optional[list["_models.NginxConfigurationFile"]] = None, - protected_files: Optional[list["_models.NginxConfigurationProtectedFileResponse"]] = 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.NginxConfigurationProtectedFileResponse] - :keyword package: Nginx Configuration Package. - :paramtype package: ~azure.mgmt.nginx.models.NginxConfigurationPackage - :keyword root_file: - :paramtype root_file: str - """ - super().__init__(**kwargs) - self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None - self.files = files - self.protected_files = protected_files - self.package = package - self.root_file = root_file - - -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. - - 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 - """ - - _validation = { - "id": {"readonly": True}, - "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"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, location: str, tags: Optional[dict[str, str]] = None, **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 - """ - super().__init__(**kwargs) - self.tags = tags - self.location = location - - -class NginxDeployment(TrackedResource): - """Nginx Deployment. - - 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 properties: Nginx Deployment Properties. - :vartype properties: ~azure.mgmt.nginx.models.NginxDeploymentProperties - :ivar identity: Identity Properties. - :vartype identity: ~azure.mgmt.nginx.models.IdentityProperties - :ivar sku: Resource Sku. - :vartype sku: ~azure.mgmt.nginx.models.ResourceSku - """ - - _validation = { - "id": {"readonly": True}, - "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"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "NginxDeploymentProperties"}, - "identity": {"key": "identity", "type": "IdentityProperties"}, - "sku": {"key": "sku", "type": "ResourceSku"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - properties: Optional["_models.NginxDeploymentProperties"] = None, - identity: Optional["_models.IdentityProperties"] = None, - sku: Optional["_models.ResourceSku"] = None, - **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 properties: Nginx Deployment Properties. - :paramtype properties: ~azure.mgmt.nginx.models.NginxDeploymentProperties - :keyword identity: Identity Properties. - :paramtype identity: ~azure.mgmt.nginx.models.IdentityProperties - :keyword sku: Resource Sku. - :paramtype sku: ~azure.mgmt.nginx.models.ResourceSku - """ - super().__init__(tags=tags, location=location, **kwargs) - self.properties = properties - self.identity = identity - self.sku = sku - - -class NginxDeploymentApiKeyListResponse(_serialization.Model): - """Nginx Deployment Api Key List Response. - - 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 NginxDeploymentApiKeyRequest(_serialization.Model): - """Nginx Deployment Api Key Request. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: - :vartype id: str - :ivar name: - :vartype name: str - :ivar type: - :vartype type: str - :ivar properties: Nginx Deployment Api Key Request Properties. - :vartype properties: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyRequestProperties - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.nginx.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "properties": {"key": "properties", "type": "NginxDeploymentApiKeyRequestProperties"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__( - self, *, properties: Optional["_models.NginxDeploymentApiKeyRequestProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Nginx Deployment Api Key Request Properties. - :paramtype properties: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyRequestProperties - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.properties = properties - self.system_data: Optional["_models.SystemData"] = None - - -class NginxDeploymentApiKeyRequestProperties(_serialization.Model): - """Nginx Deployment Api Key Request Properties. - - :ivar secret_text: Secret text to be used as a Dataplane API Key. This is a write only property - that can never be read back, but the first three characters will be returned in the 'hint' - 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(ProxyResource): - """Nginx Deployment Api Key Response. - - 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 properties: Nginx Deployment Api Key Response Properties. - :vartype properties: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponseProperties - """ - - _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"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "NginxDeploymentApiKeyResponseProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.NginxDeploymentApiKeyResponseProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Nginx Deployment Api Key Response Properties. - :paramtype properties: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponseProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class NginxDeploymentApiKeyResponseProperties(_serialization.Model): - """Nginx Deployment Api Key Response Properties. - - 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: Optional[str] = None - self.end_date_time = end_date_time - - -class NginxDeploymentDefaultWafPolicyListResponse(_serialization.Model): # pylint: disable=name-too-long - """Nginx Deployment Default Waf Policy List Response. - - :ivar value: - :vartype value: list[~azure.mgmt.nginx.models.NginxDeploymentDefaultWafPolicyProperties] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[NginxDeploymentDefaultWafPolicyProperties]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[list["_models.NginxDeploymentDefaultWafPolicyProperties"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: list[~azure.mgmt.nginx.models.NginxDeploymentDefaultWafPolicyProperties] - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class NginxDeploymentDefaultWafPolicyProperties(_serialization.Model): # pylint: disable=name-too-long - """Nginx Deployment Default Waf Policy Properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar content: - :vartype content: bytes - :ivar filepath: - :vartype filepath: str - """ - - _validation = { - "content": {"readonly": True}, - "filepath": {"readonly": True}, - } - - _attribute_map = { - "content": {"key": "content", "type": "bytearray"}, - "filepath": {"key": "filepath", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.content: Optional[bytes] = None - self.filepath: Optional[str] = None - - -class NginxDeploymentListResponse(_serialization.Model): - """Nginx Deployment List Response. - - 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 NginxDeploymentProperties(_serialization.Model): - """Nginx Deployment Properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Provisioning State. Known values are: "Accepted", "Creating", - "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", and "NotSpecified". - :vartype provisioning_state: str or ~azure.mgmt.nginx.models.ProvisioningState - :ivar nginx_version: - :vartype nginx_version: str - :ivar network_profile: Nginx Network Profile. - :vartype network_profile: ~azure.mgmt.nginx.models.NginxNetworkProfile - :ivar ip_address: The IP address of the deployment. - :vartype ip_address: str - :ivar enable_diagnostics_support: - :vartype enable_diagnostics_support: bool - :ivar logging: Nginx Logging. - :vartype logging: ~azure.mgmt.nginx.models.NginxLogging - :ivar scaling_properties: Information on how the deployment will be scaled. - :vartype scaling_properties: ~azure.mgmt.nginx.models.NginxDeploymentScalingProperties - :ivar auto_upgrade_profile: Autoupgrade settings of a deployment. - :vartype auto_upgrade_profile: ~azure.mgmt.nginx.models.AutoUpgradeProfile - :ivar user_profile: Nginx Deployment User Profile. - :vartype user_profile: ~azure.mgmt.nginx.models.NginxDeploymentUserProfile - :ivar dataplane_api_endpoint: Dataplane API endpoint for the caller to update the NGINX state - of the deployment. - :vartype dataplane_api_endpoint: str - :ivar web_application_firewall_settings: Settings for the NGINX App Protect Web Application - Firewall (WAF). - :vartype web_application_firewall_settings: - ~azure.mgmt.nginx.models.WebApplicationFirewallSettings - :ivar web_application_firewall_status: The status of the NGINX App Protect Web Application - Firewall. - :vartype web_application_firewall_status: ~azure.mgmt.nginx.models.WebApplicationFirewallStatus - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "nginx_version": {"readonly": True}, - "ip_address": {"readonly": True}, - "dataplane_api_endpoint": {"readonly": True}, - "web_application_firewall_status": {"readonly": True}, - } - - _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"}, - "dataplane_api_endpoint": {"key": "dataplaneApiEndpoint", "type": "str"}, - "web_application_firewall_settings": { - "key": "nginxAppProtect.webApplicationFirewallSettings", - "type": "WebApplicationFirewallSettings", - }, - "web_application_firewall_status": { - "key": "nginxAppProtect.webApplicationFirewallStatus", - "type": "WebApplicationFirewallStatus", - }, - } - - def __init__( - self, - *, - network_profile: Optional["_models.NginxNetworkProfile"] = None, - enable_diagnostics_support: Optional[bool] = None, - logging: Optional["_models.NginxLogging"] = None, - scaling_properties: Optional["_models.NginxDeploymentScalingProperties"] = None, - auto_upgrade_profile: Optional["_models.AutoUpgradeProfile"] = None, - user_profile: Optional["_models.NginxDeploymentUserProfile"] = None, - web_application_firewall_settings: Optional["_models.WebApplicationFirewallSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword network_profile: Nginx Network Profile. - :paramtype network_profile: ~azure.mgmt.nginx.models.NginxNetworkProfile - :keyword enable_diagnostics_support: - :paramtype enable_diagnostics_support: bool - :keyword logging: Nginx Logging. - :paramtype logging: ~azure.mgmt.nginx.models.NginxLogging - :keyword scaling_properties: Information on how the deployment will be scaled. - :paramtype scaling_properties: ~azure.mgmt.nginx.models.NginxDeploymentScalingProperties - :keyword auto_upgrade_profile: Autoupgrade settings of a deployment. - :paramtype auto_upgrade_profile: ~azure.mgmt.nginx.models.AutoUpgradeProfile - :keyword user_profile: Nginx Deployment User Profile. - :paramtype user_profile: ~azure.mgmt.nginx.models.NginxDeploymentUserProfile - :keyword web_application_firewall_settings: Settings for the NGINX App Protect Web Application - Firewall (WAF). - :paramtype web_application_firewall_settings: - ~azure.mgmt.nginx.models.WebApplicationFirewallSettings - """ - super().__init__(**kwargs) - self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None - self.nginx_version: Optional[str] = None - self.network_profile = network_profile - 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.dataplane_api_endpoint: Optional[str] = None - self.web_application_firewall_settings = web_application_firewall_settings - self.web_application_firewall_status: Optional["_models.WebApplicationFirewallStatus"] = None - - -class NginxDeploymentScalingProperties(_serialization.Model): - """Information on how the deployment will be scaled. - - :ivar capacity: - :vartype capacity: int - :ivar profiles: - :vartype profiles: list[~azure.mgmt.nginx.models.ScaleProfile] - """ - - _attribute_map = { - "capacity": {"key": "capacity", "type": "int"}, - "profiles": {"key": "autoScaleSettings.profiles", "type": "[ScaleProfile]"}, - } - - def __init__( - self, *, capacity: Optional[int] = None, profiles: Optional[list["_models.ScaleProfile"]] = None, **kwargs: Any - ) -> None: - """ - :keyword capacity: - :paramtype capacity: int - :keyword profiles: - :paramtype profiles: list[~azure.mgmt.nginx.models.ScaleProfile] - """ - super().__init__(**kwargs) - self.capacity = capacity - self.profiles = profiles - - -class NginxDeploymentUpdateParameters(_serialization.Model): - """Nginx Deployment Update Parameters. - - :ivar identity: Identity Properties. - :vartype identity: ~azure.mgmt.nginx.models.IdentityProperties - :ivar tags: Dictionary of :code:``. - :vartype tags: dict[str, str] - :ivar sku: Resource Sku. - :vartype sku: ~azure.mgmt.nginx.models.ResourceSku - :ivar location: The geo-location where the resource lives. - :vartype location: str - :ivar properties: Nginx Deployment Update Properties. - :vartype properties: ~azure.mgmt.nginx.models.NginxDeploymentUpdateProperties - """ - - _attribute_map = { - "identity": {"key": "identity", "type": "IdentityProperties"}, - "tags": {"key": "tags", "type": "{str}"}, - "sku": {"key": "sku", "type": "ResourceSku"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "NginxDeploymentUpdateProperties"}, - } - - def __init__( - self, - *, - identity: Optional["_models.IdentityProperties"] = None, - tags: Optional[dict[str, str]] = None, - sku: Optional["_models.ResourceSku"] = None, - location: Optional[str] = None, - properties: Optional["_models.NginxDeploymentUpdateProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword identity: Identity Properties. - :paramtype identity: ~azure.mgmt.nginx.models.IdentityProperties - :keyword tags: Dictionary of :code:``. - :paramtype tags: dict[str, str] - :keyword sku: Resource Sku. - :paramtype sku: ~azure.mgmt.nginx.models.ResourceSku - :keyword location: The geo-location where the resource lives. - :paramtype location: str - :keyword properties: Nginx Deployment Update Properties. - :paramtype properties: ~azure.mgmt.nginx.models.NginxDeploymentUpdateProperties - """ - super().__init__(**kwargs) - self.identity = identity - self.tags = tags - self.sku = sku - self.location = location - self.properties = properties - - -class NginxDeploymentUpdateProperties(_serialization.Model): - """Nginx Deployment Update Properties. - - :ivar enable_diagnostics_support: - :vartype enable_diagnostics_support: bool - :ivar logging: Nginx Logging. - :vartype logging: ~azure.mgmt.nginx.models.NginxLogging - :ivar scaling_properties: Information on how the deployment will be scaled. - :vartype scaling_properties: ~azure.mgmt.nginx.models.NginxDeploymentScalingProperties - :ivar user_profile: Nginx Deployment User Profile. - :vartype user_profile: ~azure.mgmt.nginx.models.NginxDeploymentUserProfile - :ivar network_profile: Nginx Network Profile. - :vartype network_profile: ~azure.mgmt.nginx.models.NginxNetworkProfile - :ivar auto_upgrade_profile: Autoupgrade settings of a deployment. - :vartype auto_upgrade_profile: ~azure.mgmt.nginx.models.AutoUpgradeProfile - :ivar web_application_firewall_settings: Settings for the NGINX App Protect Web Application - Firewall (WAF). - :vartype web_application_firewall_settings: - ~azure.mgmt.nginx.models.WebApplicationFirewallSettings - """ - - _attribute_map = { - "enable_diagnostics_support": {"key": "enableDiagnosticsSupport", "type": "bool"}, - "logging": {"key": "logging", "type": "NginxLogging"}, - "scaling_properties": {"key": "scalingProperties", "type": "NginxDeploymentScalingProperties"}, - "user_profile": {"key": "userProfile", "type": "NginxDeploymentUserProfile"}, - "network_profile": {"key": "networkProfile", "type": "NginxNetworkProfile"}, - "auto_upgrade_profile": {"key": "autoUpgradeProfile", "type": "AutoUpgradeProfile"}, - "web_application_firewall_settings": { - "key": "nginxAppProtect.webApplicationFirewallSettings", - "type": "WebApplicationFirewallSettings", - }, - } - - def __init__( - self, - *, - enable_diagnostics_support: Optional[bool] = None, - logging: Optional["_models.NginxLogging"] = None, - scaling_properties: Optional["_models.NginxDeploymentScalingProperties"] = None, - user_profile: Optional["_models.NginxDeploymentUserProfile"] = None, - network_profile: Optional["_models.NginxNetworkProfile"] = None, - auto_upgrade_profile: Optional["_models.AutoUpgradeProfile"] = None, - web_application_firewall_settings: Optional["_models.WebApplicationFirewallSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword enable_diagnostics_support: - :paramtype enable_diagnostics_support: bool - :keyword logging: Nginx Logging. - :paramtype logging: ~azure.mgmt.nginx.models.NginxLogging - :keyword scaling_properties: Information on how the deployment will be scaled. - :paramtype scaling_properties: ~azure.mgmt.nginx.models.NginxDeploymentScalingProperties - :keyword user_profile: Nginx Deployment User Profile. - :paramtype user_profile: ~azure.mgmt.nginx.models.NginxDeploymentUserProfile - :keyword network_profile: Nginx Network Profile. - :paramtype network_profile: ~azure.mgmt.nginx.models.NginxNetworkProfile - :keyword auto_upgrade_profile: Autoupgrade settings of a deployment. - :paramtype auto_upgrade_profile: ~azure.mgmt.nginx.models.AutoUpgradeProfile - :keyword web_application_firewall_settings: Settings for the NGINX App Protect Web Application - Firewall (WAF). - :paramtype web_application_firewall_settings: - ~azure.mgmt.nginx.models.WebApplicationFirewallSettings - """ - super().__init__(**kwargs) - self.enable_diagnostics_support = enable_diagnostics_support - self.logging = logging - self.scaling_properties = scaling_properties - self.user_profile = user_profile - self.network_profile = network_profile - self.auto_upgrade_profile = auto_upgrade_profile - self.web_application_firewall_settings = web_application_firewall_settings - - -class NginxDeploymentUserProfile(_serialization.Model): - """Nginx Deployment User Profile. - - :ivar preferred_email: The preferred support contact email address of the user used for sending - alerts and notification. Can be an empty string or a valid email address. - :vartype preferred_email: str - """ - - _validation = { - "preferred_email": {"pattern": r"^$|^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\.)+[A-Za-z]{2,}$"}, - } - - _attribute_map = { - "preferred_email": {"key": "preferredEmail", "type": "str"}, - } - - def __init__(self, *, preferred_email: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword preferred_email: The preferred support contact email address of the user used for - sending alerts and notification. Can be an empty string or a valid email address. - :paramtype preferred_email: str - """ - super().__init__(**kwargs) - self.preferred_email = preferred_email - - -class NginxDeploymentWafPolicy(ProxyResource): - """Nginx Deployment Waf Policy. - - 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 properties: Nginx Deployment Waf Policy Properties. - :vartype properties: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyProperties - """ - - _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"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "NginxDeploymentWafPolicyProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.NginxDeploymentWafPolicyProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Nginx Deployment Waf Policy Properties. - :paramtype properties: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class NginxDeploymentWafPolicyApplyingStatus(_serialization.Model): - """Nginx Deployment Waf Policy Applying Status. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Machine readable code indicating the applying status code of a WAF Policy. Known - values are: "NotApplied", "Applying", "Succeeded", "Failed", and "Removing". - :vartype code: str or ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyApplyingStatusCode - :ivar display_status: A readable string of the current status, and sometimes have the reason - for the current state. - :vartype display_status: str - :ivar time: The date and time in UTC the current applying status was set. - :vartype time: str - """ - - _validation = { - "code": {"readonly": True}, - "display_status": {"readonly": True}, - "time": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "display_status": {"key": "displayStatus", "type": "str"}, - "time": {"key": "time", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code: Optional[Union[str, "_models.NginxDeploymentWafPolicyApplyingStatusCode"]] = None - self.display_status: Optional[str] = None - self.time: Optional[str] = None - - -class NginxDeploymentWafPolicyCompilingStatus(_serialization.Model): - """Nginx Deployment Waf Policy Compiling Status. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Machine readable code indicating the compilation status of a WAF Policy. Known - values are: "NotStarted", "InProgress", "Succeeded", and "Failed". - :vartype code: str or ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyCompilingStatusCode - :ivar display_status: A readable string of the current status, and sometimes have the reason - for the current state. If the CompilingStatus is Failed the Display Status will be The waf - Policy failed to compile. - :vartype display_status: str - :ivar time: The date and time the policy was compiled in UTC. - :vartype time: str - """ - - _validation = { - "code": {"readonly": True}, - "display_status": {"readonly": True}, - "time": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "display_status": {"key": "displayStatus", "type": "str"}, - "time": {"key": "time", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code: Optional[Union[str, "_models.NginxDeploymentWafPolicyCompilingStatusCode"]] = None - self.display_status: Optional[str] = None - self.time: Optional[str] = None - - -class NginxDeploymentWafPolicyListResponse(_serialization.Model): - """Nginx Deployment Waf Policy List Response. - - All required parameters must be populated in order to send to server. - - :ivar value: The NginxDeploymentWafPolicyMetadata items on this page. Required. - :vartype value: list[~azure.mgmt.nginx.models.NginxDeploymentWafPolicyMetadata] - :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": "[NginxDeploymentWafPolicyMetadata]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: list["_models.NginxDeploymentWafPolicyMetadata"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The NginxDeploymentWafPolicyMetadata items on this page. Required. - :paramtype value: list[~azure.mgmt.nginx.models.NginxDeploymentWafPolicyMetadata] - :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 NginxDeploymentWafPolicyMetadata(_serialization.Model): - """Nginx Deployment Waf Policy Metadata. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: - :vartype id: str - :ivar name: - :vartype name: str - :ivar type: - :vartype type: str - :ivar properties: Nginx Deployment Waf Policy Metadata Properties. - :vartype properties: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyMetadataProperties - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.nginx.models.SystemData - """ - - _validation = { - "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": "NginxDeploymentWafPolicyMetadataProperties"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__( - self, *, properties: Optional["_models.NginxDeploymentWafPolicyMetadataProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Nginx Deployment Waf Policy Metadata Properties. - :paramtype properties: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyMetadataProperties - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.properties = properties - self.system_data: Optional["_models.SystemData"] = None - - -class NginxDeploymentWafPolicyMetadataProperties(_serialization.Model): # pylint: disable=name-too-long - """Nginx Deployment Waf Policy Metadata Properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar filepath: - :vartype filepath: str - :ivar provisioning_state: Provisioning State. Known values are: "Accepted", "Creating", - "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", and "NotSpecified". - :vartype provisioning_state: str or ~azure.mgmt.nginx.models.ProvisioningState - :ivar compiling_state: Nginx Deployment Waf Policy Compiling Status. - :vartype compiling_state: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyCompilingStatus - :ivar applying_state: Nginx Deployment Waf Policy Applying Status. - :vartype applying_state: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyApplyingStatus - """ - - _validation = { - "filepath": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "compiling_state": {"readonly": True}, - "applying_state": {"readonly": True}, - } - - _attribute_map = { - "filepath": {"key": "filepath", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "compiling_state": {"key": "compilingState", "type": "NginxDeploymentWafPolicyCompilingStatus"}, - "applying_state": {"key": "applyingState", "type": "NginxDeploymentWafPolicyApplyingStatus"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.filepath: Optional[str] = None - self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None - self.compiling_state: Optional["_models.NginxDeploymentWafPolicyCompilingStatus"] = None - self.applying_state: Optional["_models.NginxDeploymentWafPolicyApplyingStatus"] = None - - -class NginxDeploymentWafPolicyProperties(_serialization.Model): - """Nginx Deployment Waf Policy Properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Provisioning State. Known values are: "Accepted", "Creating", - "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", and "NotSpecified". - :vartype provisioning_state: str or ~azure.mgmt.nginx.models.ProvisioningState - :ivar content: The byte content of the Policy. - :vartype content: bytes - :ivar filepath: The file path where the Policy is to be saved. - :vartype filepath: str - :ivar compiling_state: Nginx Deployment Waf Policy Compiling Status. - :vartype compiling_state: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyCompilingStatus - :ivar applying_state: Nginx Deployment Waf Policy Applying Status. - :vartype applying_state: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyApplyingStatus - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "compiling_state": {"readonly": True}, - "applying_state": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "content": {"key": "content", "type": "bytearray"}, - "filepath": {"key": "filepath", "type": "str"}, - "compiling_state": {"key": "compilingState", "type": "NginxDeploymentWafPolicyCompilingStatus"}, - "applying_state": {"key": "applyingState", "type": "NginxDeploymentWafPolicyApplyingStatus"}, - } - - def __init__(self, *, content: Optional[bytes] = None, filepath: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword content: The byte content of the Policy. - :paramtype content: bytes - :keyword filepath: The file path where the Policy is to be saved. - :paramtype filepath: str - """ - super().__init__(**kwargs) - self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None - self.content = content - self.filepath = filepath - self.compiling_state: Optional["_models.NginxDeploymentWafPolicyCompilingStatus"] = None - self.applying_state: Optional["_models.NginxDeploymentWafPolicyApplyingStatus"] = None - - -class NginxFrontendIPConfiguration(_serialization.Model): - """Nginx Frontend IP Configuration. - - :ivar public_ip_addresses: - :vartype public_ip_addresses: list[~azure.mgmt.nginx.models.NginxPublicIPAddress] - :ivar private_ip_addresses: - :vartype private_ip_addresses: list[~azure.mgmt.nginx.models.NginxPrivateIPAddress] - """ - - _attribute_map = { - "public_ip_addresses": {"key": "publicIPAddresses", "type": "[NginxPublicIPAddress]"}, - "private_ip_addresses": {"key": "privateIPAddresses", "type": "[NginxPrivateIPAddress]"}, - } - - def __init__( - self, - *, - public_ip_addresses: Optional[list["_models.NginxPublicIPAddress"]] = None, - private_ip_addresses: Optional[list["_models.NginxPrivateIPAddress"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword public_ip_addresses: - :paramtype public_ip_addresses: list[~azure.mgmt.nginx.models.NginxPublicIPAddress] - :keyword private_ip_addresses: - :paramtype private_ip_addresses: list[~azure.mgmt.nginx.models.NginxPrivateIPAddress] - """ - super().__init__(**kwargs) - self.public_ip_addresses = public_ip_addresses - self.private_ip_addresses = private_ip_addresses - - -class NginxLogging(_serialization.Model): - """Nginx Logging. - - :ivar storage_account: Nginx Storage Account. - :vartype storage_account: ~azure.mgmt.nginx.models.NginxStorageAccount - """ - - _attribute_map = { - "storage_account": {"key": "storageAccount", "type": "NginxStorageAccount"}, - } - - def __init__(self, *, storage_account: Optional["_models.NginxStorageAccount"] = None, **kwargs: Any) -> None: - """ - :keyword storage_account: Nginx Storage Account. - :paramtype storage_account: ~azure.mgmt.nginx.models.NginxStorageAccount - """ - super().__init__(**kwargs) - self.storage_account = storage_account - - -class NginxNetworkInterfaceConfiguration(_serialization.Model): - """Nginx Network Interface Configuration. - - :ivar subnet_id: - :vartype subnet_id: str - """ - - _attribute_map = { - "subnet_id": {"key": "subnetId", "type": "str"}, - } - - def __init__(self, *, subnet_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword subnet_id: - :paramtype subnet_id: str - """ - super().__init__(**kwargs) - self.subnet_id = subnet_id - - -class NginxNetworkProfile(_serialization.Model): - """Nginx Network Profile. - - :ivar front_end_ip_configuration: Nginx Frontend IP Configuration. - :vartype front_end_ip_configuration: ~azure.mgmt.nginx.models.NginxFrontendIPConfiguration - :ivar network_interface_configuration: Nginx Network Interface Configuration. - :vartype network_interface_configuration: - ~azure.mgmt.nginx.models.NginxNetworkInterfaceConfiguration - """ - - _attribute_map = { - "front_end_ip_configuration": {"key": "frontEndIPConfiguration", "type": "NginxFrontendIPConfiguration"}, - "network_interface_configuration": { - "key": "networkInterfaceConfiguration", - "type": "NginxNetworkInterfaceConfiguration", - }, - } - - def __init__( - self, - *, - front_end_ip_configuration: Optional["_models.NginxFrontendIPConfiguration"] = None, - network_interface_configuration: Optional["_models.NginxNetworkInterfaceConfiguration"] = None, - **kwargs: Any - ) -> None: - """ - :keyword front_end_ip_configuration: Nginx Frontend IP Configuration. - :paramtype front_end_ip_configuration: ~azure.mgmt.nginx.models.NginxFrontendIPConfiguration - :keyword network_interface_configuration: Nginx Network Interface Configuration. - :paramtype network_interface_configuration: - ~azure.mgmt.nginx.models.NginxNetworkInterfaceConfiguration - """ - super().__init__(**kwargs) - self.front_end_ip_configuration = front_end_ip_configuration - self.network_interface_configuration = network_interface_configuration - - -class NginxPrivateIPAddress(_serialization.Model): - """Nginx Private IP Address. - - :ivar private_ip_address: - :vartype private_ip_address: str - :ivar private_ip_allocation_method: Nginx Private IP Allocation Method. Known values are: - "Static" and "Dynamic". - :vartype private_ip_allocation_method: str or - ~azure.mgmt.nginx.models.NginxPrivateIPAllocationMethod - :ivar subnet_id: - :vartype subnet_id: str - """ - - _attribute_map = { - "private_ip_address": {"key": "privateIPAddress", "type": "str"}, - "private_ip_allocation_method": {"key": "privateIPAllocationMethod", "type": "str"}, - "subnet_id": {"key": "subnetId", "type": "str"}, - } - - def __init__( - self, - *, - private_ip_address: Optional[str] = None, - private_ip_allocation_method: Optional[Union[str, "_models.NginxPrivateIPAllocationMethod"]] = None, - subnet_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword private_ip_address: - :paramtype private_ip_address: str - :keyword private_ip_allocation_method: Nginx Private IP Allocation Method. Known values are: - "Static" and "Dynamic". - :paramtype private_ip_allocation_method: str or - ~azure.mgmt.nginx.models.NginxPrivateIPAllocationMethod - :keyword subnet_id: - :paramtype subnet_id: str - """ - super().__init__(**kwargs) - self.private_ip_address = private_ip_address - self.private_ip_allocation_method = private_ip_allocation_method - self.subnet_id = subnet_id - - -class NginxPublicIPAddress(_serialization.Model): - """Nginx Public IP Address. - - :ivar id: - :vartype id: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - } - - def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class NginxStorageAccount(_serialization.Model): - """Nginx Storage Account. - - :ivar account_name: - :vartype account_name: str - :ivar container_name: - :vartype container_name: str - """ - - _attribute_map = { - "account_name": {"key": "accountName", "type": "str"}, - "container_name": {"key": "containerName", "type": "str"}, - } - - def __init__( - self, *, account_name: Optional[str] = None, container_name: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword account_name: - :paramtype account_name: str - :keyword container_name: - :paramtype container_name: str - """ - super().__init__(**kwargs) - self.account_name = account_name - self.container_name = container_name - - -class Operation(_serialization.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - :vartype name: str - :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for - data-plane operations and "false" for ARM/control-plane operations. - :vartype is_data_action: bool - :ivar display: Localized display information for this particular operation. - :vartype display: ~azure.mgmt.nginx.models.OperationDisplay - :ivar origin: The intended executor of the operation; as in Resource Based Access Control - (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", - and "user,system". - :vartype origin: str or ~azure.mgmt.nginx.models.Origin - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" - :vartype action_type: str or ~azure.mgmt.nginx.models.ActionType - """ - - _validation = { - "name": {"readonly": True}, - "is_data_action": {"readonly": True}, - "origin": {"readonly": True}, - "action_type": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - "display": {"key": "display", "type": "OperationDisplay"}, - "origin": {"key": "origin", "type": "str"}, - "action_type": {"key": "actionType", "type": "str"}, - } - - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: - """ - :keyword display: Localized display information for this particular operation. - :paramtype display: ~azure.mgmt.nginx.models.OperationDisplay - """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.is_data_action: Optional[bool] = None - self.display = display - self.origin: Optional[Union[str, "_models.Origin"]] = None - self.action_type: Optional[Union[str, "_models.ActionType"]] = None - - -class OperationDisplay(_serialization.Model): - """Localized display information for this particular operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft - Monitoring Insights" or "Microsoft Compute". - :vartype provider: str - :ivar resource: The localized friendly name of the resource type related to this operation. - E.g. "Virtual Machines" or "Job Schedule Collections". - :vartype resource: str - :ivar operation: The concise, localized friendly name for the operation; suitable for - dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - :vartype operation: str - :ivar description: The short, localized friendly description of the operation; suitable for - tool tips and detailed views. - :vartype description: str - """ - - _validation = { - "provider": {"readonly": True}, - "resource": {"readonly": True}, - "operation": {"readonly": True}, - "description": {"readonly": True}, - } - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provider: Optional[str] = None - self.resource: Optional[str] = None - self.operation: Optional[str] = None - self.description: Optional[str] = None - - -class 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. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of operations supported by the resource provider. - :vartype value: list[~azure.mgmt.nginx.models.Operation] - :ivar next_link: URL to get the next set of operation list results (if there are any). - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value: Optional[list["_models.Operation"]] = None - self.next_link: Optional[str] = None - - -class ResourceSku(_serialization.Model): - """Resource Sku. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the SKU. Required. - :vartype name: str - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: Name of the SKU. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class ScaleProfile(_serialization.Model): - """The autoscale profile. - - All required parameters must be populated in order to send to server. - - :ivar name: Required. - :vartype name: str - :ivar min: The minimum number of NCUs the deployment can be autoscaled to. Required. - :vartype min: int - :ivar max: The maximum number of NCUs the deployment can be autoscaled to. Required. - :vartype max: int - """ - - _validation = { - "name": {"required": True}, - "min": {"required": True}, - "max": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "min": {"key": "capacity.min", "type": "int"}, - "max": {"key": "capacity.max", "type": "int"}, - } - - def __init__( - self, - *, - name: str, - min: int, # pylint: disable=redefined-builtin - max: int, # pylint: disable=redefined-builtin - **kwargs: Any - ) -> None: - """ - :keyword name: Required. - :paramtype name: str - :keyword min: The minimum number of NCUs the deployment can be autoscaled to. Required. - :paramtype min: int - :keyword max: The maximum number of NCUs the deployment can be autoscaled to. Required. - :paramtype max: int - """ - super().__init__(**kwargs) - self.name = name - self.min = min - self.max = max - - -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.mgmt.nginx.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or ~azure.mgmt.nginx.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or ~azure.mgmt.nginx.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or ~azure.mgmt.nginx.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__(**kwargs) - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at - - -class UserIdentityProperties(_serialization.Model): - """User Identity Properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: - :vartype principal_id: str - :ivar client_id: - :vartype client_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id: Optional[str] = None - self.client_id: Optional[str] = None - - -class WebApplicationFirewallComponentVersions(_serialization.Model): - """Versions of the NGINX App Protect Web Application Firewall (WAF) components. - - All required parameters must be populated in order to send to server. - - :ivar waf_engine_version: The version of the NGINX App Protect Web Application Firewall (WAF) - engine. Required. - :vartype waf_engine_version: str - :ivar waf_nginx_version: The version of the NGINX App Protect Web Application Firewall (WAF) - module for NGINX. Required. - :vartype waf_nginx_version: str - """ - - _validation = { - "waf_engine_version": {"required": True}, - "waf_nginx_version": {"required": True}, - } - - _attribute_map = { - "waf_engine_version": {"key": "wafEngineVersion", "type": "str"}, - "waf_nginx_version": {"key": "wafNginxVersion", "type": "str"}, - } - - def __init__(self, *, waf_engine_version: str, waf_nginx_version: str, **kwargs: Any) -> None: - """ - :keyword waf_engine_version: The version of the NGINX App Protect Web Application Firewall - (WAF) engine. Required. - :paramtype waf_engine_version: str - :keyword waf_nginx_version: The version of the NGINX App Protect Web Application Firewall (WAF) - module for NGINX. Required. - :paramtype waf_nginx_version: str - """ - super().__init__(**kwargs) - self.waf_engine_version = waf_engine_version - self.waf_nginx_version = waf_nginx_version - - -class WebApplicationFirewallPackage(_serialization.Model): - """NGINX App Protect Web Application Firewall (WAF) Package. Contains the version and revision - date of the package. - - All required parameters must be populated in order to send to server. - - :ivar version: The version of the NGINX App Protect Web Application Firewall (WAF) package. - Required. - :vartype version: str - :ivar revision_datetime: The date and time of the package revision. Required. - :vartype revision_datetime: ~datetime.datetime - """ - - _validation = { - "version": {"required": True}, - "revision_datetime": {"required": True}, - } - - _attribute_map = { - "version": {"key": "version", "type": "str"}, - "revision_datetime": {"key": "revisionDatetime", "type": "iso-8601"}, - } - - def __init__(self, *, version: str, revision_datetime: datetime.datetime, **kwargs: Any) -> None: - """ - :keyword version: The version of the NGINX App Protect Web Application Firewall (WAF) package. - Required. - :paramtype version: str - :keyword revision_datetime: The date and time of the package revision. Required. - :paramtype revision_datetime: ~datetime.datetime - """ - super().__init__(**kwargs) - self.version = version - self.revision_datetime = revision_datetime - - -class WebApplicationFirewallSettings(_serialization.Model): - """Settings for the NGINX App Protect Web Application Firewall (WAF). - - :ivar activation_state: The activation state of the WAF. Use 'Enabled' to enable the WAF and - 'Disabled' to disable it. Known values are: "Enabled" and "Disabled". - :vartype activation_state: str or ~azure.mgmt.nginx.models.ActivationState - """ - - _attribute_map = { - "activation_state": {"key": "activationState", "type": "str"}, - } - - def __init__( - self, *, activation_state: Optional[Union[str, "_models.ActivationState"]] = None, **kwargs: Any - ) -> None: - """ - :keyword activation_state: The activation state of the WAF. Use 'Enabled' to enable the WAF and - 'Disabled' to disable it. Known values are: "Enabled" and "Disabled". - :paramtype activation_state: str or ~azure.mgmt.nginx.models.ActivationState - """ - super().__init__(**kwargs) - self.activation_state = activation_state - - -class WebApplicationFirewallStatus(_serialization.Model): - """The status of the NGINX App Protect Web Application Firewall. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar waf_release: NGINX App Protect WAF release version. - :vartype waf_release: str - :ivar attack_signatures_package: Package containing attack signatures for the NGINX App Protect - Web Application Firewall (WAF). - :vartype attack_signatures_package: ~azure.mgmt.nginx.models.WebApplicationFirewallPackage - :ivar bot_signatures_package: Package containing bot signatures for the NGINX App Protect Web - Application Firewall (WAF). - :vartype bot_signatures_package: ~azure.mgmt.nginx.models.WebApplicationFirewallPackage - :ivar threat_campaigns_package: Package containing threat campaigns for the NGINX App Protect - Web Application Firewall (WAF). - :vartype threat_campaigns_package: ~azure.mgmt.nginx.models.WebApplicationFirewallPackage - :ivar component_versions: Versions of the NGINX App Protect Web Application Firewall (WAF) - components. - :vartype component_versions: ~azure.mgmt.nginx.models.WebApplicationFirewallComponentVersions - """ - - _validation = { - "attack_signatures_package": {"readonly": True}, - "bot_signatures_package": {"readonly": True}, - "threat_campaigns_package": {"readonly": True}, - "component_versions": {"readonly": True}, - } - - _attribute_map = { - "waf_release": {"key": "wafRelease", "type": "str"}, - "attack_signatures_package": {"key": "attackSignaturesPackage", "type": "WebApplicationFirewallPackage"}, - "bot_signatures_package": {"key": "botSignaturesPackage", "type": "WebApplicationFirewallPackage"}, - "threat_campaigns_package": {"key": "threatCampaignsPackage", "type": "WebApplicationFirewallPackage"}, - "component_versions": {"key": "componentVersions", "type": "WebApplicationFirewallComponentVersions"}, - } - - def __init__(self, *, waf_release: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword waf_release: NGINX App Protect WAF release version. - :paramtype waf_release: str - """ - super().__init__(**kwargs) - self.waf_release = waf_release - self.attack_signatures_package: Optional["_models.WebApplicationFirewallPackage"] = None - self.bot_signatures_package: Optional["_models.WebApplicationFirewallPackage"] = None - self.threat_campaigns_package: Optional["_models.WebApplicationFirewallPackage"] = None - self.component_versions: Optional["_models.WebApplicationFirewallComponentVersions"] = None diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/__init__.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/__init__.py index 8896f281e12d..7521d12a90da 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -13,12 +13,13 @@ 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 ._default_waf_policy_operations import DefaultWafPolicyOperations # type: ignore -from ._waf_policy_operations import WafPolicyOperations # type: ignore +from ._operations import NginxDeploymentWafPoliciesOperations # type: ignore +from ._operations import ApiKeysOperations # type: ignore +from ._operations import DeploymentsOperations # type: ignore +from ._operations import WafPolicyOperations # type: ignore +from ._operations import DefaultWafPolicyOperations # type: ignore +from ._operations import CertificatesOperations # type: ignore +from ._operations import ConfigurationsOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -26,12 +27,13 @@ __all__ = [ "Operations", - "DeploymentsOperations", + "NginxDeploymentWafPoliciesOperations", "ApiKeysOperations", + "DeploymentsOperations", + "WafPolicyOperations", + "DefaultWafPolicyOperations", "CertificatesOperations", "ConfigurationsOperations", - "DefaultWafPolicyOperations", - "WafPolicyOperations", ] __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 deleted file mode 100644 index 6c3a1f1536a5..000000000000 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_api_keys_operations.py +++ /dev/null @@ -1,589 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import NginxManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, deployment_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/apiKeys", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "deploymentName": _SERIALIZER.url( - "deployment_name", - deployment_name, - "str", - pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -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 {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/apiKeys/{apiKeyName}", - ) - 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])$", - ), - "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 - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_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", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/apiKeys/{apiKeyName}", - ) - 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])$", - ), - "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 - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, deployment_name: str, 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", "2025-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/apiKeys/{apiKeyName}", - ) - 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])$", - ), - "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 - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiKeysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.nginx.NginxManagementClient`'s - :attr:`api_keys` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, deployment_name: str, **kwargs: Any - ) -> ItemPaged["_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( - self, - resource_group_name: str, - deployment_name: str, - api_key_name: str, - body: Optional[_models.NginxDeploymentApiKeyRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NginxDeploymentApiKeyResponse: - """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 - :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 - :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 - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NginxDeploymentApiKeyResponse or the result of cls(response) - :rtype: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - deployment_name: str, - api_key_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NginxDeploymentApiKeyResponse: - """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 - :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 - :param body: The API Key object containing fields (e.g. secret text, expiration date) to upsert - the key. Default value is None. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NginxDeploymentApiKeyResponse or the result of cls(response) - :rtype: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - deployment_name: str, - api_key_name: str, - body: Optional[Union[_models.NginxDeploymentApiKeyRequest, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.NginxDeploymentApiKeyResponse: - """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 - :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 - :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] - :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if body else None - cls: ClsType[_models.NginxDeploymentApiKeyResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "NginxDeploymentApiKeyRequest") - else: - _json = None - - _request = build_create_or_update_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, - content_type=content_type, - json=_json, - content=_content, - 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, 201]: - 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 delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, deployment_name: str, api_key_name: str, **kwargs: Any - ) -> None: - """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 - :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: None or the result of cls(response) - :rtype: None - :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[None] = kwargs.pop("cls", None) - - _request = build_delete_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, 204]: - 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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore 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 deleted file mode 100644 index 6031b85fa006..000000000000 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_certificates_operations.py +++ /dev/null @@ -1,729 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import NginxManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, deployment_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "deploymentName": _SERIALIZER.url( - "deployment_name", - deployment_name, - "str", - pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -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", "2025-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates/{certificateName}", - ) - 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])$", - ), - "certificateName": _SERIALIZER.url( - "certificate_name", - certificate_name, - "str", - pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_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", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates/{certificateName}", - ) - 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])$", - ), - "certificateName": _SERIALIZER.url( - "certificate_name", - certificate_name, - "str", - pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, deployment_name: str, 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", "2025-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates/{certificateName}", - ) - 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])$", - ), - "certificateName": _SERIALIZER.url( - "certificate_name", - certificate_name, - "str", - pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.nginx.NginxManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, deployment_name: str, **kwargs: Any - ) -> ItemPaged["_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( - self, resource_group_name: str, deployment_name: str, certificate_name: str, **kwargs: Any - ) -> _models.NginxCertificate: - """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 - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :param certificate_name: The name of certificate. Required. - :type certificate_name: str - :return: NginxCertificate or the result of cls(response) - :rtype: ~azure.mgmt.nginx.models.NginxCertificate - :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.NginxCertificate] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - certificate_name=certificate_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("NginxCertificate", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - deployment_name: str, - certificate_name: str, - body: Optional[Union[_models.NginxCertificate, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if body else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "NginxCertificate") - else: - _json = None - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["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, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - deployment_name: str, - certificate_name: str, - body: Optional[_models.NginxCertificate] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.NginxCertificate]: - """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 - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :param certificate_name: The name of certificate. Required. - :type certificate_name: str - :param body: The certificate. Default value is None. - :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". - :paramtype content_type: str - :return: An instance of LROPoller that returns either NginxCertificate or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxCertificate] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - deployment_name: str, - certificate_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.NginxCertificate]: - """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 - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :param certificate_name: The name of certificate. Required. - :type certificate_name: str - :param body: The certificate. Default value is None. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either NginxCertificate or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxCertificate] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - deployment_name: str, - certificate_name: str, - body: Optional[Union[_models.NginxCertificate, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.NginxCertificate]: - """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 - :param deployment_name: The name of targeted NGINX deployment. Required. - :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. - :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) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxCertificate] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if body else None - cls: ClsType[_models.NginxCertificate] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - certificate_name=certificate_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("NginxCertificate", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.NginxCertificate].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.NginxCertificate]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, deployment_name: str, certificate_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, deployment_name: str, certificate_name: str, **kwargs: Any - ) -> LROPoller[None]: - """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 - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :param certificate_name: The name of certificate. Required. - :type certificate_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - certificate_name=certificate_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore 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 deleted file mode 100644 index eb7b0bae4eca..000000000000 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_configurations_operations.py +++ /dev/null @@ -1,921 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import NginxManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, deployment_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "deploymentName": _SERIALIZER.url( - "deployment_name", - deployment_name, - "str", - pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, deployment_name: str, configuration_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}", - ) - 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])$", - ), - "configurationName": _SERIALIZER.url( - "configuration_name", configuration_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, deployment_name: str, configuration_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}", - ) - 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])$", - ), - "configurationName": _SERIALIZER.url( - "configuration_name", configuration_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, deployment_name: str, configuration_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}", - ) - 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])$", - ), - "configurationName": _SERIALIZER.url( - "configuration_name", configuration_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_analysis_request( - resource_group_name: str, deployment_name: str, configuration_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}/analyze", - ) - 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])$", - ), - "configurationName": _SERIALIZER.url( - "configuration_name", configuration_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigurationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.nginx.NginxManagementClient`'s - :attr:`configurations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, deployment_name: str, **kwargs: Any - ) -> ItemPaged["_models.NginxConfigurationResponse"]: - """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 - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :return: An iterator like instance of either NginxConfigurationResponse or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.nginx.models.NginxConfigurationResponse] - :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.NginxConfigurationListResponse] = 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("NginxConfigurationListResponse", 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, configuration_name: str, **kwargs: Any - ) -> _models.NginxConfigurationResponse: - """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 - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :param configuration_name: The name of configuration, only 'default' is supported value due to - the singleton of NGINX conf. Required. - :type configuration_name: str - :return: NginxConfigurationResponse or the result of cls(response) - :rtype: ~azure.mgmt.nginx.models.NginxConfigurationResponse - :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.NginxConfigurationResponse] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - configuration_name=configuration_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("NginxConfigurationResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - deployment_name: str, - configuration_name: str, - body: Optional[Union[_models.NginxConfigurationRequest, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if body else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "NginxConfigurationRequest") - else: - _json = None - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - configuration_name=configuration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["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, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - deployment_name: str, - configuration_name: str, - body: Optional[_models.NginxConfigurationRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.NginxConfigurationResponse]: - """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 - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :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 - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either NginxConfigurationResponse or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxConfigurationResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - deployment_name: str, - configuration_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.NginxConfigurationResponse]: - """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 - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :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: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either NginxConfigurationResponse or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxConfigurationResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - deployment_name: str, - configuration_name: str, - body: Optional[Union[_models.NginxConfigurationRequest, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.NginxConfigurationResponse]: - """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 - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :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] - :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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if body else None - cls: ClsType[_models.NginxConfigurationResponse] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - configuration_name=configuration_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("NginxConfigurationResponse", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.NginxConfigurationResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.NginxConfigurationResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, deployment_name: str, configuration_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - configuration_name=configuration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, deployment_name: str, configuration_name: str, **kwargs: Any - ) -> LROPoller[None]: - """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 - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :param configuration_name: The name of configuration, only 'default' is supported value due to - the singleton of NGINX conf. Required. - :type configuration_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - configuration_name=configuration_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def analysis( - self, - resource_group_name: str, - deployment_name: str, - configuration_name: str, - body: Optional[_models.AnalysisCreate] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AnalysisResult: - """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 - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :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 to analyze. Default value is None. - :type body: ~azure.mgmt.nginx.models.AnalysisCreate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AnalysisResult or the result of cls(response) - :rtype: ~azure.mgmt.nginx.models.AnalysisResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def analysis( - self, - resource_group_name: str, - deployment_name: str, - configuration_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AnalysisResult: - """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 - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :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 to analyze. Default value is None. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: AnalysisResult or the result of cls(response) - :rtype: ~azure.mgmt.nginx.models.AnalysisResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def analysis( - self, - resource_group_name: str, - deployment_name: str, - configuration_name: str, - body: Optional[Union[_models.AnalysisCreate, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.AnalysisResult: - """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 - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :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 to analyze. Is either a AnalysisCreate type or a IO[bytes] - type. Default value is None. - :type body: ~azure.mgmt.nginx.models.AnalysisCreate or IO[bytes] - :return: AnalysisResult or the result of cls(response) - :rtype: ~azure.mgmt.nginx.models.AnalysisResult - :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if body else None - cls: ClsType[_models.AnalysisResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "AnalysisCreate") - else: - _json = None - - _request = build_analysis_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - configuration_name=configuration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _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("AnalysisResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_default_waf_policy_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_default_waf_policy_operations.py deleted file mode 100644 index d7a64087087f..000000000000 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_default_waf_policy_operations.py +++ /dev/null @@ -1,155 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import NginxManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, deployment_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/listDefaultWafPolicies", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "deploymentName": _SERIALIZER.url( - "deployment_name", - deployment_name, - "str", - pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DefaultWafPolicyOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.nginx.NginxManagementClient`'s - :attr:`default_waf_policy` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, deployment_name: str, **kwargs: Any - ) -> _models.NginxDeploymentDefaultWafPolicyListResponse: - """Get the Nginx Waf Policy of given Nginx deployment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :return: NginxDeploymentDefaultWafPolicyListResponse or the result of cls(response) - :rtype: ~azure.mgmt.nginx.models.NginxDeploymentDefaultWafPolicyListResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.NginxDeploymentDefaultWafPolicyListResponse] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("NginxDeploymentDefaultWafPolicyListResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_deployments_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_deployments_operations.py deleted file mode 100644 index 362869e4c9e2..000000000000 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_deployments_operations.py +++ /dev/null @@ -1,1026 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import NginxManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Nginx.NginxPlus/nginxDeployments") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_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", "2025-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments", - ) - 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 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_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", "2025-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "deploymentName": _SERIALIZER.url( - "deployment_name", - deployment_name, - "str", - pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -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", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "deploymentName": _SERIALIZER.url( - "deployment_name", - deployment_name, - "str", - pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_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", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "deploymentName": _SERIALIZER.url( - "deployment_name", - deployment_name, - "str", - pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_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 {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "deploymentName": _SERIALIZER.url( - "deployment_name", - deployment_name, - "str", - pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class DeploymentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.nginx.NginxManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_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) -> ItemPaged["_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. - - :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: NginxDeployment or the result of cls(response) - :rtype: ~azure.mgmt.nginx.models.NginxDeployment - :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.NginxDeployment] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("NginxDeployment", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - deployment_name: str, - body: Optional[Union[_models.NginxDeployment, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if body else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "NginxDeployment") - else: - _json = None - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["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, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - deployment_name: str, - body: Optional[_models.NginxDeployment] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.NginxDeployment]: - """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: The Nginx deployment. Default value is None. - :type body: ~azure.mgmt.nginx.models.NginxDeployment - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either NginxDeployment or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxDeployment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - deployment_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.NginxDeployment]: - """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: The Nginx deployment. Default value is None. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either NginxDeployment or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxDeployment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - deployment_name: str, - body: Optional[Union[_models.NginxDeployment, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.NginxDeployment]: - """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: The Nginx deployment. Is either a NginxDeployment type or a IO[bytes] type. - Default value is None. - :type body: ~azure.mgmt.nginx.models.NginxDeployment or IO[bytes] - :return: An instance of LROPoller that returns either NginxDeployment or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxDeployment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if body else None - cls: ClsType[_models.NginxDeployment] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("NginxDeployment", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.NginxDeployment].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.NginxDeployment]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - deployment_name: str, - body: Optional[Union[_models.NginxDeploymentUpdateParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if body else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "NginxDeploymentUpdateParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - deployment_name: str, - body: Optional[_models.NginxDeploymentUpdateParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.NginxDeployment]: - """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: The Nginx deployment update parameters. Default value is None. - :type body: ~azure.mgmt.nginx.models.NginxDeploymentUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either NginxDeployment or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxDeployment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - deployment_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.NginxDeployment]: - """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: The Nginx deployment update parameters. Default value is None. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either NginxDeployment or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxDeployment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - deployment_name: str, - body: Optional[Union[_models.NginxDeploymentUpdateParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.NginxDeployment]: - """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: The Nginx deployment update parameters. Is either a - NginxDeploymentUpdateParameters type or a IO[bytes] type. Default value is None. - :type body: ~azure.mgmt.nginx.models.NginxDeploymentUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns either NginxDeployment or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxDeployment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if body else None - cls: ClsType[_models.NginxDeployment] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("NginxDeployment", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.NginxDeployment].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.NginxDeployment]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, deployment_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete(self, resource_group_name: str, deployment_name: str, **kwargs: Any) -> LROPoller[None]: - """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 - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore 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 7490c9b501e8..e5b8af9c1a75 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 @@ -1,12 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar +from io import IOBase +import json +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import PipelineClient @@ -16,36 +19,43 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._configuration import NginxManagementClientConfiguration +from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from .._utils.serialization import Deserializer, Serializer +from .._validation import api_version_validation T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request(**kwargs: Any) -> HttpRequest: +def build_operations_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/providers/Nginx.NginxPlus/operations") + _url = "/providers/Nginx.NginxPlus/operations" # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -56,6 +66,711 @@ def build_list_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_nginx_deployment_waf_policies_analysis_request( # pylint: disable=name-too-long + resource_group_name: str, deployment_name: str, waf_policy_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/wafPolicies/{wafPolicyName}/analyzeWafPolicy" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "wafPolicyName": _SERIALIZER.url("waf_policy_name", waf_policy_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_api_keys_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 {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/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("resource_group_name", resource_group_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "apiKeyName": _SERIALIZER.url("api_key_name", api_key_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_api_keys_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/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("resource_group_name", resource_group_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "apiKeyName": _SERIALIZER.url("api_key_name", api_key_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_api_keys_delete_request( + resource_group_name: str, deployment_name: str, api_key_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + # Construct URL + _url = "/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("resource_group_name", resource_group_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "apiKeyName": _SERIALIZER.url("api_key_name", api_key_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_api_keys_list_request( + resource_group_name: str, deployment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/apiKeys" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_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", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_create_or_update_request( # pylint: disable=name-too-long + 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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_delete_request( + resource_group_name: str, deployment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + # Construct URL + _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"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_deployments_list_by_resource_group_request( # pylint: disable=name-too-long + 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", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = ( + "/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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Nginx.NginxPlus/nginxDeployments" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_waf_policy_list_request( + resource_group_name: str, deployment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/wafPolicies" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_waf_policy_get_request( + resource_group_name: str, deployment_name: str, waf_policy_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/wafPolicies/{wafPolicyName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "wafPolicyName": _SERIALIZER.url("waf_policy_name", waf_policy_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_waf_policy_create_request( + resource_group_name: str, deployment_name: str, waf_policy_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/wafPolicies/{wafPolicyName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "wafPolicyName": _SERIALIZER.url("waf_policy_name", waf_policy_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_waf_policy_delete_request( + resource_group_name: str, deployment_name: str, waf_policy_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/wafPolicies/{wafPolicyName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "wafPolicyName": _SERIALIZER.url("waf_policy_name", waf_policy_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_default_waf_policy_list_request( + resource_group_name: str, deployment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/listDefaultWafPolicies" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_certificates_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", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/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("resource_group_name", resource_group_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_certificates_create_or_update_request( # pylint: disable=name-too-long + 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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/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("resource_group_name", resource_group_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_certificates_delete_request( + resource_group_name: str, deployment_name: str, certificate_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + # Construct URL + _url = "/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("resource_group_name", resource_group_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_certificates_list_request( + resource_group_name: str, deployment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_configurations_get_request( + resource_group_name: str, deployment_name: str, configuration_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_configurations_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, deployment_name: str, configuration_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_configurations_delete_request( + resource_group_name: str, deployment_name: str, configuration_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_configurations_list_request( + resource_group_name: str, deployment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_configurations_analysis_request( + resource_group_name: str, deployment_name: str, configuration_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}/analyze" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + class Operations: """ .. warning:: @@ -63,11 +778,2902 @@ class Operations: Instead, you should access the following operations through :class:`~azure.mgmt.nginx.NginxManagementClient`'s - :attr:`operations` attribute. + :attr:`operations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: + """List the operations for the provider. + + :return: An iterator like instance of Operation + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.nginx.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Operation]] = 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_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Operation], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class NginxDeploymentWafPoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.nginx.NginxManagementClient`'s + :attr:`nginx_deployment_waf_policies` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def analysis( + self, + resource_group_name: str, + deployment_name: str, + waf_policy_name: str, + body: Optional[_models.NginxDeploymentWafPolicyAnalysisCreateRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NginxDeploymentWafPolicyAnalysisResponse: + """Analyze an Nginx Waf Policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param waf_policy_name: The name of Waf Policy. Required. + :type waf_policy_name: str + :param body: The content of the action request. Default value is None. + :type body: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyAnalysisCreateRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: NginxDeploymentWafPolicyAnalysisResponse. The NginxDeploymentWafPolicyAnalysisResponse + is compatible with MutableMapping + :rtype: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyAnalysisResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def analysis( + self, + resource_group_name: str, + deployment_name: str, + waf_policy_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NginxDeploymentWafPolicyAnalysisResponse: + """Analyze an Nginx Waf Policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param waf_policy_name: The name of Waf Policy. Required. + :type waf_policy_name: str + :param body: The content of the action request. Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: NginxDeploymentWafPolicyAnalysisResponse. The NginxDeploymentWafPolicyAnalysisResponse + is compatible with MutableMapping + :rtype: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyAnalysisResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def analysis( + self, + resource_group_name: str, + deployment_name: str, + waf_policy_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NginxDeploymentWafPolicyAnalysisResponse: + """Analyze an Nginx Waf Policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param waf_policy_name: The name of Waf Policy. Required. + :type waf_policy_name: str + :param body: The content of the action request. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: NginxDeploymentWafPolicyAnalysisResponse. The NginxDeploymentWafPolicyAnalysisResponse + is compatible with MutableMapping + :rtype: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyAnalysisResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2025-11-01", + params_added_on={ + "2025-11-01": [ + "api_version", + "subscription_id", + "resource_group_name", + "deployment_name", + "waf_policy_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2025-11-01"], + ) + def analysis( + self, + resource_group_name: str, + deployment_name: str, + waf_policy_name: str, + body: Optional[Union[_models.NginxDeploymentWafPolicyAnalysisCreateRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.NginxDeploymentWafPolicyAnalysisResponse: + """Analyze an Nginx Waf Policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param waf_policy_name: The name of Waf Policy. Required. + :type waf_policy_name: str + :param body: The content of the action request. Is one of the following types: + NginxDeploymentWafPolicyAnalysisCreateRequest, JSON, IO[bytes] Default value is None. + :type body: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyAnalysisCreateRequest or JSON or + IO[bytes] + :return: NginxDeploymentWafPolicyAnalysisResponse. The NginxDeploymentWafPolicyAnalysisResponse + is compatible with MutableMapping + :rtype: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicyAnalysisResponse + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None + cls: ClsType[_models.NginxDeploymentWafPolicyAnalysisResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_nginx_deployment_waf_policies_analysis_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + waf_policy_name=waf_policy_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NginxDeploymentWafPolicyAnalysisResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ApiKeysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.nginx.NginxManagementClient`'s + :attr:`api_keys` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, deployment_name: str, 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. The NginxDeploymentApiKeyResponse is compatible with + MutableMapping + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.NginxDeploymentApiKeyResponse] = kwargs.pop("cls", None) + + _request = build_api_keys_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NginxDeploymentApiKeyResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + deployment_name: str, + api_key_name: str, + body: Optional[_models.NginxDeploymentApiKeyRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NginxDeploymentApiKeyResponse: + """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 + :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 + :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 + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: NginxDeploymentApiKeyResponse. The NginxDeploymentApiKeyResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + deployment_name: str, + api_key_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NginxDeploymentApiKeyResponse: + """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 + :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 + :param body: The API Key object containing fields (e.g. secret text, expiration date) to upsert + the key. Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: NginxDeploymentApiKeyResponse. The NginxDeploymentApiKeyResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + deployment_name: str, + api_key_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NginxDeploymentApiKeyResponse: + """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 + :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 + :param body: The API Key object containing fields (e.g. secret text, expiration date) to upsert + the key. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: NginxDeploymentApiKeyResponse. The NginxDeploymentApiKeyResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + deployment_name: str, + api_key_name: str, + body: Optional[Union[_models.NginxDeploymentApiKeyRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.NginxDeploymentApiKeyResponse: + """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 + :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 + :param body: The API Key object containing fields (e.g. secret text, expiration date) to upsert + the key. Is one of the following types: NginxDeploymentApiKeyRequest, JSON, IO[bytes] Default + value is None. + :type body: ~azure.mgmt.nginx.models.NginxDeploymentApiKeyRequest or JSON or IO[bytes] + :return: NginxDeploymentApiKeyResponse. The NginxDeploymentApiKeyResponse is compatible with + MutableMapping + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None + cls: ClsType[_models.NginxDeploymentApiKeyResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_api_keys_create_or_update_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + api_key_name=api_key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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, 201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NginxDeploymentApiKeyResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, deployment_name: str, api_key_name: str, **kwargs: Any + ) -> None: + """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 + :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: None + :rtype: None + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_api_keys_delete_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, deployment_name: str, **kwargs: Any + ) -> ItemPaged["_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 NginxDeploymentApiKeyResponse + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.nginx.models.NginxDeploymentApiKeyResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.NginxDeploymentApiKeyResponse]] = 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_api_keys_list_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.NginxDeploymentApiKeyResponse], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class DeploymentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.nginx.NginxManagementClient`'s + :attr:`deployments` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, deployment_name: str, **kwargs: Any) -> _models.NginxDeployment: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :return: NginxDeployment. The NginxDeployment is compatible with MutableMapping + :rtype: ~azure.mgmt.nginx.models.NginxDeployment + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.NginxDeployment] = kwargs.pop("cls", None) + + _request = build_deployments_get_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NginxDeployment, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + deployment_name: str, + body: Optional[Union[_models.NginxDeployment, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_deployments_create_or_update_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + 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.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + body: Optional[_models.NginxDeployment] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NginxDeployment]: + """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: The Nginx deployment. Default value is None. + :type body: ~azure.mgmt.nginx.models.NginxDeployment + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns NginxDeployment. The NginxDeployment is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxDeployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NginxDeployment]: + """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: The Nginx deployment. Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns NginxDeployment. The NginxDeployment is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxDeployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NginxDeployment]: + """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: The Nginx deployment. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns NginxDeployment. The NginxDeployment is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxDeployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + body: Optional[Union[_models.NginxDeployment, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.NginxDeployment]: + """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: The Nginx deployment. Is one of the following types: NginxDeployment, JSON, + IO[bytes] Default value is None. + :type body: ~azure.mgmt.nginx.models.NginxDeployment or JSON or IO[bytes] + :return: An instance of LROPoller that returns NginxDeployment. The NginxDeployment is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxDeployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None + cls: ClsType[_models.NginxDeployment] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.NginxDeployment, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.NginxDeployment].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.NginxDeployment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + deployment_name: str, + body: Optional[Union[_models.NginxDeploymentUpdateParameters, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_deployments_update_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + 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.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + deployment_name: str, + body: Optional[_models.NginxDeploymentUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NginxDeployment]: + """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: The Nginx deployment update parameters. Default value is None. + :type body: ~azure.mgmt.nginx.models.NginxDeploymentUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns NginxDeployment. The NginxDeployment is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxDeployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + deployment_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NginxDeployment]: + """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: The Nginx deployment update parameters. Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns NginxDeployment. The NginxDeployment is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxDeployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + deployment_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NginxDeployment]: + """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: The Nginx deployment update parameters. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns NginxDeployment. The NginxDeployment is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxDeployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + deployment_name: str, + body: Optional[Union[_models.NginxDeploymentUpdateParameters, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.NginxDeployment]: + """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: The Nginx deployment update parameters. Is one of the following types: + NginxDeploymentUpdateParameters, JSON, IO[bytes] Default value is None. + :type body: ~azure.mgmt.nginx.models.NginxDeploymentUpdateParameters or JSON or IO[bytes] + :return: An instance of LROPoller that returns NginxDeployment. The NginxDeployment is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxDeployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None + cls: ClsType[_models.NginxDeployment] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.NginxDeployment, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.NginxDeployment].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.NginxDeployment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, resource_group_name: str, deployment_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_deployments_delete_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + 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.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, deployment_name: str, **kwargs: Any) -> LROPoller[None]: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_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 NginxDeployment + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.nginx.models.NginxDeployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.NginxDeployment]] = 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_deployments_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.NginxDeployment], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.NginxDeployment"]: + """List the NGINX deployments resources. + + :return: An iterator like instance of NginxDeployment + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.nginx.models.NginxDeployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.NginxDeployment]] = 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_deployments_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.NginxDeployment], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class WafPolicyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.nginx.NginxManagementClient`'s + :attr:`waf_policy` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, deployment_name: str, **kwargs: Any + ) -> ItemPaged["_models.NginxDeploymentWafPolicyMetadata"]: + """List Waf Policies of given Nginx deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :return: An iterator like instance of NginxDeploymentWafPolicyMetadata + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.nginx.models.NginxDeploymentWafPolicyMetadata] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.NginxDeploymentWafPolicyMetadata]] = 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_waf_policy_list_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.NginxDeploymentWafPolicyMetadata], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + 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, waf_policy_name: str, **kwargs: Any + ) -> _models.NginxDeploymentWafPolicy: + """Get the Nginx Waf Policy of given Nginx deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param waf_policy_name: The name of Waf Policy. Required. + :type waf_policy_name: str + :return: NginxDeploymentWafPolicy. The NginxDeploymentWafPolicy is compatible with + MutableMapping + :rtype: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.NginxDeploymentWafPolicy] = kwargs.pop("cls", None) + + _request = build_waf_policy_get_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + waf_policy_name=waf_policy_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NginxDeploymentWafPolicy, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + deployment_name: str, + waf_policy_name: str, + body: Optional[Union[_models.NginxDeploymentWafPolicy, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_waf_policy_create_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + waf_policy_name=waf_policy_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + 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["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + deployment_name: str, + waf_policy_name: str, + body: Optional[_models.NginxDeploymentWafPolicy] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NginxDeploymentWafPolicy]: + """Create or update the Nginx Waf Policy for given Nginx deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param waf_policy_name: The name of Waf Policy. Required. + :type waf_policy_name: str + :param body: Resource create parameters. Default value is None. + :type body: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns NginxDeploymentWafPolicy. The + NginxDeploymentWafPolicy is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxDeploymentWafPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + deployment_name: str, + waf_policy_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NginxDeploymentWafPolicy]: + """Create or update the Nginx Waf Policy for given Nginx deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param waf_policy_name: The name of Waf Policy. Required. + :type waf_policy_name: str + :param body: Resource create parameters. Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns NginxDeploymentWafPolicy. The + NginxDeploymentWafPolicy is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxDeploymentWafPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + deployment_name: str, + waf_policy_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NginxDeploymentWafPolicy]: + """Create or update the Nginx Waf Policy for given Nginx deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param waf_policy_name: The name of Waf Policy. Required. + :type waf_policy_name: str + :param body: Resource create parameters. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns NginxDeploymentWafPolicy. The + NginxDeploymentWafPolicy is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxDeploymentWafPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + deployment_name: str, + waf_policy_name: str, + body: Optional[Union[_models.NginxDeploymentWafPolicy, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.NginxDeploymentWafPolicy]: + """Create or update the Nginx Waf Policy for given Nginx deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param waf_policy_name: The name of Waf Policy. Required. + :type waf_policy_name: str + :param body: Resource create parameters. Is one of the following types: + NginxDeploymentWafPolicy, JSON, IO[bytes] Default value is None. + :type body: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicy or JSON or IO[bytes] + :return: An instance of LROPoller that returns NginxDeploymentWafPolicy. The + NginxDeploymentWafPolicy is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxDeploymentWafPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None + cls: ClsType[_models.NginxDeploymentWafPolicy] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + waf_policy_name=waf_policy_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.NginxDeploymentWafPolicy, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.NginxDeploymentWafPolicy].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.NginxDeploymentWafPolicy]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, deployment_name: str, waf_policy_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_waf_policy_delete_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + waf_policy_name=waf_policy_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + 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.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, deployment_name: str, waf_policy_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Reset the Nginx Waf Policy of given Nginx deployment to default. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param waf_policy_name: The name of Waf Policy. Required. + :type waf_policy_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + waf_policy_name=waf_policy_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class DefaultWafPolicyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.nginx.NginxManagementClient`'s + :attr:`default_waf_policy` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, deployment_name: str, **kwargs: Any + ) -> _models.NginxDeploymentDefaultWafPolicyListResponse: + """Get the Nginx Waf Policy of given Nginx deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :return: NginxDeploymentDefaultWafPolicyListResponse. The + NginxDeploymentDefaultWafPolicyListResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.nginx.models.NginxDeploymentDefaultWafPolicyListResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.NginxDeploymentDefaultWafPolicyListResponse] = kwargs.pop("cls", None) + + _request = build_default_waf_policy_list_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NginxDeploymentDefaultWafPolicyListResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class CertificatesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.nginx.NginxManagementClient`'s + :attr:`certificates` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, deployment_name: str, certificate_name: str, **kwargs: Any + ) -> _models.NginxCertificate: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :return: NginxCertificate. The NginxCertificate is compatible with MutableMapping + :rtype: ~azure.mgmt.nginx.models.NginxCertificate + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.NginxCertificate] = kwargs.pop("cls", None) + + _request = build_certificates_get_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NginxCertificate, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + deployment_name: str, + certificate_name: str, + body: Optional[Union[_models.NginxCertificate, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_certificates_create_or_update_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + 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.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + certificate_name: str, + body: Optional[_models.NginxCertificate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NginxCertificate]: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :param body: The certificate. Default value is None. + :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". + :paramtype content_type: str + :return: An instance of LROPoller that returns NginxCertificate. The NginxCertificate is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxCertificate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + certificate_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NginxCertificate]: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :param body: The certificate. Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns NginxCertificate. The NginxCertificate is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxCertificate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + certificate_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NginxCertificate]: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :param body: The certificate. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns NginxCertificate. The NginxCertificate is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxCertificate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + certificate_name: str, + body: Optional[Union[_models.NginxCertificate, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.NginxCertificate]: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :param body: The certificate. Is one of the following types: NginxCertificate, JSON, IO[bytes] + Default value is None. + :type body: ~azure.mgmt.nginx.models.NginxCertificate or JSON or IO[bytes] + :return: An instance of LROPoller that returns NginxCertificate. The NginxCertificate is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxCertificate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None + cls: ClsType[_models.NginxCertificate] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + certificate_name=certificate_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.NginxCertificate, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.NginxCertificate].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.NginxCertificate]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, deployment_name: str, certificate_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_certificates_delete_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + 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.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, deployment_name: str, certificate_name: str, **kwargs: Any + ) -> LROPoller[None]: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + certificate_name=certificate_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, deployment_name: str, **kwargs: Any + ) -> ItemPaged["_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 NginxCertificate + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.nginx.models.NginxCertificate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.NginxCertificate]] = 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_certificates_list_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.NginxCertificate], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.nginx.NginxManagementClient`'s + :attr:`configurations` attribute. """ - models = _models - def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") @@ -76,18 +3682,486 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: - """List the operations for the provider. + def get( + self, resource_group_name: str, deployment_name: str, configuration_name: str, **kwargs: Any + ) -> _models.NginxConfigurationResponse: + """Get the NGINX configuration of given NGINX deployment. - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.nginx.models.Operation] + :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 configuration_name: The name of configuration, only 'default' is supported value due to + the singleton of NGINX conf. Required. + :type configuration_name: str + :return: NginxConfigurationResponse. The NginxConfigurationResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.nginx.models.NginxConfigurationResponse + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.NginxConfigurationResponse] = kwargs.pop("cls", None) + + _request = build_configurations_get_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NginxConfigurationResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + deployment_name: str, + configuration_name: str, + body: Optional[Union[_models.NginxConfigurationRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_configurations_create_or_update_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + 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.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + configuration_name: str, + body: Optional[_models.NginxConfigurationRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NginxConfigurationResponse]: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :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 + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns NginxConfigurationResponse. The + NginxConfigurationResponse is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxConfigurationResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + configuration_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NginxConfigurationResponse]: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns NginxConfigurationResponse. The + NginxConfigurationResponse is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxConfigurationResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + configuration_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NginxConfigurationResponse]: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :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: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns NginxConfigurationResponse. The + NginxConfigurationResponse is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxConfigurationResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + configuration_name: str, + body: Optional[Union[_models.NginxConfigurationRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.NginxConfigurationResponse]: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :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 one of the following types: NginxConfigurationRequest, + JSON, IO[bytes] Default value is None. + :type body: ~azure.mgmt.nginx.models.NginxConfigurationRequest or JSON or IO[bytes] + :return: An instance of LROPoller that returns NginxConfigurationResponse. The + NginxConfigurationResponse is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxConfigurationResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None + cls: ClsType[_models.NginxConfigurationResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + configuration_name=configuration_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.NginxConfigurationResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.NginxConfigurationResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.NginxConfigurationResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, deployment_name: str, configuration_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_configurations_delete_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + 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.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, deployment_name: str, configuration_name: str, **kwargs: Any + ) -> LROPoller[None]: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param configuration_name: The name of configuration, only 'default' is supported value due to + the singleton of NGINX conf. Required. + :type configuration_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + configuration_name=configuration_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, deployment_name: str, **kwargs: Any + ) -> ItemPaged["_models.NginxConfigurationResponse"]: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :return: An iterator like instance of NginxConfigurationResponse + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.nginx.models.NginxConfigurationResponse] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.NginxConfigurationResponse]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -100,12 +4174,20 @@ def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - _request = build_list_request( - api_version=api_version, + _request = build_configurations_list_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -120,16 +4202,24 @@ def prepare_request(next_link=None): _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" + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.NginxConfigurationResponse], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) + return deserialized.get("nextLink") or None, iter(list_of_elem) def get_next(next_link=None): _request = prepare_request(next_link) @@ -142,12 +4232,203 @@ def get_next(next_link=None): 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( + error = _failsafe_deserialize( _models.ErrorResponse, - pipeline_response, + response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return ItemPaged(get_next, extract_data) + + @overload + def analysis( + self, + resource_group_name: str, + deployment_name: str, + configuration_name: str, + body: Optional[_models.AnalysisCreate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AnalysisResult: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :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 to analyze. Default value is None. + :type body: ~azure.mgmt.nginx.models.AnalysisCreate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AnalysisResult. The AnalysisResult is compatible with MutableMapping + :rtype: ~azure.mgmt.nginx.models.AnalysisResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def analysis( + self, + resource_group_name: str, + deployment_name: str, + configuration_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AnalysisResult: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :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 to analyze. Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AnalysisResult. The AnalysisResult is compatible with MutableMapping + :rtype: ~azure.mgmt.nginx.models.AnalysisResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def analysis( + self, + resource_group_name: str, + deployment_name: str, + configuration_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AnalysisResult: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :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 to analyze. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AnalysisResult. The AnalysisResult is compatible with MutableMapping + :rtype: ~azure.mgmt.nginx.models.AnalysisResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def analysis( + self, + resource_group_name: str, + deployment_name: str, + configuration_name: str, + body: Optional[Union[_models.AnalysisCreate, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.AnalysisResult: + """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 + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :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 to analyze. Is one of the following types: AnalysisCreate, + JSON, IO[bytes] Default value is None. + :type body: ~azure.mgmt.nginx.models.AnalysisCreate or JSON or IO[bytes] + :return: AnalysisResult. The AnalysisResult is compatible with MutableMapping + :rtype: ~azure.mgmt.nginx.models.AnalysisResult + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None + cls: ClsType[_models.AnalysisResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if body else None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_configurations_analysis_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AnalysisResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_waf_policy_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_waf_policy_operations.py deleted file mode 100644 index 6607306b0b5e..000000000000 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_waf_policy_operations.py +++ /dev/null @@ -1,731 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import NginxManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, deployment_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/wafPolicies", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "deploymentName": _SERIALIZER.url( - "deployment_name", - deployment_name, - "str", - pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, deployment_name: str, waf_policy_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/wafPolicies/{wafPolicyName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "deploymentName": _SERIALIZER.url( - "deployment_name", - deployment_name, - "str", - pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", - ), - "wafPolicyName": _SERIALIZER.url( - "waf_policy_name", - waf_policy_name, - "str", - pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, deployment_name: str, waf_policy_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/wafPolicies/{wafPolicyName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "deploymentName": _SERIALIZER.url( - "deployment_name", - deployment_name, - "str", - pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", - ), - "wafPolicyName": _SERIALIZER.url( - "waf_policy_name", - waf_policy_name, - "str", - pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, deployment_name: str, waf_policy_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/wafPolicies/{wafPolicyName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "deploymentName": _SERIALIZER.url( - "deployment_name", - deployment_name, - "str", - pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", - ), - "wafPolicyName": _SERIALIZER.url( - "waf_policy_name", - waf_policy_name, - "str", - pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class WafPolicyOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.nginx.NginxManagementClient`'s - :attr:`waf_policy` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NginxManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, deployment_name: str, **kwargs: Any - ) -> ItemPaged["_models.NginxDeploymentWafPolicyMetadata"]: - """List Waf Policies of given Nginx deployment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :return: An iterator like instance of either NginxDeploymentWafPolicyMetadata or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.nginx.models.NginxDeploymentWafPolicyMetadata] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.NginxDeploymentWafPolicyListResponse] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("NginxDeploymentWafPolicyListResponse", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, deployment_name: str, waf_policy_name: str, **kwargs: Any - ) -> _models.NginxDeploymentWafPolicy: - """Get the Nginx Waf Policy of given Nginx deployment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :param waf_policy_name: The name of Waf Policy. Required. - :type waf_policy_name: str - :return: NginxDeploymentWafPolicy or the result of cls(response) - :rtype: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicy - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.NginxDeploymentWafPolicy] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - waf_policy_name=waf_policy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("NginxDeploymentWafPolicy", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - resource_group_name: str, - deployment_name: str, - waf_policy_name: str, - body: Optional[Union[_models.NginxDeploymentWafPolicy, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if body else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if body else None - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "NginxDeploymentWafPolicy") - else: - _json = None - - _request = build_create_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - waf_policy_name=waf_policy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - 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, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - resource_group_name: str, - deployment_name: str, - waf_policy_name: str, - body: Optional[_models.NginxDeploymentWafPolicy] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.NginxDeploymentWafPolicy]: - """Create or update the Nginx Waf Policy for given Nginx deployment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :param waf_policy_name: The name of Waf Policy. Required. - :type waf_policy_name: str - :param body: The Nginx Deployment Waf Policy. Default value is None. - :type body: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicy - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either NginxDeploymentWafPolicy or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxDeploymentWafPolicy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - deployment_name: str, - waf_policy_name: str, - body: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.NginxDeploymentWafPolicy]: - """Create or update the Nginx Waf Policy for given Nginx deployment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :param waf_policy_name: The name of Waf Policy. Required. - :type waf_policy_name: str - :param body: The Nginx Deployment Waf Policy. Default value is None. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either NginxDeploymentWafPolicy or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxDeploymentWafPolicy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - deployment_name: str, - waf_policy_name: str, - body: Optional[Union[_models.NginxDeploymentWafPolicy, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.NginxDeploymentWafPolicy]: - """Create or update the Nginx Waf Policy for given Nginx deployment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :param waf_policy_name: The name of Waf Policy. Required. - :type waf_policy_name: str - :param body: The Nginx Deployment Waf Policy. Is either a NginxDeploymentWafPolicy type or a - IO[bytes] type. Default value is None. - :type body: ~azure.mgmt.nginx.models.NginxDeploymentWafPolicy or IO[bytes] - :return: An instance of LROPoller that returns either NginxDeploymentWafPolicy or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.nginx.models.NginxDeploymentWafPolicy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if body else None - cls: ClsType[_models.NginxDeploymentWafPolicy] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_initial( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - waf_policy_name=waf_policy_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("NginxDeploymentWafPolicy", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.NginxDeploymentWafPolicy].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.NginxDeploymentWafPolicy]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, deployment_name: str, waf_policy_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - waf_policy_name=waf_policy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, deployment_name: str, waf_policy_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Reset the Nginx Waf Policy of given Nginx deployment to default. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param deployment_name: The name of targeted NGINX deployment. Required. - :type deployment_name: str - :param waf_policy_name: The name of Waf Policy. Required. - :type waf_policy_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - deployment_name=deployment_name, - waf_policy_name=waf_policy_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/api_keys_create_or_update.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/api_keys_create_or_update.py index a23d93cd26b3..063b4fbe3529 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/api_keys_create_or_update.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/api_keys_create_or_update.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NginxManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.api_keys.create_or_update( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/Nginx.NginxPlus/preview/2025-03-01-preview/examples/ApiKeys_CreateOrUpdate.json +# x-ms-original-file: 2025-11-01/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 2fdb061bab78..0cc346864c6c 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NginxManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.api_keys.delete( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/nginx/resource-manager/Nginx.NginxPlus/preview/2025-03-01-preview/examples/ApiKeys_Delete.json +# x-ms-original-file: 2025-11-01/ApiKeys_Delete.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/api_keys_get.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/api_keys_get.py index 505090e62a08..e15eaf59983a 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NginxManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.api_keys.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/Nginx.NginxPlus/preview/2025-03-01-preview/examples/ApiKeys_Get.json +# x-ms-original-file: 2025-11-01/ApiKeys_Get.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/api_keys_list.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/api_keys_list.py index 8f55d4bd9f78..126a4910d277 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NginxManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.api_keys.list( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/nginx/resource-manager/Nginx.NginxPlus/preview/2025-03-01-preview/examples/ApiKeys_List.json +# x-ms-original-file: 2025-11-01/ApiKeys_List.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_create_or_update.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_create_or_update.py index 4e979611e642..a98d1d46201a 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_create_or_update.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_create_or_update.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NginxManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.certificates.begin_create_or_update( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/Nginx.NginxPlus/preview/2025-03-01-preview/examples/Certificates_CreateOrUpdate.json +# x-ms-original-file: 2025-11-01/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 f40ac32313c9..3286bcfb713e 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_delete.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_delete.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NginxManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.certificates.begin_delete( @@ -38,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/nginx/resource-manager/Nginx.NginxPlus/preview/2025-03-01-preview/examples/Certificates_Delete.json +# x-ms-original-file: 2025-11-01/Certificates_Delete.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_get.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_get.py index 7937b5d19742..8af9fe7ac620 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_get.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_get.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NginxManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.certificates.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/Nginx.NginxPlus/preview/2025-03-01-preview/examples/Certificates_Get.json +# x-ms-original-file: 2025-11-01/Certificates_Get.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_list.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_list.py index abf7fcdd314c..5e2433bbfb51 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_list.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_list.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NginxManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.certificates.list( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/nginx/resource-manager/Nginx.NginxPlus/preview/2025-03-01-preview/examples/Certificates_List.json +# x-ms-original-file: 2025-11-01/Certificates_List.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_analysis.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_analysis.py index ae6d6875131e..952c4766866c 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_analysis.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_analysis.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NginxManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.configurations.analysis( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/Nginx.NginxPlus/preview/2025-03-01-preview/examples/Configurations_Analysis.json +# x-ms-original-file: 2025-11-01/Configurations_Analysis.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_create_or_update.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_create_or_update.py index 8bc7a8aa4bd3..0139ac5fd0d0 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_create_or_update.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_create_or_update.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NginxManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.configurations.begin_create_or_update( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/Nginx.NginxPlus/preview/2025-03-01-preview/examples/Configurations_CreateOrUpdate.json +# x-ms-original-file: 2025-11-01/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 6c723037acbb..b6b37bea87ff 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_delete.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_delete.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NginxManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.configurations.begin_delete( @@ -38,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/nginx/resource-manager/Nginx.NginxPlus/preview/2025-03-01-preview/examples/Configurations_Delete.json +# x-ms-original-file: 2025-11-01/Configurations_Delete.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_get.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_get.py index f0b39bcb9a43..be6d3e22d66e 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_get.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_get.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NginxManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.configurations.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/Nginx.NginxPlus/preview/2025-03-01-preview/examples/Configurations_Get.json +# x-ms-original-file: 2025-11-01/Configurations_Get.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_list.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_list.py index c02723cf2c24..de9d6d901b35 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_list.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_list.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NginxManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.configurations.list( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/nginx/resource-manager/Nginx.NginxPlus/preview/2025-03-01-preview/examples/Configurations_List.json +# x-ms-original-file: 2025-11-01/Configurations_List.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/default_waf_policy_list.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/default_waf_policy_list.py index aad130ec13ae..db72aac5dcb2 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/default_waf_policy_list.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/default_waf_policy_list.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NginxManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.default_waf_policy.list( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/Nginx.NginxPlus/preview/2025-03-01-preview/examples/DefaultWafPolicy_List.json +# x-ms-original-file: 2025-11-01/DefaultWafPolicy_List.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_create.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_create.py index 1453b479f25c..de61bc1eb264 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_create.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_create.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NginxManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.deployments.begin_create_or_update( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/Nginx.NginxPlus/preview/2025-03-01-preview/examples/Deployments_Create.json +# x-ms-original-file: 2025-11-01/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 7a71c666a911..495514f9eedd 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_delete.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_delete.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NginxManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.deployments.begin_delete( @@ -37,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/nginx/resource-manager/Nginx.NginxPlus/preview/2025-03-01-preview/examples/Deployments_Delete.json +# x-ms-original-file: 2025-11-01/Deployments_Delete.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_get.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_get.py index 4d96b8eb7510..fb4284910c02 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_get.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_get.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NginxManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.deployments.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/Nginx.NginxPlus/preview/2025-03-01-preview/examples/Deployments_Get.json +# x-ms-original-file: 2025-11-01/Deployments_Get.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_get_auto_scale.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_get_auto_scale.py index a14a64f677c1..d349f4f00d0e 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NginxManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.deployments.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/Nginx.NginxPlus/preview/2025-03-01-preview/examples/Deployments_Get_AutoScale.json +# x-ms-original-file: 2025-11-01/Deployments_Get_AutoScale.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_list.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_list.py index 5ec44891b6e0..5bf09c7451da 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_list.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_list.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NginxManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.deployments.list() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/nginx/resource-manager/Nginx.NginxPlus/preview/2025-03-01-preview/examples/Deployments_List.json +# x-ms-original-file: 2025-11-01/Deployments_List.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_list_by_resource_group.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_list_by_resource_group.py index 8cf8ccbfb61d..f728ac27eac0 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NginxManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.deployments.list_by_resource_group( @@ -38,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/nginx/resource-manager/Nginx.NginxPlus/preview/2025-03-01-preview/examples/Deployments_ListByResourceGroup.json +# x-ms-original-file: 2025-11-01/Deployments_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_update.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_update.py index 89ea4f1727d3..b15f0090910c 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_update.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_update.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NginxManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.deployments.begin_update( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/Nginx.NginxPlus/preview/2025-03-01-preview/examples/Deployments_Update.json +# x-ms-original-file: 2025-11-01/Deployments_Update.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_update_subnet.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_update_subnet.py index b5c46caa9782..a43906cfba73 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_update_subnet.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_update_subnet.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NginxManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.deployments.begin_update( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/Nginx.NginxPlus/preview/2025-03-01-preview/examples/Deployments_UpdateSubnet.json +# x-ms-original-file: 2025-11-01/Deployments_UpdateSubnet.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/nginx_deployment_waf_policies_analysis.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/nginx_deployment_waf_policies_analysis.py new file mode 100644 index 000000000000..cf200dbd4d1c --- /dev/null +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/nginx_deployment_waf_policies_analysis.py @@ -0,0 +1,43 @@ +# 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) Python 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 nginx_deployment_waf_policies_analysis.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="SUBSCRIPTION_ID", + ) + + response = client.nginx_deployment_waf_policies.analysis( + resource_group_name="myResourceGroup", + deployment_name="myDeployment", + waf_policy_name="myWafPolicy", + ) + print(response) + + +# x-ms-original-file: 2025-11-01/NginxDeploymentWafPolicies_Analysis.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 0459cb920704..e4a9da4ba598 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/operations_list.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/operations_list.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/nginx/resource-manager/Nginx.NginxPlus/preview/2025-03-01-preview/examples/Operations_List.json +# x-ms-original-file: 2025-11-01/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/waf_policy_create.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/waf_policy_create.py index 7fb081d3f8de..8827179d5883 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/waf_policy_create.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/waf_policy_create.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NginxManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.waf_policy.begin_create( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/Nginx.NginxPlus/preview/2025-03-01-preview/examples/WafPolicy_Create.json +# x-ms-original-file: 2025-11-01/WafPolicy_Create.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/waf_policy_delete.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/waf_policy_delete.py index f18c0efd87ec..a046ea9af3e9 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/waf_policy_delete.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/waf_policy_delete.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NginxManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.waf_policy.begin_delete( @@ -38,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/nginx/resource-manager/Nginx.NginxPlus/preview/2025-03-01-preview/examples/WafPolicy_Delete.json +# x-ms-original-file: 2025-11-01/WafPolicy_Delete.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/waf_policy_get.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/waf_policy_get.py index 0b07e9ba97ca..ae4bc5721791 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/waf_policy_get.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/waf_policy_get.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NginxManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.waf_policy.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/Nginx.NginxPlus/preview/2025-03-01-preview/examples/WafPolicy_Get.json +# x-ms-original-file: 2025-11-01/WafPolicy_Get.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/waf_policy_list.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/waf_policy_list.py index 87a6ba9a543a..78833dd5d891 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/waf_policy_list.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/waf_policy_list.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NginxManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.waf_policy.list( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/nginx/resource-manager/Nginx.NginxPlus/preview/2025-03-01-preview/examples/WafPolicy_List.json +# x-ms-original-file: 2025-11-01/WafPolicy_List.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_tests/conftest.py b/sdk/nginx/azure-mgmt-nginx/generated_tests/conftest.py index 86ae13df960d..95d83d69b809 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_tests/conftest.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_tests/conftest.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import os 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 77b16d11b36e..3ff15363d795 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -18,18 +18,6 @@ class TestNginxManagementApiKeysOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(NginxManagementClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_api_keys_list(self, resource_group): - response = self.client.api_keys.list( - resource_group_name=resource_group.name, - deployment_name="str", - api_version="2025-03-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_get(self, resource_group): @@ -37,7 +25,6 @@ def test_api_keys_get(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", api_key_name="str", - api_version="2025-03-01-preview", ) # please add some check logic here by yourself @@ -50,7 +37,6 @@ def test_api_keys_create_or_update(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", api_key_name="str", - api_version="2025-03-01-preview", ) # please add some check logic here by yourself @@ -63,8 +49,18 @@ def test_api_keys_delete(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", api_key_name="str", - api_version="2025-03-01-preview", ) # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_api_keys_list(self, resource_group): + response = self.client.api_keys.list( + resource_group_name=resource_group.name, + deployment_name="str", + ) + 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 7bbc760f5e16..63ee78ebfff6 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -19,18 +19,6 @@ class TestNginxManagementApiKeysOperationsAsync(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_api_keys_list(self, resource_group): - response = self.client.api_keys.list( - resource_group_name=resource_group.name, - deployment_name="str", - api_version="2025-03-01-preview", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_api_keys_get(self, resource_group): @@ -38,7 +26,6 @@ async def test_api_keys_get(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", api_key_name="str", - api_version="2025-03-01-preview", ) # please add some check logic here by yourself @@ -51,7 +38,6 @@ async def test_api_keys_create_or_update(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", api_key_name="str", - api_version="2025-03-01-preview", ) # please add some check logic here by yourself @@ -64,8 +50,18 @@ async def test_api_keys_delete(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", api_key_name="str", - api_version="2025-03-01-preview", ) # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_api_keys_list(self, resource_group): + response = self.client.api_keys.list( + resource_group_name=resource_group.name, + deployment_name="str", + ) + 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 6e5a9399aa1f..3c5130c84525 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -18,18 +18,6 @@ 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="2025-03-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): @@ -37,7 +25,6 @@ def test_certificates_get(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", certificate_name="str", - api_version="2025-03-01-preview", ) # please add some check logic here by yourself @@ -50,7 +37,6 @@ def test_certificates_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", certificate_name="str", - api_version="2025-03-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -63,8 +49,18 @@ def test_certificates_begin_delete(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", certificate_name="str", - api_version="2025-03-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_certificates_list(self, resource_group): + response = self.client.certificates.list( + resource_group_name=resource_group.name, + deployment_name="str", + ) + 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 04511bfce680..87128673b431 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -19,18 +19,6 @@ 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="2025-03-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): @@ -38,7 +26,6 @@ async def test_certificates_get(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", certificate_name="str", - api_version="2025-03-01-preview", ) # please add some check logic here by yourself @@ -52,7 +39,6 @@ async def test_certificates_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", certificate_name="str", - api_version="2025-03-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -67,9 +53,19 @@ async def test_certificates_begin_delete(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", certificate_name="str", - api_version="2025-03-01-preview", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_certificates_list(self, resource_group): + response = self.client.certificates.list( + resource_group_name=resource_group.name, + deployment_name="str", + ) + 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 382badb8f461..5699bc803a31 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -18,18 +18,6 @@ class TestNginxManagementConfigurationsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(NginxManagementClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_configurations_list(self, resource_group): - response = self.client.configurations.list( - resource_group_name=resource_group.name, - deployment_name="str", - api_version="2025-03-01-preview", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_configurations_get(self, resource_group): @@ -37,7 +25,6 @@ def test_configurations_get(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", configuration_name="str", - api_version="2025-03-01-preview", ) # please add some check logic here by yourself @@ -50,7 +37,6 @@ def test_configurations_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", configuration_name="str", - api_version="2025-03-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -63,12 +49,22 @@ def test_configurations_begin_delete(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", configuration_name="str", - api_version="2025-03-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_configurations_list(self, resource_group): + response = self.client.configurations.list( + resource_group_name=resource_group.name, + deployment_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_configurations_analysis(self, resource_group): @@ -76,7 +72,6 @@ def test_configurations_analysis(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", configuration_name="str", - api_version="2025-03-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_configurations_operations_async.py b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_configurations_operations_async.py index 35de9d3b7a68..7cb2ee2e557d 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -19,18 +19,6 @@ class TestNginxManagementConfigurationsOperationsAsync(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_configurations_list(self, resource_group): - response = self.client.configurations.list( - resource_group_name=resource_group.name, - deployment_name="str", - api_version="2025-03-01-preview", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_configurations_get(self, resource_group): @@ -38,7 +26,6 @@ async def test_configurations_get(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", configuration_name="str", - api_version="2025-03-01-preview", ) # please add some check logic here by yourself @@ -52,7 +39,6 @@ async def test_configurations_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", configuration_name="str", - api_version="2025-03-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -67,13 +53,23 @@ async def test_configurations_begin_delete(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", configuration_name="str", - api_version="2025-03-01-preview", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_configurations_list(self, resource_group): + response = self.client.configurations.list( + resource_group_name=resource_group.name, + deployment_name="str", + ) + 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_configurations_analysis(self, resource_group): @@ -81,7 +77,6 @@ async def test_configurations_analysis(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", configuration_name="str", - api_version="2025-03-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_default_waf_policy_operations.py b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_default_waf_policy_operations.py index ab93df2d7ac5..64e5edd9a304 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_default_waf_policy_operations.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_default_waf_policy_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -24,7 +24,6 @@ def test_default_waf_policy_list(self, resource_group): response = self.client.default_waf_policy.list( resource_group_name=resource_group.name, deployment_name="str", - api_version="2025-03-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_default_waf_policy_operations_async.py b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_default_waf_policy_operations_async.py index 6e85aa5bcd1c..74db779b60b7 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_default_waf_policy_operations_async.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_default_waf_policy_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -25,7 +25,6 @@ async def test_default_waf_policy_list(self, resource_group): response = await self.client.default_waf_policy.list( resource_group_name=resource_group.name, deployment_name="str", - api_version="2025-03-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_deployments_operations.py b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_deployments_operations.py index e654c35a5ca1..80219b9cedcb 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -18,34 +18,12 @@ 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="2025-03-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="2025-03-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): response = self.client.deployments.get( resource_group_name=resource_group.name, deployment_name="str", - api_version="2025-03-01-preview", ) # please add some check logic here by yourself @@ -57,7 +35,6 @@ def test_deployments_begin_create_or_update(self, resource_group): response = self.client.deployments.begin_create_or_update( resource_group_name=resource_group.name, deployment_name="str", - api_version="2025-03-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -69,7 +46,6 @@ def test_deployments_begin_update(self, resource_group): response = self.client.deployments.begin_update( resource_group_name=resource_group.name, deployment_name="str", - api_version="2025-03-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -81,8 +57,25 @@ def test_deployments_begin_delete(self, resource_group): response = self.client.deployments.begin_delete( resource_group_name=resource_group.name, deployment_name="str", - api_version="2025-03-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_deployments_list_by_resource_group(self, resource_group): + response = self.client.deployments.list_by_resource_group( + resource_group_name=resource_group.name, + ) + 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(self, resource_group): + response = self.client.deployments.list() + 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 4b63c4e81785..b35ead5412a4 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -19,34 +19,12 @@ 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="2025-03-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="2025-03-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): response = await self.client.deployments.get( resource_group_name=resource_group.name, deployment_name="str", - api_version="2025-03-01-preview", ) # please add some check logic here by yourself @@ -59,7 +37,6 @@ async def test_deployments_begin_create_or_update(self, resource_group): await self.client.deployments.begin_create_or_update( resource_group_name=resource_group.name, deployment_name="str", - api_version="2025-03-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -73,7 +50,6 @@ async def test_deployments_begin_update(self, resource_group): await self.client.deployments.begin_update( resource_group_name=resource_group.name, deployment_name="str", - api_version="2025-03-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -87,9 +63,26 @@ async def test_deployments_begin_delete(self, resource_group): await self.client.deployments.begin_delete( resource_group_name=resource_group.name, deployment_name="str", - api_version="2025-03-01-preview", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_deployments_list_by_resource_group(self, resource_group): + response = self.client.deployments.list_by_resource_group( + resource_group_name=resource_group.name, + ) + 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(self, resource_group): + response = self.client.deployments.list() + 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_nginx_deployment_waf_policies_operations.py b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_nginx_deployment_waf_policies_operations.py new file mode 100644 index 000000000000..7ca4cb68f231 --- /dev/null +++ b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_nginx_deployment_waf_policies_operations.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.nginx import NginxManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNginxManagementNginxDeploymentWafPoliciesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NginxManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_nginx_deployment_waf_policies_analysis(self, resource_group): + response = self.client.nginx_deployment_waf_policies.analysis( + resource_group_name=resource_group.name, + deployment_name="str", + waf_policy_name="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_nginx_deployment_waf_policies_operations_async.py b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_nginx_deployment_waf_policies_operations_async.py new file mode 100644 index 000000000000..bcefbcc89dd1 --- /dev/null +++ b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_nginx_deployment_waf_policies_operations_async.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.nginx.aio import NginxManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNginxManagementNginxDeploymentWafPoliciesOperationsAsync(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_nginx_deployment_waf_policies_analysis(self, resource_group): + response = await self.client.nginx_deployment_waf_policies.analysis( + resource_group_name=resource_group.name, + deployment_name="str", + waf_policy_name="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_operations.py b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_operations.py index eb04a81419b0..72612974da3e 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_operations.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -21,9 +21,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_operations_list(self, resource_group): - response = self.client.operations.list( - api_version="2025-03-01-preview", - ) + response = self.client.operations.list() result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_operations_async.py b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_operations_async.py index 5acab908bbf1..7e9d95ec9767 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_operations_async.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -22,9 +22,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_operations_list(self, resource_group): - response = self.client.operations.list( - api_version="2025-03-01-preview", - ) + response = self.client.operations.list() result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_waf_policy_operations.py b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_waf_policy_operations.py index e660f38d9561..3a422a7cd4c1 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_waf_policy_operations.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_waf_policy_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -24,7 +24,6 @@ def test_waf_policy_list(self, resource_group): response = self.client.waf_policy.list( resource_group_name=resource_group.name, deployment_name="str", - api_version="2025-03-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +36,6 @@ def test_waf_policy_get(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", waf_policy_name="str", - api_version="2025-03-01-preview", ) # please add some check logic here by yourself @@ -50,7 +48,6 @@ def test_waf_policy_begin_create(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", waf_policy_name="str", - api_version="2025-03-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -63,7 +60,6 @@ def test_waf_policy_begin_delete(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", waf_policy_name="str", - api_version="2025-03-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_waf_policy_operations_async.py b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_waf_policy_operations_async.py index 9935c017ee46..4ede9e9af877 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_waf_policy_operations_async.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_tests/test_nginx_management_waf_policy_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -25,7 +25,6 @@ async def test_waf_policy_list(self, resource_group): response = self.client.waf_policy.list( resource_group_name=resource_group.name, deployment_name="str", - api_version="2025-03-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +37,6 @@ async def test_waf_policy_get(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", waf_policy_name="str", - api_version="2025-03-01-preview", ) # please add some check logic here by yourself @@ -52,7 +50,6 @@ async def test_waf_policy_begin_create(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", waf_policy_name="str", - api_version="2025-03-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -67,7 +64,6 @@ async def test_waf_policy_begin_delete(self, resource_group): resource_group_name=resource_group.name, deployment_name="str", waf_policy_name="str", - api_version="2025-03-01-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/nginx/azure-mgmt-nginx/pyproject.toml b/sdk/nginx/azure-mgmt-nginx/pyproject.toml index e500087a3120..48265d5c5cad 100644 --- a/sdk/nginx/azure-mgmt-nginx/pyproject.toml +++ b/sdk/nginx/azure-mgmt-nginx/pyproject.toml @@ -13,7 +13,7 @@ authors = [ description = "Microsoft Azure Nginx Management Client Library for Python" license = "MIT" classifiers = [ - "Development Status :: 4 - Beta", + "Development Status :: 5 - Production/Stable", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", @@ -79,7 +79,7 @@ package_name = "azure-mgmt-nginx" package_nspkg = "azure-mgmt-nspkg" package_pprint_name = "Nginx Management" package_doc_id = "" -is_stable = false +is_stable = true is_arm = true need_msrestazure = false need_azuremgmtcore = true diff --git a/sdk/nginx/azure-mgmt-nginx/tsp-location.yaml b/sdk/nginx/azure-mgmt-nginx/tsp-location.yaml new file mode 100644 index 000000000000..fcac24e7402d --- /dev/null +++ b/sdk/nginx/azure-mgmt-nginx/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/nginx/Nginx.Management +commit: 6f518a19a4f53c8ccb38b839c6076e3b578d795d +repo: Azure/azure-rest-api-specs +additionalDirectories: From 1a10fb0a2b856245bc8d1082d15299ae932746d8 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Fri, 13 Mar 2026 09:28:31 +0000 Subject: [PATCH 2/2] Configurations: 'specification/nginx/Nginx.Management/tspconfig.yaml', API Version: 2025-11-01, SDK Release Type: stable, and CommitSHA: '747cf4e0938b84f2790eaabd8760bd97d8998aa1' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6007417 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- sdk/nginx/azure-mgmt-nginx/CHANGELOG.md | 2 +- sdk/nginx/azure-mgmt-nginx/_metadata.json | 2 +- sdk/nginx/azure-mgmt-nginx/tsp-location.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/nginx/azure-mgmt-nginx/CHANGELOG.md b/sdk/nginx/azure-mgmt-nginx/CHANGELOG.md index a343a7f8a0da..8a3f6430314f 100644 --- a/sdk/nginx/azure-mgmt-nginx/CHANGELOG.md +++ b/sdk/nginx/azure-mgmt-nginx/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 4.0.0 (2026-03-12) +## 4.0.0 (2026-03-13) ### Features Added diff --git a/sdk/nginx/azure-mgmt-nginx/_metadata.json b/sdk/nginx/azure-mgmt-nginx/_metadata.json index e3915c03ff0b..50c3bf1ba413 100644 --- a/sdk/nginx/azure-mgmt-nginx/_metadata.json +++ b/sdk/nginx/azure-mgmt-nginx/_metadata.json @@ -3,7 +3,7 @@ "apiVersions": { "Nginx.NginxPlus": "2025-11-01" }, - "commit": "6f518a19a4f53c8ccb38b839c6076e3b578d795d", + "commit": "747cf4e0938b84f2790eaabd8760bd97d8998aa1", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "typespec_src": "specification/nginx/Nginx.Management", "emitterVersion": "0.60.2" diff --git a/sdk/nginx/azure-mgmt-nginx/tsp-location.yaml b/sdk/nginx/azure-mgmt-nginx/tsp-location.yaml index fcac24e7402d..3e1ac346157a 100644 --- a/sdk/nginx/azure-mgmt-nginx/tsp-location.yaml +++ b/sdk/nginx/azure-mgmt-nginx/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/nginx/Nginx.Management -commit: 6f518a19a4f53c8ccb38b839c6076e3b578d795d +commit: 747cf4e0938b84f2790eaabd8760bd97d8998aa1 repo: Azure/azure-rest-api-specs additionalDirectories: