diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/CHANGELOG.md b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/CHANGELOG.md index 71eda08204a9..81d176d0aada 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/CHANGELOG.md +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/CHANGELOG.md @@ -1,5 +1,34 @@ # Release History +## 1.1.0 (2025-11-12) + +### Features Added + + - Model `PaloAltoNetworksNgfwMgmtClient` added parameter `cloud_setting` in method `__init__` + - Client `PaloAltoNetworksNgfwMgmtClient` added operation group `palo_alto_networks_cloudngfw_operations` + - Client `PaloAltoNetworksNgfwMgmtClient` added operation group `metrics_object_firewall` + - Model `FirewallResource` added property `is_strata_cloud_managed` + - Model `FirewallResource` added property `strata_cloud_manager_config` + - Model `FirewallResourceUpdateProperties` added property `is_strata_cloud_managed` + - Model `FirewallResourceUpdateProperties` added property `strata_cloud_manager_config` + - Model `FirewallStatusResource` added property `is_strata_cloud_managed` + - Model `FirewallStatusResource` added property `strata_cloud_manager_info` + - Model `NetworkProfile` added property `trusted_ranges` + - Model `NetworkProfile` added property `private_source_nat_rules_destination` + - Added model `CloudManagerTenantList` + - Added enum `EnableStatus` + - Added model `MetricsObjectFirewallResource` + - Added model `MetricsObjectFirewallResourceListResult` + - Added model `ProductSerialNumberRequestStatus` + - Added model `ProductSerialNumberStatus` + - Added enum `ProductSerialStatusValues` + - Added enum `RegistrationStatus` + - Added model `StrataCloudManagerConfig` + - Added model `StrataCloudManagerInfo` + - Added model `SupportInfoModel` + - Added operation group `MetricsObjectFirewallOperations` + - Added operation group `PaloAltoNetworksCloudngfwOperationsOperations` + ## 2.0.0b1 (2023-11-20) ### Features Added diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/MANIFEST.in b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/MANIFEST.in index 898194624431..af9dc1bd1b1f 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/MANIFEST.in +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/MANIFEST.in @@ -1,8 +1,7 @@ -include _meta.json -recursive-include tests *.py *.json -recursive-include samples *.py *.md include *.md -include azure/__init__.py -include azure/mgmt/__init__.py include LICENSE include azure/mgmt/paloaltonetworksngfw/py.typed +recursive-include tests *.py +recursive-include samples *.py *.md +include azure/__init__.py +include azure/mgmt/__init__.py diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/_meta.json b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/_meta.json deleted file mode 100644 index 12fe0d5e02b1..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "7c906b15744aaf7b782dfb82ccefcbef05cbf20b", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.7", - "use": [ - "@autorest/python@6.7.1", - "@autorest/modelerfour@4.26.2" - ], - "autorest_command": "autorest specification/paloaltonetworks/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", - "readme": "specification/paloaltonetworks/resource-manager/readme.md" -} \ No newline at end of file diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/_metadata.json b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/_metadata.json new file mode 100644 index 000000000000..21f5d2d365a2 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/_metadata.json @@ -0,0 +1,14 @@ +{ + "apiVersion": "2025-10-08", + "commit": "ea59de0de01a84fdea241f85e3cb518c0339c9ba", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "typespec_src": "specification/paloaltonetworks/PaloAltoNetworks.Management", + "emitterVersion": "0.52.2", + "autorest": "3.10.2", + "use": [ + "@autorest/python@6.41.4", + "@autorest/modelerfour@4.27.0" + ], + "autorest_command": "autorest specification/paloaltonetworks/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.41.4 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "readme": "specification/paloaltonetworks/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/apiview-properties.json b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/apiview-properties.json new file mode 100644 index 000000000000..2ab2d5427454 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/apiview-properties.json @@ -0,0 +1,320 @@ +{ + "CrossLanguagePackageId": null, + "CrossLanguageDefinitionId": { + "azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectListResponse": null, + "azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectModel": null, + "azure.mgmt.paloaltonetworksngfw.models.ApplicationInsights": null, + "azure.mgmt.paloaltonetworksngfw.models.AppSeenData": null, + "azure.mgmt.paloaltonetworksngfw.models.AppSeenInfo": null, + "azure.mgmt.paloaltonetworksngfw.models.AzureResourceManagerManagedIdentityProperties": null, + "azure.mgmt.paloaltonetworksngfw.models.AzureResourceManagerUserAssignedIdentity": null, + "azure.mgmt.paloaltonetworksngfw.models.Category": null, + "azure.mgmt.paloaltonetworksngfw.models.Resource": null, + "azure.mgmt.paloaltonetworksngfw.models.ProxyResource": null, + "azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource": null, + "azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResourceListResult": null, + "azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource": null, + "azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResourceListResult": null, + "azure.mgmt.paloaltonetworksngfw.models.Changelog": null, + "azure.mgmt.paloaltonetworksngfw.models.CloudManagerTenantList": null, + "azure.mgmt.paloaltonetworksngfw.models.CountriesResponse": null, + "azure.mgmt.paloaltonetworksngfw.models.Country": null, + "azure.mgmt.paloaltonetworksngfw.models.DestinationAddr": null, + "azure.mgmt.paloaltonetworksngfw.models.DNSSettings": null, + "azure.mgmt.paloaltonetworksngfw.models.EndpointConfiguration": null, + "azure.mgmt.paloaltonetworksngfw.models.ErrorAdditionalInfo": null, + "azure.mgmt.paloaltonetworksngfw.models.ErrorDetail": null, + "azure.mgmt.paloaltonetworksngfw.models.ErrorResponse": null, + "azure.mgmt.paloaltonetworksngfw.models.EventHub": null, + "azure.mgmt.paloaltonetworksngfw.models.TrackedResource": null, + "azure.mgmt.paloaltonetworksngfw.models.FirewallResource": null, + "azure.mgmt.paloaltonetworksngfw.models.FirewallResourceListResult": null, + "azure.mgmt.paloaltonetworksngfw.models.FirewallResourceUpdate": null, + "azure.mgmt.paloaltonetworksngfw.models.FirewallResourceUpdateProperties": null, + "azure.mgmt.paloaltonetworksngfw.models.FirewallStatusResource": null, + "azure.mgmt.paloaltonetworksngfw.models.FirewallStatusResourceListResult": null, + "azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource": null, + "azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResourceListResult": null, + "azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource": null, + "azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResourceListResult": null, + "azure.mgmt.paloaltonetworksngfw.models.FrontendSetting": null, + "azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackInfo": null, + "azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource": null, + "azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResourceListResult": null, + "azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResourceUpdate": null, + "azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResourceUpdateProperties": null, + "azure.mgmt.paloaltonetworksngfw.models.IPAddress": null, + "azure.mgmt.paloaltonetworksngfw.models.IPAddressSpace": null, + "azure.mgmt.paloaltonetworksngfw.models.ListAppIdResponse": null, + "azure.mgmt.paloaltonetworksngfw.models.ListFirewallsResponse": null, + "azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource": null, + "azure.mgmt.paloaltonetworksngfw.models.LocalRulesResourceListResult": null, + "azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource": null, + "azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResourceListResult": null, + "azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResourceUpdate": null, + "azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResourceUpdateProperties": null, + "azure.mgmt.paloaltonetworksngfw.models.LogDestination": null, + "azure.mgmt.paloaltonetworksngfw.models.LogSettings": null, + "azure.mgmt.paloaltonetworksngfw.models.MarketplaceDetails": null, + "azure.mgmt.paloaltonetworksngfw.models.MetricsObjectFirewallResource": null, + "azure.mgmt.paloaltonetworksngfw.models.MetricsObjectFirewallResourceListResult": null, + "azure.mgmt.paloaltonetworksngfw.models.MonitorLog": null, + "azure.mgmt.paloaltonetworksngfw.models.NameDescriptionObject": null, + "azure.mgmt.paloaltonetworksngfw.models.NetworkProfile": null, + "azure.mgmt.paloaltonetworksngfw.models.Operation": null, + "azure.mgmt.paloaltonetworksngfw.models.OperationDisplay": null, + "azure.mgmt.paloaltonetworksngfw.models.OperationListResult": null, + "azure.mgmt.paloaltonetworksngfw.models.PanoramaConfig": null, + "azure.mgmt.paloaltonetworksngfw.models.PanoramaStatus": null, + "azure.mgmt.paloaltonetworksngfw.models.PlanData": null, + "azure.mgmt.paloaltonetworksngfw.models.PostRulesResource": null, + "azure.mgmt.paloaltonetworksngfw.models.PostRulesResourceListResult": null, + "azure.mgmt.paloaltonetworksngfw.models.PredefinedUrlCategoriesResponse": null, + "azure.mgmt.paloaltonetworksngfw.models.PredefinedUrlCategory": null, + "azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource": null, + "azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResourceListResult": null, + "azure.mgmt.paloaltonetworksngfw.models.PrefixListResource": null, + "azure.mgmt.paloaltonetworksngfw.models.PrefixListResourceListResult": null, + "azure.mgmt.paloaltonetworksngfw.models.PreRulesResource": null, + "azure.mgmt.paloaltonetworksngfw.models.PreRulesResourceListResult": null, + "azure.mgmt.paloaltonetworksngfw.models.ProductSerialNumberRequestStatus": null, + "azure.mgmt.paloaltonetworksngfw.models.ProductSerialNumberStatus": null, + "azure.mgmt.paloaltonetworksngfw.models.RuleCounter": null, + "azure.mgmt.paloaltonetworksngfw.models.RuleCounterReset": null, + "azure.mgmt.paloaltonetworksngfw.models.RulestackDetails": null, + "azure.mgmt.paloaltonetworksngfw.models.SecurityServices": null, + "azure.mgmt.paloaltonetworksngfw.models.SecurityServicesResponse": null, + "azure.mgmt.paloaltonetworksngfw.models.SecurityServicesTypeList": null, + "azure.mgmt.paloaltonetworksngfw.models.SourceAddr": null, + "azure.mgmt.paloaltonetworksngfw.models.StorageAccount": null, + "azure.mgmt.paloaltonetworksngfw.models.StrataCloudManagerConfig": null, + "azure.mgmt.paloaltonetworksngfw.models.StrataCloudManagerInfo": null, + "azure.mgmt.paloaltonetworksngfw.models.SupportInfo": null, + "azure.mgmt.paloaltonetworksngfw.models.SupportInfoModel": null, + "azure.mgmt.paloaltonetworksngfw.models.SystemData": null, + "azure.mgmt.paloaltonetworksngfw.models.TagInfo": null, + "azure.mgmt.paloaltonetworksngfw.models.VnetConfiguration": null, + "azure.mgmt.paloaltonetworksngfw.models.VwanConfiguration": null, + "azure.mgmt.paloaltonetworksngfw.models.CreatedByType": null, + "azure.mgmt.paloaltonetworksngfw.models.ManagedIdentityType": null, + "azure.mgmt.paloaltonetworksngfw.models.ScopeType": null, + "azure.mgmt.paloaltonetworksngfw.models.DefaultMode": null, + "azure.mgmt.paloaltonetworksngfw.models.ProvisioningState": null, + "azure.mgmt.paloaltonetworksngfw.models.BooleanEnum": null, + "azure.mgmt.paloaltonetworksngfw.models.StateEnum": null, + "azure.mgmt.paloaltonetworksngfw.models.ActionEnum": null, + "azure.mgmt.paloaltonetworksngfw.models.DecryptionRuleTypeEnum": null, + "azure.mgmt.paloaltonetworksngfw.models.Origin": null, + "azure.mgmt.paloaltonetworksngfw.models.ActionType": null, + "azure.mgmt.paloaltonetworksngfw.models.ProtocolType": null, + "azure.mgmt.paloaltonetworksngfw.models.NetworkType": null, + "azure.mgmt.paloaltonetworksngfw.models.EgressNat": null, + "azure.mgmt.paloaltonetworksngfw.models.DNSProxy": null, + "azure.mgmt.paloaltonetworksngfw.models.EnabledDNSType": null, + "azure.mgmt.paloaltonetworksngfw.models.UsageType": null, + "azure.mgmt.paloaltonetworksngfw.models.BillingCycle": null, + "azure.mgmt.paloaltonetworksngfw.models.MarketplaceSubscriptionStatus": null, + "azure.mgmt.paloaltonetworksngfw.models.HealthStatus": null, + "azure.mgmt.paloaltonetworksngfw.models.ServerStatus": null, + "azure.mgmt.paloaltonetworksngfw.models.ReadOnlyProvisioningState": null, + "azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectTypeEnum": null, + "azure.mgmt.paloaltonetworksngfw.models.SecurityServicesTypeEnum": null, + "azure.mgmt.paloaltonetworksngfw.models.RegistrationStatus": null, + "azure.mgmt.paloaltonetworksngfw.models.EnableStatus": null, + "azure.mgmt.paloaltonetworksngfw.models.LogType": null, + "azure.mgmt.paloaltonetworksngfw.models.LogOption": null, + "azure.mgmt.paloaltonetworksngfw.models.ProductSerialStatusValues": null, + "azure.mgmt.paloaltonetworksngfw.operations.GlobalRulestackOperations.list": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.GlobalRulestackOperations.list": null, + "azure.mgmt.paloaltonetworksngfw.operations.GlobalRulestackOperations.get": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.GlobalRulestackOperations.get": null, + "azure.mgmt.paloaltonetworksngfw.operations.GlobalRulestackOperations.begin_create_or_update": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.GlobalRulestackOperations.begin_create_or_update": null, + "azure.mgmt.paloaltonetworksngfw.operations.GlobalRulestackOperations.update": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.GlobalRulestackOperations.update": null, + "azure.mgmt.paloaltonetworksngfw.operations.GlobalRulestackOperations.begin_delete": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.GlobalRulestackOperations.begin_delete": null, + "azure.mgmt.paloaltonetworksngfw.operations.GlobalRulestackOperations.begin_commit": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.GlobalRulestackOperations.begin_commit": null, + "azure.mgmt.paloaltonetworksngfw.operations.GlobalRulestackOperations.get_change_log": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.GlobalRulestackOperations.get_change_log": null, + "azure.mgmt.paloaltonetworksngfw.operations.GlobalRulestackOperations.list_advanced_security_objects": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.GlobalRulestackOperations.list_advanced_security_objects": null, + "azure.mgmt.paloaltonetworksngfw.operations.GlobalRulestackOperations.list_app_ids": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.GlobalRulestackOperations.list_app_ids": null, + "azure.mgmt.paloaltonetworksngfw.operations.GlobalRulestackOperations.list_countries": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.GlobalRulestackOperations.list_countries": null, + "azure.mgmt.paloaltonetworksngfw.operations.GlobalRulestackOperations.list_firewalls": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.GlobalRulestackOperations.list_firewalls": null, + "azure.mgmt.paloaltonetworksngfw.operations.GlobalRulestackOperations.list_predefined_url_categories": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.GlobalRulestackOperations.list_predefined_url_categories": null, + "azure.mgmt.paloaltonetworksngfw.operations.GlobalRulestackOperations.list_security_services": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.GlobalRulestackOperations.list_security_services": null, + "azure.mgmt.paloaltonetworksngfw.operations.GlobalRulestackOperations.revert": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.GlobalRulestackOperations.revert": null, + "azure.mgmt.paloaltonetworksngfw.operations.CertificateObjectGlobalRulestackOperations.list": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.CertificateObjectGlobalRulestackOperations.list": null, + "azure.mgmt.paloaltonetworksngfw.operations.CertificateObjectGlobalRulestackOperations.get": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.CertificateObjectGlobalRulestackOperations.get": null, + "azure.mgmt.paloaltonetworksngfw.operations.CertificateObjectGlobalRulestackOperations.begin_create_or_update": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.CertificateObjectGlobalRulestackOperations.begin_create_or_update": null, + "azure.mgmt.paloaltonetworksngfw.operations.CertificateObjectGlobalRulestackOperations.begin_delete": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.CertificateObjectGlobalRulestackOperations.begin_delete": null, + "azure.mgmt.paloaltonetworksngfw.operations.FqdnListGlobalRulestackOperations.list": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.FqdnListGlobalRulestackOperations.list": null, + "azure.mgmt.paloaltonetworksngfw.operations.FqdnListGlobalRulestackOperations.get": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.FqdnListGlobalRulestackOperations.get": null, + "azure.mgmt.paloaltonetworksngfw.operations.FqdnListGlobalRulestackOperations.begin_create_or_update": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.FqdnListGlobalRulestackOperations.begin_create_or_update": null, + "azure.mgmt.paloaltonetworksngfw.operations.FqdnListGlobalRulestackOperations.begin_delete": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.FqdnListGlobalRulestackOperations.begin_delete": null, + "azure.mgmt.paloaltonetworksngfw.operations.PostRulesOperations.list": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.PostRulesOperations.list": null, + "azure.mgmt.paloaltonetworksngfw.operations.PostRulesOperations.get": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.PostRulesOperations.get": null, + "azure.mgmt.paloaltonetworksngfw.operations.PostRulesOperations.begin_create_or_update": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.PostRulesOperations.begin_create_or_update": null, + "azure.mgmt.paloaltonetworksngfw.operations.PostRulesOperations.begin_delete": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.PostRulesOperations.begin_delete": null, + "azure.mgmt.paloaltonetworksngfw.operations.PostRulesOperations.get_counters": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.PostRulesOperations.get_counters": null, + "azure.mgmt.paloaltonetworksngfw.operations.PostRulesOperations.refresh_counters": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.PostRulesOperations.refresh_counters": null, + "azure.mgmt.paloaltonetworksngfw.operations.PostRulesOperations.reset_counters": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.PostRulesOperations.reset_counters": null, + "azure.mgmt.paloaltonetworksngfw.operations.PreRulesOperations.list": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.PreRulesOperations.list": null, + "azure.mgmt.paloaltonetworksngfw.operations.PreRulesOperations.get": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.PreRulesOperations.get": null, + "azure.mgmt.paloaltonetworksngfw.operations.PreRulesOperations.begin_create_or_update": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.PreRulesOperations.begin_create_or_update": null, + "azure.mgmt.paloaltonetworksngfw.operations.PreRulesOperations.begin_delete": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.PreRulesOperations.begin_delete": null, + "azure.mgmt.paloaltonetworksngfw.operations.PreRulesOperations.get_counters": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.PreRulesOperations.get_counters": null, + "azure.mgmt.paloaltonetworksngfw.operations.PreRulesOperations.refresh_counters": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.PreRulesOperations.refresh_counters": null, + "azure.mgmt.paloaltonetworksngfw.operations.PreRulesOperations.reset_counters": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.PreRulesOperations.reset_counters": null, + "azure.mgmt.paloaltonetworksngfw.operations.PrefixListGlobalRulestackOperations.list": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.PrefixListGlobalRulestackOperations.list": null, + "azure.mgmt.paloaltonetworksngfw.operations.PrefixListGlobalRulestackOperations.get": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.PrefixListGlobalRulestackOperations.get": null, + "azure.mgmt.paloaltonetworksngfw.operations.PrefixListGlobalRulestackOperations.begin_create_or_update": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.PrefixListGlobalRulestackOperations.begin_create_or_update": null, + "azure.mgmt.paloaltonetworksngfw.operations.PrefixListGlobalRulestackOperations.begin_delete": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.PrefixListGlobalRulestackOperations.begin_delete": null, + "azure.mgmt.paloaltonetworksngfw.operations.Operations.list": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.Operations.list": null, + "azure.mgmt.paloaltonetworksngfw.operations.PaloAltoNetworksCloudngfwOperationsOperations.create_product_serial_number": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.PaloAltoNetworksCloudngfwOperationsOperations.create_product_serial_number": null, + "azure.mgmt.paloaltonetworksngfw.operations.PaloAltoNetworksCloudngfwOperationsOperations.list_cloud_manager_tenants": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.PaloAltoNetworksCloudngfwOperationsOperations.list_cloud_manager_tenants": null, + "azure.mgmt.paloaltonetworksngfw.operations.PaloAltoNetworksCloudngfwOperationsOperations.list_product_serial_number_status": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.PaloAltoNetworksCloudngfwOperationsOperations.list_product_serial_number_status": null, + "azure.mgmt.paloaltonetworksngfw.operations.PaloAltoNetworksCloudngfwOperationsOperations.list_support_info": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.PaloAltoNetworksCloudngfwOperationsOperations.list_support_info": null, + "azure.mgmt.paloaltonetworksngfw.operations.FirewallsOperations.list_by_subscription": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.FirewallsOperations.list_by_subscription": null, + "azure.mgmt.paloaltonetworksngfw.operations.FirewallsOperations.list_by_resource_group": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.FirewallsOperations.list_by_resource_group": null, + "azure.mgmt.paloaltonetworksngfw.operations.FirewallsOperations.get": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.FirewallsOperations.get": null, + "azure.mgmt.paloaltonetworksngfw.operations.FirewallsOperations.begin_create_or_update": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.FirewallsOperations.begin_create_or_update": null, + "azure.mgmt.paloaltonetworksngfw.operations.FirewallsOperations.update": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.FirewallsOperations.update": null, + "azure.mgmt.paloaltonetworksngfw.operations.FirewallsOperations.begin_delete": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.FirewallsOperations.begin_delete": null, + "azure.mgmt.paloaltonetworksngfw.operations.FirewallsOperations.get_global_rulestack": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.FirewallsOperations.get_global_rulestack": null, + "azure.mgmt.paloaltonetworksngfw.operations.FirewallsOperations.get_log_profile": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.FirewallsOperations.get_log_profile": null, + "azure.mgmt.paloaltonetworksngfw.operations.FirewallsOperations.get_support_info": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.FirewallsOperations.get_support_info": null, + "azure.mgmt.paloaltonetworksngfw.operations.FirewallsOperations.save_log_profile": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.FirewallsOperations.save_log_profile": null, + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.list_by_subscription": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.list_by_subscription": null, + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.list_by_resource_group": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.list_by_resource_group": null, + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.get": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.get": null, + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.begin_create_or_update": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.begin_create_or_update": null, + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.update": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.update": null, + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.begin_delete": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.begin_delete": null, + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.begin_commit": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.begin_commit": null, + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.get_change_log": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.get_change_log": null, + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.get_support_info": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.get_support_info": null, + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.list_advanced_security_objects": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.list_advanced_security_objects": null, + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.list_app_ids": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.list_app_ids": null, + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.list_countries": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.list_countries": null, + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.list_firewalls": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.list_firewalls": null, + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.list_predefined_url_categories": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.list_predefined_url_categories": null, + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.list_security_services": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.list_security_services": null, + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.revert": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.revert": null, + "azure.mgmt.paloaltonetworksngfw.operations.MetricsObjectFirewallOperations.list_by_firewalls": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.MetricsObjectFirewallOperations.list_by_firewalls": null, + "azure.mgmt.paloaltonetworksngfw.operations.MetricsObjectFirewallOperations.get": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.MetricsObjectFirewallOperations.get": null, + "azure.mgmt.paloaltonetworksngfw.operations.MetricsObjectFirewallOperations.begin_create_or_update": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.MetricsObjectFirewallOperations.begin_create_or_update": null, + "azure.mgmt.paloaltonetworksngfw.operations.MetricsObjectFirewallOperations.begin_delete": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.MetricsObjectFirewallOperations.begin_delete": null, + "azure.mgmt.paloaltonetworksngfw.operations.FirewallStatusOperations.list_by_firewalls": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.FirewallStatusOperations.list_by_firewalls": null, + "azure.mgmt.paloaltonetworksngfw.operations.FirewallStatusOperations.get": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.FirewallStatusOperations.get": null, + "azure.mgmt.paloaltonetworksngfw.operations.CertificateObjectLocalRulestackOperations.list_by_local_rulestacks": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.CertificateObjectLocalRulestackOperations.list_by_local_rulestacks": null, + "azure.mgmt.paloaltonetworksngfw.operations.CertificateObjectLocalRulestackOperations.get": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.CertificateObjectLocalRulestackOperations.get": null, + "azure.mgmt.paloaltonetworksngfw.operations.CertificateObjectLocalRulestackOperations.begin_create_or_update": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.CertificateObjectLocalRulestackOperations.begin_create_or_update": null, + "azure.mgmt.paloaltonetworksngfw.operations.CertificateObjectLocalRulestackOperations.begin_delete": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.CertificateObjectLocalRulestackOperations.begin_delete": null, + "azure.mgmt.paloaltonetworksngfw.operations.FqdnListLocalRulestackOperations.list_by_local_rulestacks": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.FqdnListLocalRulestackOperations.list_by_local_rulestacks": null, + "azure.mgmt.paloaltonetworksngfw.operations.FqdnListLocalRulestackOperations.get": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.FqdnListLocalRulestackOperations.get": null, + "azure.mgmt.paloaltonetworksngfw.operations.FqdnListLocalRulestackOperations.begin_create_or_update": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.FqdnListLocalRulestackOperations.begin_create_or_update": null, + "azure.mgmt.paloaltonetworksngfw.operations.FqdnListLocalRulestackOperations.begin_delete": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.FqdnListLocalRulestackOperations.begin_delete": null, + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulesOperations.list_by_local_rulestacks": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulesOperations.list_by_local_rulestacks": null, + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulesOperations.get": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulesOperations.get": null, + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulesOperations.begin_create_or_update": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulesOperations.begin_create_or_update": null, + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulesOperations.begin_delete": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulesOperations.begin_delete": null, + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulesOperations.get_counters": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulesOperations.get_counters": null, + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulesOperations.refresh_counters": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulesOperations.refresh_counters": null, + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulesOperations.reset_counters": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulesOperations.reset_counters": null, + "azure.mgmt.paloaltonetworksngfw.operations.PrefixListLocalRulestackOperations.list_by_local_rulestacks": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.PrefixListLocalRulestackOperations.list_by_local_rulestacks": null, + "azure.mgmt.paloaltonetworksngfw.operations.PrefixListLocalRulestackOperations.get": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.PrefixListLocalRulestackOperations.get": null, + "azure.mgmt.paloaltonetworksngfw.operations.PrefixListLocalRulestackOperations.begin_create_or_update": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.PrefixListLocalRulestackOperations.begin_create_or_update": null, + "azure.mgmt.paloaltonetworksngfw.operations.PrefixListLocalRulestackOperations.begin_delete": null, + "azure.mgmt.paloaltonetworksngfw.aio.operations.PrefixListLocalRulestackOperations.begin_delete": null + } +} \ No newline at end of file diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/assets.json b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/assets.json deleted file mode 100644 index edc58dbd031c..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/assets.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "AssetsRepo": "Azure/azure-sdk-assets", - "AssetsRepoPrefixPath": "python", - "TagPrefix": "python/paloaltonetworks/azure-mgmt-paloaltonetworksngfw", - "Tag": "python/paloaltonetworks/azure-mgmt-paloaltonetworksngfw_caa84d64a6" -} \ No newline at end of file diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/__init__.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/__init__.py index 8db66d3d0f0f..d55ccad1f573 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/__init__.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/__init__.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/__init__.py index 8db66d3d0f0f..d55ccad1f573 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/__init__.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/__init__.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/__init__.py index d11a9719d50b..f7f6023b3ee3 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/__init__.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._palo_alto_networks_ngfw_mgmt_client import PaloAltoNetworksNgfwMgmtClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._palo_alto_networks_ngfw_mgmt_client import PaloAltoNetworksNgfwMgmtClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "PaloAltoNetworksNgfwMgmtClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_configuration.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_configuration.py index 7e69dd76f260..7aa98615f9e5 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_configuration.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_configuration.py @@ -6,20 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports + from azure.core import AzureClouds from azure.core.credentials import TokenCredential -class PaloAltoNetworksNgfwMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class PaloAltoNetworksNgfwMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for PaloAltoNetworksNgfwMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -29,14 +28,22 @@ class PaloAltoNetworksNgfwMgmtClientConfiguration(Configuration): # pylint: dis :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-09-01". Note that overriding this + :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-10-08". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(PaloAltoNetworksNgfwMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-09-01") + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2025-10-08") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -45,9 +52,11 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.credential = credential self.subscription_id = subscription_id + self.cloud_setting = cloud_setting self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-paloaltonetworksngfw/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +65,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = ARMChallengeAuthenticationPolicy( diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_palo_alto_networks_ngfw_mgmt_client.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_palo_alto_networks_ngfw_mgmt_client.py index aae495a25e03..37640691b366 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_palo_alto_networks_ngfw_mgmt_client.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_palo_alto_networks_ngfw_mgmt_client.py @@ -7,14 +7,19 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast +from typing_extensions import Self +from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from ._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration -from ._serialization import Deserializer, Serializer +from ._utils.serialization import Deserializer, Serializer from .operations import ( CertificateObjectGlobalRulestackOperations, CertificateObjectLocalRulestackOperations, @@ -25,7 +30,9 @@ GlobalRulestackOperations, LocalRulesOperations, LocalRulestacksOperations, + MetricsObjectFirewallOperations, Operations, + PaloAltoNetworksCloudngfwOperationsOperations, PostRulesOperations, PreRulesOperations, PrefixListGlobalRulestackOperations, @@ -33,11 +40,11 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports + from azure.core import AzureClouds from azure.core.credentials import TokenCredential -class PaloAltoNetworksNgfwMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class PaloAltoNetworksNgfwMgmtClient: # pylint: disable=too-many-instance-attributes """PaloAltoNetworksNgfwMgmtClient. :ivar global_rulestack: GlobalRulestackOperations operations @@ -51,17 +58,24 @@ class PaloAltoNetworksNgfwMgmtClient: # pylint: disable=client-accepts-api-vers azure.mgmt.paloaltonetworksngfw.operations.FqdnListGlobalRulestackOperations :ivar post_rules: PostRulesOperations operations :vartype post_rules: azure.mgmt.paloaltonetworksngfw.operations.PostRulesOperations + :ivar pre_rules: PreRulesOperations operations + :vartype pre_rules: azure.mgmt.paloaltonetworksngfw.operations.PreRulesOperations :ivar prefix_list_global_rulestack: PrefixListGlobalRulestackOperations operations :vartype prefix_list_global_rulestack: azure.mgmt.paloaltonetworksngfw.operations.PrefixListGlobalRulestackOperations - :ivar pre_rules: PreRulesOperations operations - :vartype pre_rules: azure.mgmt.paloaltonetworksngfw.operations.PreRulesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.paloaltonetworksngfw.operations.Operations + :ivar palo_alto_networks_cloudngfw_operations: PaloAltoNetworksCloudngfwOperationsOperations + operations + :vartype palo_alto_networks_cloudngfw_operations: + azure.mgmt.paloaltonetworksngfw.operations.PaloAltoNetworksCloudngfwOperationsOperations :ivar firewalls: FirewallsOperations operations :vartype firewalls: azure.mgmt.paloaltonetworksngfw.operations.FirewallsOperations :ivar local_rulestacks: LocalRulestacksOperations operations :vartype local_rulestacks: azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations + :ivar metrics_object_firewall: MetricsObjectFirewallOperations operations + :vartype metrics_object_firewall: + azure.mgmt.paloaltonetworksngfw.operations.MetricsObjectFirewallOperations :ivar firewall_status: FirewallStatusOperations operations :vartype firewall_status: azure.mgmt.paloaltonetworksngfw.operations.FirewallStatusOperations :ivar certificate_object_local_rulestack: CertificateObjectLocalRulestackOperations operations @@ -79,9 +93,12 @@ class PaloAltoNetworksNgfwMgmtClient: # pylint: disable=client-accepts-api-vers :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2023-09-01". Note that overriding this + :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-10-08". 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 @@ -92,13 +109,43 @@ def __init__( self, credential: "TokenCredential", subscription_id: str, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = PaloAltoNetworksNgfwMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs ) - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + 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) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -114,15 +161,21 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.post_rules = PostRulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.pre_rules = PreRulesOperations(self._client, self._config, self._serialize, self._deserialize) self.prefix_list_global_rulestack = PrefixListGlobalRulestackOperations( self._client, self._config, self._serialize, self._deserialize ) - self.pre_rules = PreRulesOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.palo_alto_networks_cloudngfw_operations = PaloAltoNetworksCloudngfwOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.firewalls = FirewallsOperations(self._client, self._config, self._serialize, self._deserialize) self.local_rulestacks = LocalRulestacksOperations( self._client, self._config, self._serialize, self._deserialize ) + self.metrics_object_firewall = MetricsObjectFirewallOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.firewall_status = FirewallStatusOperations(self._client, self._config, self._serialize, self._deserialize) self.certificate_object_local_rulestack = CertificateObjectLocalRulestackOperations( self._client, self._config, self._serialize, self._deserialize @@ -135,7 +188,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - def _send_request(self, request: HttpRequest, **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 @@ -155,12 +208,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: self._client.close() - def __enter__(self) -> "PaloAltoNetworksNgfwMgmtClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_patch.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_patch.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_vendor.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_utils/__init__.py similarity index 58% rename from sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_vendor.py rename to sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_utils/__init__.py index 0dafe0e287ff..0af9b28f6607 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_vendor.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_utils/__init__.py @@ -4,13 +4,3 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_serialization.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_utils/serialization.py similarity index 79% rename from sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_serialization.py rename to sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_utils/serialization.py index 4bae2292227b..ff543ed937ff 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_serialization.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_utils/serialization.py @@ -1,30 +1,12 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- -# # Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -# pylint: skip-file # pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode @@ -39,7 +21,6 @@ import sys import codecs from typing import ( - Dict, Any, cast, Optional, @@ -48,11 +29,7 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, - List, - Mapping, ) try: @@ -62,13 +39,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self -from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback -from azure.core.serialization import NULL as AzureCoreNull +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -91,6 +68,8 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: :param data: Input, could be bytes or stream (will be decoded with UTF8) or text :type data: str or bytes or IO :param str content_type: The content type. + :return: The deserialized data. + :rtype: object """ if hasattr(data, "read"): # Assume a stream @@ -112,7 +91,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: try: return json.loads(data_as_str) except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) + raise DeserializationError("JSON is invalid: {}".format(err), err) from err elif "xml" in (content_type or []): try: @@ -124,7 +103,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: pass return ET.fromstring(data_as_str) # nosec - except ET.ParseError: + except ET.ParseError as err: # It might be because the server has an issue, and returned JSON with # content-type XML.... # So let's try a JSON load, and if it's still broken @@ -143,7 +122,9 @@ def _json_attemp(data): # The function hack is because Py2.7 messes up with exception # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") - raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -153,6 +134,11 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], Use bytes and headers to NOT use any requests/aiohttp or whatever specific implementation. Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object """ # Try to use content-type from headers if available content_type = None @@ -170,13 +156,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -184,80 +163,31 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0.""" - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation.""" - return "Z" - - def dst(self, dt): - """No daylight saving for UTC.""" - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset): - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? None: - self.additional_properties: Dict[str, Any] = {} - for k in kwargs: + self.additional_properties: Optional[dict[str, Any]] = {} + for k in kwargs: # pylint: disable=consider-using-dict-items if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) elif k in self._validation and self._validation[k].get("readonly", False): @@ -305,13 +242,23 @@ def __init__(self, **kwargs: Any) -> None: setattr(self, k, kwargs[k]) def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ return not self.__eq__(other) def __str__(self) -> str: @@ -331,7 +278,11 @@ def is_xml_model(cls) -> bool: @classmethod def _create_xml_node(cls): - """Create XML node.""" + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ try: xml_map = cls._xml_map # type: ignore except AttributeError: @@ -340,7 +291,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to azure from this model. + """Return the JSON that would be sent to server from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -351,12 +302,14 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) def as_dict( self, keep_readonly: bool = True, - key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, **kwargs: Any ) -> JSON: """Return a dict that can be serialized using json.dump. @@ -385,12 +338,15 @@ def my_key_transformer(key, attr_desc, value): If you want XML serialization, you can pass the kwargs is_xml=True. + :param bool keep_readonly: If you want to serialize the readonly attributes :param function key_transformer: A key transformer function. :returns: A dict JSON compatible object :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) @classmethod def _infer_class_models(cls): @@ -400,30 +356,31 @@ def _infer_class_models(cls): client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} if cls.__name__ not in client_models: raise ValueError("Not Autorest generated code") - except Exception: + except Exception: # pylint: disable=broad-exception-caught # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. client_models = {cls.__name__: cls} return client_models @classmethod - def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, - key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -431,9 +388,11 @@ def from_dict( and last_rest_key_case_insensitive_extractor) :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -445,7 +404,7 @@ def from_dict( if key_extractors is None else key_extractors ) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def _flatten_subtype(cls, key, objects): @@ -453,21 +412,25 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) + result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access return result @classmethod def _classify(cls, response, objects): """Check the class _subtype_map for any child classes. We want to ignore any inherited _subtype_maps. - Remove the polymorphic key from the initial data. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class """ for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): subtype_value = None if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) else: subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: @@ -506,11 +469,13 @@ def _decode_attribute_map_key(key): inside the received data. :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str """ return key.replace("\\.", ".") -class Serializer(object): +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -545,7 +510,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -561,17 +526,20 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True - def _serialize(self, target_obj, data_type=None, **kwargs): + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): """Serialize data into a string according to type. - :param target_obj: The data to be serialized. + :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. + :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) keep_readonly = kwargs.get("keep_readonly", False) @@ -597,17 +565,19 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized = {} if is_xml_model_serialization: - serialized = target_obj._create_xml_node() + serialized = target_obj._create_xml_node() # pylint: disable=protected-access try: - attributes = target_obj._attribute_map + attributes = target_obj._attribute_map # pylint: disable=protected-access for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): continue if attr_name == "additional_properties" and attr_desc["key"] == "": if target_obj.additional_properties is not None: - serialized.update(target_obj.additional_properties) + serialized |= target_obj.additional_properties continue try: @@ -638,7 +608,8 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if isinstance(new_attr, list): serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): splitted_tag = new_attr.tag.split("}") if len(splitted_tag) == 2: # Namespace @@ -649,7 +620,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = unicode_str(new_attr) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -668,18 +639,18 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise_with_traceback(SerializationError, msg, err) - else: - return serialized + raise SerializationError(msg) from err + return serialized def body(self, data, data_type, **kwargs): """Serialize data intended for a request body. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized request body """ # Just in case this is a dict @@ -708,20 +679,22 @@ def body(self, data, data_type, **kwargs): attribute_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, ] - data = deserializer._deserialize(data_type, data) + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access except DeserializationError as err: - raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + raise SerializationError("Unable to build a model: " + str(err)) from err return self._serialize(data, data_type, **kwargs) def url(self, name, data, data_type, **kwargs): """Serialize data intended for a URL path. - :param data: The data to be serialized. + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :returns: The serialized URL path + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -730,30 +703,30 @@ def url(self, name, data, data_type, **kwargs): if kwargs.get("skip_quote") is True: output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return output + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output def query(self, name, data, data_type, **kwargs): """Serialize data intended for a URL query. - :param data: The data to be serialized. + :param str name: The name of the query parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :keyword bool skip_quote: Whether to skip quote the serialized result. - Defaults to False. - :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :rtype: str, list + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized query parameter """ try: # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] do_quote = not kwargs.get("skip_quote", False) - return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -763,19 +736,20 @@ def query(self, name, data, data_type, **kwargs): output = str(output) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def header(self, name, data, data_type, **kwargs): """Serialize data intended for a request header. - :param data: The data to be serialized. + :param str name: The name of the header. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized header """ try: if data_type in ["[str]"]: @@ -784,37 +758,36 @@ def header(self, name, data, data_type, **kwargs): output = self.serialize_data(data, data_type, **kwargs) if data_type == "bool": output = json.dumps(output) - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def serialize_data(self, data, data_type, **kwargs): """Serialize generic data according to supplied data type. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :param bool required: Whether it's essential that the data not be - empty or None - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list """ if data is None: raise ValueError("No value for given attribute") try: - if data is AzureCoreNull: + if data is CoreNull: return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) - elif data_type in self.serialize_type: + if data_type in self.serialize_type: return self.serialize_type[data_type](data, **kwargs) # If dependencies is empty, try with current data class # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, data.__class__) + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) if issubclass(enum_type, Enum): return Serializer.serialize_enum(data, enum_obj=enum_type) @@ -824,12 +797,11 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback(SerializationError, msg.format(data, data_type), err) - else: - return self._serialize(data, **kwargs) + raise SerializationError(msg.format(data, data_type)) from err + return self._serialize(data, **kwargs) @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) if custom_serializer: return custom_serializer @@ -845,23 +817,26 @@ def serialize_basic(cls, data, data_type, **kwargs): - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - is_xml bool : If set, use xml_basic_types_serializers - :param data: Object to be serialized. + :param obj data: Object to be serialized. :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object """ custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) if data_type == "str": return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec + return eval(data_type)(data) # nosec # pylint: disable=eval-used @classmethod def serialize_unicode(cls, data): """Special handling for serializing unicode strings in Py2. Encode to UTF-8 if unicode, otherwise handle as a str. - :param data: Object to be serialized. + :param str data: Object to be serialized. :rtype: str + :return: serialized object """ try: # If I received an enum, return its value return data.value @@ -875,8 +850,7 @@ def serialize_unicode(cls, data): return data except NameError: return str(data) - else: - return str(data) + return str(data) def serialize_iter(self, data, iter_type, div=None, **kwargs): """Serialize iterable. @@ -886,15 +860,13 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): serialization_ctxt['type'] should be same as data_type. - is_xml bool : If set, serialize as XML - :param list attr: Object to be serialized. + :param list data: Object to be serialized. :param str iter_type: Type of object in the iterable. - :param bool required: Whether the objects in the iterable must - not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. - :keyword bool do_quote: Whether to quote the serialized result of each iterable element. Defaults to False. :rtype: list, str + :return: serialized iterable """ if isinstance(data, str): raise SerializationError("Refuse str type as a valid iter type.") @@ -949,9 +921,8 @@ def serialize_dict(self, attr, dict_type, **kwargs): :param dict attr: Object to be serialized. :param str dict_type: Type of object in the dictionary. - :param bool required: Whether the objects in the dictionary must - not be None or empty. :rtype: dict + :return: serialized dictionary """ serialization_ctxt = kwargs.get("serialization_ctxt", {}) serialized = {} @@ -975,7 +946,7 @@ def serialize_dict(self, attr, dict_type, **kwargs): return serialized - def serialize_object(self, attr, **kwargs): + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Serialize a generic object. This will be handled as a dictionary. If object passed in is not a basic type (str, int, float, dict, list) it will simply be @@ -983,6 +954,7 @@ def serialize_object(self, attr, **kwargs): :param dict attr: Object to be serialized. :rtype: dict or str + :return: serialized object """ if attr is None: return None @@ -993,7 +965,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) if obj_type is _long_type: return self.serialize_long(attr) - if obj_type is unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1007,7 +979,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_decimal(attr) # If it's a model or I know this dependency, serialize as a Model - elif obj_type in self.dependencies.values() or isinstance(attr, Model): + if obj_type in self.dependencies.values() or isinstance(attr, Model): return self._serialize(attr) if obj_type == dict: @@ -1038,56 +1010,61 @@ def serialize_enum(attr, enum_obj=None): try: enum_obj(result) # type: ignore return result - except ValueError: + except ValueError as exc: for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) + raise SerializationError(error.format(attr, enum_obj)) from exc @staticmethod - def serialize_bytearray(attr, **kwargs): + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument """Serialize bytearray into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ return b64encode(attr).decode() @staticmethod - def serialize_base64(attr, **kwargs): + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument """Serialize str into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ encoded = b64encode(attr).decode("ascii") return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod - def serialize_decimal(attr, **kwargs): + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument """Serialize Decimal object to float. - :param attr: Object to be serialized. + :param decimal attr: Object to be serialized. :rtype: float + :return: serialized decimal """ return float(attr) @staticmethod - def serialize_long(attr, **kwargs): + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument """Serialize long (Py2) or int (Py3). - :param attr: Object to be serialized. + :param int attr: Object to be serialized. :rtype: int/long + :return: serialized long """ return _long_type(attr) @staticmethod - def serialize_date(attr, **kwargs): + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument """Serialize Date object into ISO-8601 formatted string. :param Date attr: Object to be serialized. :rtype: str + :return: serialized date """ if isinstance(attr, str): attr = isodate.parse_date(attr) @@ -1095,11 +1072,12 @@ def serialize_date(attr, **kwargs): return t @staticmethod - def serialize_time(attr, **kwargs): + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument """Serialize Time object into ISO-8601 formatted string. :param datetime.time attr: Object to be serialized. :rtype: str + :return: serialized time """ if isinstance(attr, str): attr = isodate.parse_time(attr) @@ -1109,30 +1087,32 @@ def serialize_time(attr, **kwargs): return t @staticmethod - def serialize_duration(attr, **kwargs): + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument """Serialize TimeDelta object into ISO-8601 formatted string. :param TimeDelta attr: Object to be serialized. :rtype: str + :return: serialized duration """ if isinstance(attr, str): attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) @staticmethod - def serialize_rfc(attr, **kwargs): + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. + :return: serialized rfc """ try: if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() - except AttributeError: - raise TypeError("RFC1123 object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( Serializer.days[utc.tm_wday], @@ -1145,12 +1125,13 @@ def serialize_rfc(attr, **kwargs): ) @staticmethod - def serialize_iso(attr, **kwargs): + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into ISO-8601 formatted string. :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. + :return: serialized iso """ if isinstance(attr, str): attr = isodate.parse_datetime(attr) @@ -1170,19 +1151,20 @@ def serialize_iso(attr, **kwargs): return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err except AttributeError as err: msg = "ISO-8601 object must be valid Datetime object." - raise_with_traceback(TypeError, msg, err) + raise TypeError(msg) from err @staticmethod - def serialize_unix(attr, **kwargs): + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into IntTime format. This is represented as seconds. :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid + :return: serialied unix """ if isinstance(attr, int): return attr @@ -1190,17 +1172,17 @@ def serialize_unix(attr, **kwargs): if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") return int(calendar.timegm(attr.utctimetuple())) - except AttributeError: - raise TypeError("Unix time object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc -def rest_key_extractor(attr, attr_desc, data): +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument key = attr_desc["key"] working_data = data while "." in key: # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(List[str], _FLATTEN.split(key)) + dict_keys = cast(list[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1209,14 +1191,15 @@ def rest_key_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) return working_data.get(key) -def rest_key_case_insensitive_extractor(attr, attr_desc, data): +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): key = attr_desc["key"] working_data = data @@ -1230,7 +1213,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1238,17 +1220,29 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): return attribute_key_case_insensitive_extractor(key, None, working_data) -def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key.""" +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_extractor(dict_keys[-1], None, data) -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument """Extract the attribute in "data" based on the last part of the JSON path key. This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) @@ -1285,7 +1279,7 @@ def _extract_name_from_internal_type(internal_type): return xml_name -def xml_key_extractor(attr, attr_desc, data): +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements if isinstance(data, dict): return None @@ -1337,22 +1331,21 @@ def xml_key_extractor(attr, attr_desc, data): if is_iter_type: if is_wrapped: return None # is_wrapped no node, we want None - else: - return [] # not wrapped, assume empty list + return [] # not wrapped, assume empty list return None # Assume it's not there, maybe an optional node. # If is_iter_type and not wrapped, return all found children if is_iter_type: if not is_wrapped: return children - else: # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name ) - return list(children[0]) # Might be empty list and that's ok. + ) + return list(children[0]) # Might be empty list and that's ok. # Here it's not a itertype, we should have found one element only or empty if len(children) > 1: @@ -1360,7 +1353,7 @@ def xml_key_extractor(attr, attr_desc, data): return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1369,9 +1362,9 @@ class Deserializer(object): basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - 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_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1391,7 +1384,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1407,27 +1400,29 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) - def _deserialize(self, target_obj, data): + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements """Call the deserializer on a model. Data needs to be already deserialized as JSON or XML ElementTree :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ # This is already a model, go recursive just in case if hasattr(data, "_attribute_map"): constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] try: - for attr, mapconfig in data._attribute_map.items(): + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access if attr in constants: continue value = getattr(data, attr) @@ -1444,15 +1439,15 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) - elif isinstance(response, type) and issubclass(response, Enum): + if isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: - attributes = response._attribute_map # type: ignore + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1481,10 +1476,9 @@ def _deserialize(self, target_obj, data): d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore - raise_with_traceback(DeserializationError, msg, err) - else: - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) + raise DeserializationError(msg) from err + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) def _build_additional_properties(self, attribute_map, data): if not self.additional_properties_detection: @@ -1511,18 +1505,20 @@ def _classify_target(self, target, data): :param str target: The target object type to deserialize to. :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple """ if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1537,10 +1533,12 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): :param str target_obj: The target object type to deserialize to. :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object """ try: return self(target_obj, data, content_type=content_type) - except: + except: # pylint: disable=bare-except _LOGGER.debug( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -1558,10 +1556,12 @@ def _unpack_content(raw_data, content_type=None): If raw_data is something else, bypass all logic and return it directly. - :param raw_data: Data to be processed. - :param content_type: How to parse if raw_data is a string/bytes. + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. :raises JSONDecodeError: If JSON is requested and parsing is impossible. :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. """ # Assume this is enough to detect a Pipeline Response without importing it context = getattr(raw_data, "context", {}) @@ -1578,31 +1578,42 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): """Instantiate a response model passing in deserialized args. - :param response: The response model class. - :param d_attrs: The deserialized response attributes. + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. """ if callable(response): subtype = getattr(response, "_subtype_map", {}) try: - readonly = [k for k, v in response._validation.items() if v.get("readonly")] - const = [k for k, v in response._validation.items() if v.get("constant")] + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) if additional_properties: - response_obj.additional_properties = additional_properties + response_obj.additional_properties = additional_properties # type: ignore return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) + raise DeserializationError(msg + str(err)) from err else: try: for attr, value in attrs.items(): @@ -1611,15 +1622,16 @@ def _instantiate_model(self, response, attrs, additional_properties=None): except Exception as exp: msg = "Unable to populate response model. " msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) + raise DeserializationError(msg) from exp - def deserialize_data(self, data, data_type): + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements """Process data for deserialization according to data type. :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ if data is None: return data @@ -1633,7 +1645,11 @@ def deserialize_data(self, data, data_type): if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): return data - is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: return None data_val = self.deserialize_type[data_type](data) @@ -1652,15 +1668,15 @@ def deserialize_data(self, data, data_type): except (ValueError, TypeError, AttributeError) as err: msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) - raise_with_traceback(DeserializationError, msg, err) - else: - return self._deserialize(obj_type, data) + raise DeserializationError(msg) from err + return self._deserialize(obj_type, data) def deserialize_iter(self, attr, iter_type): """Deserialize an iterable. :param list attr: Iterable to be deserialized. :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. :rtype: list """ if attr is None: @@ -1677,6 +1693,7 @@ def deserialize_dict(self, attr, dict_type): :param dict/list attr: Dictionary to be deserialized. Also accepts a list of key, value pairs. :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. :rtype: dict """ if isinstance(attr, list): @@ -1687,20 +1704,21 @@ def deserialize_dict(self, attr, dict_type): attr = {el.tag: el.text for el in attr} return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - def deserialize_object(self, attr, **kwargs): + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Deserialize a generic object. This will be handled as a dictionary. :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1726,11 +1744,10 @@ def deserialize_object(self, attr, **kwargs): pass return deserialized - else: - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) - def deserialize_basic(self, attr, data_type): + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements """Deserialize basic builtin data type from string. Will attempt to convert to str, int, float and bool. This function will also accept '1', '0', 'true' and 'false' as @@ -1738,8 +1755,9 @@ def deserialize_basic(self, attr, data_type): :param str attr: response string to be deserialized. :param str data_type: deserialization data type. + :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1749,24 +1767,23 @@ def deserialize_basic(self, attr, data_type): if data_type == "str": # None or '', node is empty string. return "" - else: - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + if isinstance(attr, str): if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ["false", "0"]: + if attr.lower() in ["false", "0"]: return False raise TypeError("Invalid boolean value: {}".format(attr)) if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec + return eval(data_type)(attr) # nosec # pylint: disable=eval-used @staticmethod def deserialize_unicode(data): @@ -1774,6 +1791,7 @@ def deserialize_unicode(data): as a string. :param str data: response string to be deserialized. + :return: Deserialized string. :rtype: str or unicode """ # We might be here because we have an enum modeled as string, @@ -1787,8 +1805,7 @@ def deserialize_unicode(data): return data except NameError: return str(data) - else: - return str(data) + return str(data) @staticmethod def deserialize_enum(data, enum_obj): @@ -1800,6 +1817,7 @@ def deserialize_enum(data, enum_obj): :param str data: Response string to be deserialized. If this value is None or invalid it will be returned as-is. :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. :rtype: Enum """ if isinstance(data, enum_obj) or data is None: @@ -1808,12 +1826,11 @@ def deserialize_enum(data, enum_obj): data = data.value if isinstance(data, int): # Workaround. We might consider remove it in the future. - # https://github.com/Azure/azure-rest-api-specs/issues/141 try: return list(enum_obj.__members__.values())[data] - except IndexError: + except IndexError as exc: error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) + raise DeserializationError(error.format(data, enum_obj)) from exc try: return enum_obj(str(data)) except ValueError: @@ -1829,8 +1846,9 @@ def deserialize_bytearray(attr): """Deserialize string into bytearray. :param str attr: response string to be deserialized. + :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1841,8 +1859,9 @@ def deserialize_base64(attr): """Deserialize base64 encoded string into string. :param str attr: response string to be deserialized. + :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1856,24 +1875,26 @@ def deserialize_decimal(attr): """Deserialize string into Decimal object. :param str attr: response string to be deserialized. - :rtype: Decimal - :raises: DeserializationError if string format invalid. + :return: Deserialized decimal + :raises DeserializationError: if string format invalid. + :rtype: decimal """ if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) # type: ignore + return decimal.Decimal(str(attr)) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err @staticmethod def deserialize_long(attr): """Deserialize string into long (Py2) or int (Py3). :param str attr: response string to be deserialized. + :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1884,8 +1905,9 @@ def deserialize_duration(attr): """Deserialize ISO-8601 formatted string into TimeDelta object. :param str attr: response string to be deserialized. + :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1893,32 +1915,33 @@ def deserialize_duration(attr): duration = isodate.parse_duration(attr) except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." - raise_with_traceback(DeserializationError, msg, err) - else: - return duration + raise DeserializationError(msg) from err + return duration @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. :param str attr: response string to be deserialized. + :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) @staticmethod def deserialize_time(attr): """Deserialize ISO-8601 formatted string into time object. :param str attr: response string to be deserialized. + :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1931,31 +1954,32 @@ def deserialize_rfc(attr): """Deserialize RFC-1123 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." - raise_with_traceback(DeserializationError, msg, err) - else: - return date_obj + raise DeserializationError(msg) from err + return date_obj @staticmethod def deserialize_iso(attr): """Deserialize ISO-8601 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1982,9 +2006,8 @@ def deserialize_iso(attr): raise OverflowError("Hit max or min date") except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." - raise_with_traceback(DeserializationError, msg, err) - else: - return date_obj + raise DeserializationError(msg) from err + return date_obj @staticmethod def deserialize_unix(attr): @@ -1992,15 +2015,16 @@ def deserialize_unix(attr): This is represented as seconds. :param int attr: Object to be serialized. + :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore try: + attr = int(attr) date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: msg = "Cannot deserialize to unix datetime object." - raise_with_traceback(DeserializationError, msg, err) - else: - return date_obj + raise DeserializationError(msg) from err + return date_obj diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_version.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_version.py index e32dc6ec4218..ed0855dea5e6 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_version.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_version.py @@ -2,8 +2,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. # -------------------------------------------------------------------------- -VERSION = "2.0.0b1" +VERSION = "1.1.0" diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/__init__.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/__init__.py index dbb1355bf320..6895cdf82b34 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/__init__.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._palo_alto_networks_ngfw_mgmt_client import PaloAltoNetworksNgfwMgmtClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._palo_alto_networks_ngfw_mgmt_client import PaloAltoNetworksNgfwMgmtClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "PaloAltoNetworksNgfwMgmtClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_configuration.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_configuration.py index b436ff93ee90..bf2614f4aaed 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_configuration.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_configuration.py @@ -6,20 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports + from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential -class PaloAltoNetworksNgfwMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class PaloAltoNetworksNgfwMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for PaloAltoNetworksNgfwMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -29,14 +28,22 @@ class PaloAltoNetworksNgfwMgmtClientConfiguration(Configuration): # pylint: dis :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-09-01". Note that overriding this + :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-10-08". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(PaloAltoNetworksNgfwMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-09-01") + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2025-10-08") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -45,9 +52,11 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.credential = credential self.subscription_id = subscription_id + self.cloud_setting = cloud_setting self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-paloaltonetworksngfw/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +65,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_palo_alto_networks_ngfw_mgmt_client.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_palo_alto_networks_ngfw_mgmt_client.py index ce71a100f71f..2fd1bb558b3e 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_palo_alto_networks_ngfw_mgmt_client.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_palo_alto_networks_ngfw_mgmt_client.py @@ -7,13 +7,18 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast +from typing_extensions import Self +from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models -from .._serialization import Deserializer, Serializer +from .._utils.serialization import Deserializer, Serializer from ._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration from .operations import ( CertificateObjectGlobalRulestackOperations, @@ -25,7 +30,9 @@ GlobalRulestackOperations, LocalRulesOperations, LocalRulestacksOperations, + MetricsObjectFirewallOperations, Operations, + PaloAltoNetworksCloudngfwOperationsOperations, PostRulesOperations, PreRulesOperations, PrefixListGlobalRulestackOperations, @@ -33,11 +40,11 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports + from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential -class PaloAltoNetworksNgfwMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class PaloAltoNetworksNgfwMgmtClient: # pylint: disable=too-many-instance-attributes """PaloAltoNetworksNgfwMgmtClient. :ivar global_rulestack: GlobalRulestackOperations operations @@ -52,18 +59,25 @@ class PaloAltoNetworksNgfwMgmtClient: # pylint: disable=client-accepts-api-vers azure.mgmt.paloaltonetworksngfw.aio.operations.FqdnListGlobalRulestackOperations :ivar post_rules: PostRulesOperations operations :vartype post_rules: azure.mgmt.paloaltonetworksngfw.aio.operations.PostRulesOperations + :ivar pre_rules: PreRulesOperations operations + :vartype pre_rules: azure.mgmt.paloaltonetworksngfw.aio.operations.PreRulesOperations :ivar prefix_list_global_rulestack: PrefixListGlobalRulestackOperations operations :vartype prefix_list_global_rulestack: azure.mgmt.paloaltonetworksngfw.aio.operations.PrefixListGlobalRulestackOperations - :ivar pre_rules: PreRulesOperations operations - :vartype pre_rules: azure.mgmt.paloaltonetworksngfw.aio.operations.PreRulesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.paloaltonetworksngfw.aio.operations.Operations + :ivar palo_alto_networks_cloudngfw_operations: PaloAltoNetworksCloudngfwOperationsOperations + operations + :vartype palo_alto_networks_cloudngfw_operations: + azure.mgmt.paloaltonetworksngfw.aio.operations.PaloAltoNetworksCloudngfwOperationsOperations :ivar firewalls: FirewallsOperations operations :vartype firewalls: azure.mgmt.paloaltonetworksngfw.aio.operations.FirewallsOperations :ivar local_rulestacks: LocalRulestacksOperations operations :vartype local_rulestacks: azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations + :ivar metrics_object_firewall: MetricsObjectFirewallOperations operations + :vartype metrics_object_firewall: + azure.mgmt.paloaltonetworksngfw.aio.operations.MetricsObjectFirewallOperations :ivar firewall_status: FirewallStatusOperations operations :vartype firewall_status: azure.mgmt.paloaltonetworksngfw.aio.operations.FirewallStatusOperations @@ -82,9 +96,12 @@ class PaloAltoNetworksNgfwMgmtClient: # pylint: disable=client-accepts-api-vers :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2023-09-01". Note that overriding this + :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-10-08". 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 @@ -95,13 +112,45 @@ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = PaloAltoNetworksNgfwMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs ) - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -117,15 +166,21 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.post_rules = PostRulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.pre_rules = PreRulesOperations(self._client, self._config, self._serialize, self._deserialize) self.prefix_list_global_rulestack = PrefixListGlobalRulestackOperations( self._client, self._config, self._serialize, self._deserialize ) - self.pre_rules = PreRulesOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.palo_alto_networks_cloudngfw_operations = PaloAltoNetworksCloudngfwOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.firewalls = FirewallsOperations(self._client, self._config, self._serialize, self._deserialize) self.local_rulestacks = LocalRulestacksOperations( self._client, self._config, self._serialize, self._deserialize ) + self.metrics_object_firewall = MetricsObjectFirewallOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.firewall_status = FirewallStatusOperations(self._client, self._config, self._serialize, self._deserialize) self.certificate_object_local_rulestack = CertificateObjectLocalRulestackOperations( self._client, self._config, self._serialize, self._deserialize @@ -138,7 +193,9 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -158,12 +215,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "PaloAltoNetworksNgfwMgmtClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_patch.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_patch.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/__init__.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/__init__.py index 72bdc9199a7f..e19c8cbbb5b2 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/__init__.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/__init__.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,24 +6,32 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._global_rulestack_operations import GlobalRulestackOperations -from ._certificate_object_global_rulestack_operations import CertificateObjectGlobalRulestackOperations -from ._fqdn_list_global_rulestack_operations import FqdnListGlobalRulestackOperations -from ._post_rules_operations import PostRulesOperations -from ._prefix_list_global_rulestack_operations import PrefixListGlobalRulestackOperations -from ._pre_rules_operations import PreRulesOperations -from ._operations import Operations -from ._firewalls_operations import FirewallsOperations -from ._local_rulestacks_operations import LocalRulestacksOperations -from ._firewall_status_operations import FirewallStatusOperations -from ._certificate_object_local_rulestack_operations import CertificateObjectLocalRulestackOperations -from ._fqdn_list_local_rulestack_operations import FqdnListLocalRulestackOperations -from ._local_rules_operations import LocalRulesOperations -from ._prefix_list_local_rulestack_operations import PrefixListLocalRulestackOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._global_rulestack_operations import GlobalRulestackOperations # type: ignore +from ._certificate_object_global_rulestack_operations import CertificateObjectGlobalRulestackOperations # type: ignore +from ._fqdn_list_global_rulestack_operations import FqdnListGlobalRulestackOperations # type: ignore +from ._post_rules_operations import PostRulesOperations # type: ignore +from ._pre_rules_operations import PreRulesOperations # type: ignore +from ._prefix_list_global_rulestack_operations import PrefixListGlobalRulestackOperations # type: ignore +from ._operations import Operations # type: ignore +from ._palo_alto_networks_cloudngfw_operations_operations import PaloAltoNetworksCloudngfwOperationsOperations # type: ignore +from ._firewalls_operations import FirewallsOperations # type: ignore +from ._local_rulestacks_operations import LocalRulestacksOperations # type: ignore +from ._metrics_object_firewall_operations import MetricsObjectFirewallOperations # type: ignore +from ._firewall_status_operations import FirewallStatusOperations # type: ignore +from ._certificate_object_local_rulestack_operations import CertificateObjectLocalRulestackOperations # type: ignore +from ._fqdn_list_local_rulestack_operations import FqdnListLocalRulestackOperations # type: ignore +from ._local_rules_operations import LocalRulesOperations # type: ignore +from ._prefix_list_local_rulestack_operations import PrefixListLocalRulestackOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -30,16 +39,18 @@ "CertificateObjectGlobalRulestackOperations", "FqdnListGlobalRulestackOperations", "PostRulesOperations", - "PrefixListGlobalRulestackOperations", "PreRulesOperations", + "PrefixListGlobalRulestackOperations", "Operations", + "PaloAltoNetworksCloudngfwOperationsOperations", "FirewallsOperations", "LocalRulestacksOperations", + "MetricsObjectFirewallOperations", "FirewallStatusOperations", "CertificateObjectLocalRulestackOperations", "FqdnListLocalRulestackOperations", "LocalRulesOperations", "PrefixListLocalRulestackOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_certificate_object_global_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_certificate_object_global_rulestack_operations.py index bc3759376562..a88f252c7cfe 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_certificate_object_global_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_certificate_object_global_rulestack_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +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, @@ -17,12 +19,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +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 @@ -30,19 +33,21 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request +from ..._utils.serialization import Deserializer, Serializer from ...operations._certificate_object_global_rulestack_operations import ( build_create_or_update_request, build_delete_request, build_get_request, build_list_request, ) +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list -class CertificateObjectGlobalRulestackOperations: +class CertificateObjectGlobalRulestackOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. @@ -56,20 +61,21 @@ class CertificateObjectGlobalRulestackOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + 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, global_rulestack_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CertificateObjectGlobalRulestackResource"]: + ) -> AsyncItemPaged["_models.CertificateObjectGlobalRulestackResource"]: """List CertificateObjectGlobalRulestackResource resources by Tenant. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either CertificateObjectGlobalRulestackResource or the result of cls(response) :rtype: @@ -82,7 +88,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateObjectGlobalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,15 +99,13 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -113,13 +117,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("CertificateObjectGlobalRulestackResourceListResult", pipeline_response) @@ -129,25 +132,26 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates"} - @distributed_trace_async async def get( self, global_rulestack_name: str, name: str, **kwargs: Any @@ -158,12 +162,11 @@ async def get( :type global_rulestack_name: str :param name: certificate name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateObjectGlobalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -177,48 +180,45 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateObjectGlobalRulestackResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CertificateObjectGlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("CertificateObjectGlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, global_rulestack_name: str, name: str, - resource: Union[_models.CertificateObjectGlobalRulestackResource, IO], + resource: Union[_models.CertificateObjectGlobalRulestackResource, IO[bytes]], **kwargs: Any - ) -> _models.CertificateObjectGlobalRulestackResource: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -231,7 +231,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateObjectGlobalRulestackResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -241,47 +241,52 @@ async def _create_or_update_initial( else: _json = self._serialize.body(resource, "CertificateObjectGlobalRulestackResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CertificateObjectGlobalRulestackResource", pipeline_response) - + response_headers = {} if response.status_code == 201: - deserialized = self._deserialize("CertificateObjectGlobalRulestackResource", pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}" - } - @overload async def begin_create_or_update( self, @@ -304,14 +309,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either CertificateObjectGlobalRulestackResource or the result of cls(response) :rtype: @@ -324,7 +321,7 @@ async def begin_create_or_update( self, global_rulestack_name: str, name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -336,18 +333,10 @@ async def begin_create_or_update( :param name: certificate name. Required. :type name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either CertificateObjectGlobalRulestackResource or the result of cls(response) :rtype: @@ -360,7 +349,7 @@ async def begin_create_or_update( self, global_rulestack_name: str, name: str, - resource: Union[_models.CertificateObjectGlobalRulestackResource, IO], + resource: Union[_models.CertificateObjectGlobalRulestackResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.CertificateObjectGlobalRulestackResource]: """Create a CertificateObjectGlobalRulestackResource. @@ -370,20 +359,9 @@ async def begin_create_or_update( :param name: certificate name. Required. :type name: str :param resource: Resource create parameters. Is either a - CertificateObjectGlobalRulestackResource type or a IO type. Required. + CertificateObjectGlobalRulestackResource type or a IO[bytes] type. Required. :type resource: - ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource or IO[bytes] :return: An instance of AsyncLROPoller that returns either CertificateObjectGlobalRulestackResource or the result of cls(response) :rtype: @@ -411,12 +389,15 @@ async def begin_create_or_update( 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("CertificateObjectGlobalRulestackResource", pipeline_response) + deserialized = self._deserialize( + "CertificateObjectGlobalRulestackResource", pipeline_response.http_response + ) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -429,22 +410,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.CertificateObjectGlobalRulestackResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}" - } + return AsyncLROPoller[_models.CertificateObjectGlobalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + async def _delete_initial(self, global_rulestack_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -456,37 +433,50 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 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) + 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, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -496,14 +486,6 @@ async def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: An :type global_rulestack_name: str :param name: certificate name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :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: @@ -517,7 +499,7 @@ async def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: An 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( # type: ignore + raw_result = await self._delete_initial( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, @@ -526,11 +508,12 @@ async def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: An 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, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -542,14 +525,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_certificate_object_local_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_certificate_object_local_rulestack_operations.py index 28ea651d9a25..bbf7621d38d6 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_certificate_object_local_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_certificate_object_local_rulestack_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +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, @@ -17,12 +19,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +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 @@ -30,19 +33,21 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request +from ..._utils.serialization import Deserializer, Serializer from ...operations._certificate_object_local_rulestack_operations import ( build_create_or_update_request, build_delete_request, build_get_request, build_list_by_local_rulestacks_request, ) +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list -class CertificateObjectLocalRulestackOperations: +class CertificateObjectLocalRulestackOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. @@ -56,15 +61,17 @@ class CertificateObjectLocalRulestackOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + 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_by_local_rulestacks( self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CertificateObjectLocalRulestackResource"]: + ) -> AsyncItemPaged["_models.CertificateObjectLocalRulestackResource"]: """List CertificateObjectLocalRulestackResource resources by LocalRulestacks. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -72,7 +79,6 @@ def list_by_local_rulestacks( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either CertificateObjectLocalRulestackResource or the result of cls(response) :rtype: @@ -85,7 +91,7 @@ def list_by_local_rulestacks( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateObjectLocalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -96,17 +102,15 @@ def list_by_local_rulestacks( def prepare_request(next_link=None): if not next_link: - request = build_list_by_local_rulestacks_request( + _request = build_list_by_local_rulestacks_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_local_rulestacks.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -118,13 +122,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("CertificateObjectLocalRulestackResourceListResult", pipeline_response) @@ -134,27 +137,26 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - list_by_local_rulestacks.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates" - } - @distributed_trace_async async def get( self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any @@ -168,12 +170,11 @@ async def get( :type local_rulestack_name: str :param name: certificate name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateObjectLocalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -187,51 +188,48 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateObjectLocalRulestackResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CertificateObjectLocalRulestackResource", pipeline_response) + deserialized = self._deserialize("CertificateObjectLocalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, local_rulestack_name: str, name: str, - resource: Union[_models.CertificateObjectLocalRulestackResource, IO], + resource: Union[_models.CertificateObjectLocalRulestackResource, IO[bytes]], **kwargs: Any - ) -> _models.CertificateObjectLocalRulestackResource: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -244,7 +242,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateObjectLocalRulestackResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -254,7 +252,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(resource, "CertificateObjectLocalRulestackResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, @@ -263,40 +261,45 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CertificateObjectLocalRulestackResource", pipeline_response) - + response_headers = {} if response.status_code == 201: - deserialized = self._deserialize("CertificateObjectLocalRulestackResource", pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}" - } - @overload async def begin_create_or_update( self, @@ -322,14 +325,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either CertificateObjectLocalRulestackResource or the result of cls(response) :rtype: @@ -343,7 +338,7 @@ async def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -358,18 +353,10 @@ async def begin_create_or_update( :param name: certificate name. Required. :type name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either CertificateObjectLocalRulestackResource or the result of cls(response) :rtype: @@ -383,7 +370,7 @@ async def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, name: str, - resource: Union[_models.CertificateObjectLocalRulestackResource, IO], + resource: Union[_models.CertificateObjectLocalRulestackResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.CertificateObjectLocalRulestackResource]: """Create a CertificateObjectLocalRulestackResource. @@ -396,20 +383,9 @@ async def begin_create_or_update( :param name: certificate name. Required. :type name: str :param resource: Resource create parameters. Is either a - CertificateObjectLocalRulestackResource type or a IO type. Required. + CertificateObjectLocalRulestackResource type or a IO[bytes] type. Required. :type resource: ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource - or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + or IO[bytes] :return: An instance of AsyncLROPoller that returns either CertificateObjectLocalRulestackResource or the result of cls(response) :rtype: @@ -438,12 +414,13 @@ async def begin_create_or_update( 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("CertificateObjectLocalRulestackResource", pipeline_response) + deserialized = self._deserialize("CertificateObjectLocalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -456,22 +433,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.CertificateObjectLocalRulestackResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}" - } + return AsyncLROPoller[_models.CertificateObjectLocalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -483,39 +458,52 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 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) + 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, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -530,14 +518,6 @@ async def begin_delete( :type local_rulestack_name: str :param name: certificate name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :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: @@ -551,7 +531,7 @@ async def begin_delete( 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( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, @@ -561,11 +541,12 @@ async def begin_delete( 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, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -577,14 +558,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_firewall_status_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_firewall_status_operations.py index b7e8edbe4134..63279964e3e0 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_firewall_status_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_firewall_status_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,19 +20,20 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +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 ..._vendor import _convert_request +from ..._utils.serialization import Deserializer, Serializer from ...operations._firewall_status_operations import build_get_request, build_list_by_firewalls_request +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class FirewallStatusOperations: @@ -48,15 +50,17 @@ class FirewallStatusOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + 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_by_firewalls( self, resource_group_name: str, firewall_name: str, **kwargs: Any - ) -> AsyncIterable["_models.FirewallStatusResource"]: + ) -> AsyncItemPaged["_models.FirewallStatusResource"]: """List FirewallStatusResource resources by Firewalls. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -64,7 +68,6 @@ def list_by_firewalls( :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FirewallStatusResource or the result of cls(response) :rtype: @@ -77,7 +80,7 @@ def list_by_firewalls( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FirewallStatusResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -88,17 +91,15 @@ def list_by_firewalls( def prepare_request(next_link=None): if not next_link: - request = build_list_by_firewalls_request( + _request = build_list_by_firewalls_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_firewalls.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -110,13 +111,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("FirewallStatusResourceListResult", pipeline_response) @@ -126,27 +126,26 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - list_by_firewalls.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/statuses" - } - @distributed_trace_async async def get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _models.FirewallStatusResource: """Get a FirewallStatusResource. @@ -156,12 +155,11 @@ async def get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FirewallStatusResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallStatusResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -175,37 +173,34 @@ async def get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FirewallStatusResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FirewallStatusResource", pipeline_response) + deserialized = self._deserialize("FirewallStatusResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/statuses/default" - } + return deserialized # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_firewalls_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_firewalls_operations.py index 8cc8d9e5ce7f..cee645846d1e 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_firewalls_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_firewalls_operations.py @@ -6,10 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +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, @@ -17,12 +19,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +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 @@ -30,7 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request +from ..._utils.serialization import Deserializer, Serializer from ...operations._firewalls_operations import ( build_create_or_update_request, build_delete_request, @@ -43,9 +46,11 @@ build_save_log_profile_request, build_update_request, ) +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class FirewallsOperations: @@ -62,16 +67,17 @@ class FirewallsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + 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_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.FirewallResource"]: + def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.FirewallResource"]: """List FirewallResource resources by subscription ID. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FirewallResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] @@ -83,7 +89,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Firewall api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FirewallResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -94,15 +100,13 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Firewall def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -114,13 +118,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("FirewallResourceListResult", pipeline_response) @@ -130,37 +133,35 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/firewalls" - } - @distributed_trace def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.FirewallResource"]: + ) -> AsyncItemPaged["_models.FirewallResource"]: """List FirewallResource resources by resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FirewallResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] @@ -172,7 +173,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FirewallResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -183,16 +184,14 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -204,13 +203,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("FirewallResourceListResult", pipeline_response) @@ -220,27 +218,26 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls" - } - @distributed_trace_async async def get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _models.FirewallResource: """Get a FirewallResource. @@ -250,12 +247,11 @@ async def get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FirewallResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -269,45 +265,46 @@ async def get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FirewallResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FirewallResource", pipeline_response) + deserialized = self._deserialize("FirewallResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" - } + return deserialized # type: ignore async def _create_or_update_initial( - self, resource_group_name: str, firewall_name: str, resource: Union[_models.FirewallResource, IO], **kwargs: Any - ) -> _models.FirewallResource: - error_map = { + self, + resource_group_name: str, + firewall_name: str, + resource: Union[_models.FirewallResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -320,7 +317,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FirewallResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -330,7 +327,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(resource, "FirewallResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, @@ -338,40 +335,45 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FirewallResource", pipeline_response) - + response_headers = {} if response.status_code == 201: - deserialized = self._deserialize("FirewallResource", pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" - } - @overload async def begin_create_or_update( self, @@ -394,14 +396,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either FirewallResource or the result of cls(response) :rtype: @@ -414,7 +408,7 @@ async def begin_create_or_update( self, resource_group_name: str, firewall_name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -427,18 +421,10 @@ async def begin_create_or_update( :param firewall_name: Firewall resource name. Required. :type firewall_name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either FirewallResource or the result of cls(response) :rtype: @@ -448,7 +434,11 @@ async def begin_create_or_update( @distributed_trace_async async def begin_create_or_update( - self, resource_group_name: str, firewall_name: str, resource: Union[_models.FirewallResource, IO], **kwargs: Any + self, + resource_group_name: str, + firewall_name: str, + resource: Union[_models.FirewallResource, IO[bytes]], + **kwargs: Any ) -> AsyncLROPoller[_models.FirewallResource]: """Create a FirewallResource. @@ -457,20 +447,9 @@ async def begin_create_or_update( :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :param resource: Resource create parameters. Is either a FirewallResource type or a IO type. - Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param resource: Resource create parameters. Is either a FirewallResource type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource or IO[bytes] :return: An instance of AsyncLROPoller that returns either FirewallResource or the result of cls(response) :rtype: @@ -498,12 +477,13 @@ async def begin_create_or_update( 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("FirewallResource", pipeline_response) + deserialized = self._deserialize("FirewallResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -516,17 +496,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.FirewallResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" - } + return AsyncLROPoller[_models.FirewallResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload async def update( @@ -550,7 +528,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FirewallResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource :raises ~azure.core.exceptions.HttpResponseError: @@ -561,7 +538,7 @@ async def update( self, resource_group_name: str, firewall_name: str, - properties: IO, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -574,11 +551,10 @@ async def update( :param firewall_name: Firewall resource name. Required. :type firewall_name: str :param properties: The resource properties to be updated. Required. - :type properties: IO + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FirewallResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource :raises ~azure.core.exceptions.HttpResponseError: @@ -589,7 +565,7 @@ async def update( self, resource_group_name: str, firewall_name: str, - properties: Union[_models.FirewallResourceUpdate, IO], + properties: Union[_models.FirewallResourceUpdate, IO[bytes]], **kwargs: Any ) -> _models.FirewallResource: """Update a FirewallResource. @@ -600,17 +576,13 @@ async def update( :param firewall_name: Firewall resource name. Required. :type firewall_name: str :param properties: The resource properties to be updated. Is either a FirewallResourceUpdate - type or a IO type. Required. - :type properties: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResourceUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResourceUpdate or IO[bytes] :return: FirewallResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -633,7 +605,7 @@ async def update( else: _json = self._serialize.body(properties, "FirewallResourceUpdate") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, @@ -641,40 +613,37 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FirewallResource", pipeline_response) + deserialized = self._deserialize("FirewallResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" - } + return deserialized # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, firewall_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -686,38 +655,51 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 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) + 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, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -728,14 +710,6 @@ async def begin_delete(self, resource_group_name: str, firewall_name: str, **kwa :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :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: @@ -749,7 +723,7 @@ async def begin_delete(self, resource_group_name: str, firewall_name: str, **kwa 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( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, firewall_name=firewall_name, api_version=api_version, @@ -758,11 +732,12 @@ async def begin_delete(self, resource_group_name: str, firewall_name: str, **kwa 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, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -774,17 +749,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get_global_rulestack( @@ -797,12 +768,11 @@ async def get_global_rulestack( :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GlobalRulestackInfo or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -816,40 +786,37 @@ async def get_global_rulestack( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GlobalRulestackInfo] = kwargs.pop("cls", None) - request = build_get_global_rulestack_request( + _request = build_get_global_rulestack_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_global_rulestack.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GlobalRulestackInfo", pipeline_response) + deserialized = self._deserialize("GlobalRulestackInfo", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_global_rulestack.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/getGlobalRulestack" - } + return deserialized # type: ignore @distributed_trace_async async def get_log_profile(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _models.LogSettings: @@ -860,12 +827,11 @@ async def get_log_profile(self, resource_group_name: str, firewall_name: str, ** :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LogSettings or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LogSettings :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -879,40 +845,37 @@ async def get_log_profile(self, resource_group_name: str, firewall_name: str, ** api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LogSettings] = kwargs.pop("cls", None) - request = build_get_log_profile_request( + _request = build_get_log_profile_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_log_profile.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LogSettings", pipeline_response) + deserialized = self._deserialize("LogSettings", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_log_profile.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/getLogProfile" - } + return deserialized # type: ignore @distributed_trace_async async def get_support_info( @@ -927,12 +890,11 @@ async def get_support_info( :type firewall_name: str :param email: email address on behalf of which this API called. Default value is None. :type email: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SupportInfo or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SupportInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -946,44 +908,41 @@ async def get_support_info( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SupportInfo] = kwargs.pop("cls", None) - request = build_get_support_info_request( + _request = build_get_support_info_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, email=email, api_version=api_version, - template_url=self.get_support_info.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SupportInfo", pipeline_response) + deserialized = self._deserialize("SupportInfo", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_support_info.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/getSupportInfo" - } + return deserialized # type: ignore @overload - async def save_log_profile( # pylint: disable=inconsistent-return-statements + async def save_log_profile( self, resource_group_name: str, firewall_name: str, @@ -1004,18 +963,17 @@ async def save_log_profile( # pylint: disable=inconsistent-return-statements :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def save_log_profile( # pylint: disable=inconsistent-return-statements + async def save_log_profile( self, resource_group_name: str, firewall_name: str, - log_settings: Optional[IO] = None, + log_settings: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -1028,22 +986,21 @@ async def save_log_profile( # pylint: disable=inconsistent-return-statements :param firewall_name: Firewall resource name. Required. :type firewall_name: str :param log_settings: Default value is None. - :type log_settings: IO + :type log_settings: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def save_log_profile( # pylint: disable=inconsistent-return-statements + async def save_log_profile( self, resource_group_name: str, firewall_name: str, - log_settings: Optional[Union[_models.LogSettings, IO]] = None, + log_settings: Optional[Union[_models.LogSettings, IO[bytes]]] = None, **kwargs: Any ) -> None: """Log Profile for Firewall. @@ -1053,17 +1010,13 @@ async def save_log_profile( # pylint: disable=inconsistent-return-statements :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :param log_settings: Is either a LogSettings type or a IO type. Default value is None. - :type log_settings: ~azure.mgmt.paloaltonetworksngfw.models.LogSettings or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param log_settings: Is either a LogSettings type or a IO[bytes] type. Default value is None. + :type log_settings: ~azure.mgmt.paloaltonetworksngfw.models.LogSettings or IO[bytes] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1076,9 +1029,10 @@ async def save_log_profile( # pylint: disable=inconsistent-return-statements 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 log_settings else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if log_settings else None _json = None _content = None if isinstance(log_settings, (IOBase, bytes)): @@ -1089,7 +1043,7 @@ async def save_log_profile( # pylint: disable=inconsistent-return-statements else: _json = None - request = build_save_log_profile_request( + _request = build_save_log_profile_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, @@ -1097,28 +1051,25 @@ async def save_log_profile( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self.save_log_profile.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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, {}) - - save_log_profile.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/saveLogProfile" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_fqdn_list_global_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_fqdn_list_global_rulestack_operations.py index ccfa6967cf22..a1985e24787f 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_fqdn_list_global_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_fqdn_list_global_rulestack_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +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, @@ -17,12 +19,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +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 @@ -30,16 +33,18 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request +from ..._utils.serialization import Deserializer, Serializer from ...operations._fqdn_list_global_rulestack_operations import ( build_create_or_update_request, build_delete_request, build_get_request, build_list_request, ) +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class FqdnListGlobalRulestackOperations: @@ -56,20 +61,21 @@ class FqdnListGlobalRulestackOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + 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, global_rulestack_name: str, **kwargs: Any - ) -> AsyncIterable["_models.FqdnListGlobalRulestackResource"]: + ) -> AsyncItemPaged["_models.FqdnListGlobalRulestackResource"]: """List FqdnListGlobalRulestackResource resources by Tenant. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FqdnListGlobalRulestackResource or the result of cls(response) :rtype: @@ -82,7 +88,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FqdnListGlobalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,15 +99,13 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -113,13 +117,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("FqdnListGlobalRulestackResourceListResult", pipeline_response) @@ -129,25 +132,26 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists"} - @distributed_trace_async async def get( self, global_rulestack_name: str, name: str, **kwargs: Any @@ -158,12 +162,11 @@ async def get( :type global_rulestack_name: str :param name: fqdn list name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FqdnListGlobalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -177,48 +180,45 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FqdnListGlobalRulestackResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FqdnListGlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("FqdnListGlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, global_rulestack_name: str, name: str, - resource: Union[_models.FqdnListGlobalRulestackResource, IO], + resource: Union[_models.FqdnListGlobalRulestackResource, IO[bytes]], **kwargs: Any - ) -> _models.FqdnListGlobalRulestackResource: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -231,7 +231,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FqdnListGlobalRulestackResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -241,47 +241,52 @@ async def _create_or_update_initial( else: _json = self._serialize.body(resource, "FqdnListGlobalRulestackResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FqdnListGlobalRulestackResource", pipeline_response) - + response_headers = {} if response.status_code == 201: - deserialized = self._deserialize("FqdnListGlobalRulestackResource", pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" - } - @overload async def begin_create_or_update( self, @@ -303,14 +308,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either FqdnListGlobalRulestackResource or the result of cls(response) :rtype: @@ -323,7 +320,7 @@ async def begin_create_or_update( self, global_rulestack_name: str, name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -335,18 +332,10 @@ async def begin_create_or_update( :param name: fqdn list name. Required. :type name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either FqdnListGlobalRulestackResource or the result of cls(response) :rtype: @@ -359,7 +348,7 @@ async def begin_create_or_update( self, global_rulestack_name: str, name: str, - resource: Union[_models.FqdnListGlobalRulestackResource, IO], + resource: Union[_models.FqdnListGlobalRulestackResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.FqdnListGlobalRulestackResource]: """Create a FqdnListGlobalRulestackResource. @@ -369,19 +358,9 @@ async def begin_create_or_update( :param name: fqdn list name. Required. :type name: str :param resource: Resource create parameters. Is either a FqdnListGlobalRulestackResource type - or a IO type. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + or a IO[bytes] type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource or + IO[bytes] :return: An instance of AsyncLROPoller that returns either FqdnListGlobalRulestackResource or the result of cls(response) :rtype: @@ -409,12 +388,13 @@ async def begin_create_or_update( 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("FqdnListGlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("FqdnListGlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -427,22 +407,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.FqdnListGlobalRulestackResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" - } + return AsyncLROPoller[_models.FqdnListGlobalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + async def _delete_initial(self, global_rulestack_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -454,37 +430,50 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 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) + 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, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -494,14 +483,6 @@ async def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: An :type global_rulestack_name: str :param name: fqdn list name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :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: @@ -515,7 +496,7 @@ async def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: An 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( # type: ignore + raw_result = await self._delete_initial( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, @@ -524,11 +505,12 @@ async def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: An 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, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -540,14 +522,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_fqdn_list_local_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_fqdn_list_local_rulestack_operations.py index 6dd896a27094..ae4b1b5aa430 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_fqdn_list_local_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_fqdn_list_local_rulestack_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +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, @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +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 @@ -30,16 +32,18 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request +from ..._utils.serialization import Deserializer, Serializer from ...operations._fqdn_list_local_rulestack_operations import ( build_create_or_update_request, build_delete_request, build_get_request, build_list_by_local_rulestacks_request, ) +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class FqdnListLocalRulestackOperations: @@ -56,15 +60,17 @@ class FqdnListLocalRulestackOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + 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_by_local_rulestacks( self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> AsyncIterable["_models.FqdnListLocalRulestackResource"]: + ) -> AsyncItemPaged["_models.FqdnListLocalRulestackResource"]: """List FqdnListLocalRulestackResource resources by LocalRulestacks. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -72,7 +78,6 @@ def list_by_local_rulestacks( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FqdnListLocalRulestackResource or the result of cls(response) :rtype: @@ -85,7 +90,7 @@ def list_by_local_rulestacks( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FqdnListLocalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -96,17 +101,15 @@ def list_by_local_rulestacks( def prepare_request(next_link=None): if not next_link: - request = build_list_by_local_rulestacks_request( + _request = build_list_by_local_rulestacks_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_local_rulestacks.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -118,13 +121,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("FqdnListLocalRulestackResourceListResult", pipeline_response) @@ -134,27 +136,26 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - list_by_local_rulestacks.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists" - } - @distributed_trace_async async def get( self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any @@ -168,12 +169,11 @@ async def get( :type local_rulestack_name: str :param name: fqdn list name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FqdnListLocalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -187,51 +187,48 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FqdnListLocalRulestackResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FqdnListLocalRulestackResource", pipeline_response) + deserialized = self._deserialize("FqdnListLocalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, local_rulestack_name: str, name: str, - resource: Union[_models.FqdnListLocalRulestackResource, IO], + resource: Union[_models.FqdnListLocalRulestackResource, IO[bytes]], **kwargs: Any - ) -> _models.FqdnListLocalRulestackResource: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -244,7 +241,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FqdnListLocalRulestackResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -254,7 +251,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(resource, "FqdnListLocalRulestackResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, @@ -263,40 +260,45 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FqdnListLocalRulestackResource", pipeline_response) - + response_headers = {} if response.status_code == 201: - deserialized = self._deserialize("FqdnListLocalRulestackResource", pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}" - } - @overload async def begin_create_or_update( self, @@ -322,14 +324,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either FqdnListLocalRulestackResource or the result of cls(response) :rtype: @@ -343,7 +337,7 @@ async def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -358,18 +352,10 @@ async def begin_create_or_update( :param name: fqdn list name. Required. :type name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either FqdnListLocalRulestackResource or the result of cls(response) :rtype: @@ -383,7 +369,7 @@ async def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, name: str, - resource: Union[_models.FqdnListLocalRulestackResource, IO], + resource: Union[_models.FqdnListLocalRulestackResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.FqdnListLocalRulestackResource]: """Create a FqdnListLocalRulestackResource. @@ -396,19 +382,9 @@ async def begin_create_or_update( :param name: fqdn list name. Required. :type name: str :param resource: Resource create parameters. Is either a FqdnListLocalRulestackResource type or - a IO type. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + a IO[bytes] type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource or + IO[bytes] :return: An instance of AsyncLROPoller that returns either FqdnListLocalRulestackResource or the result of cls(response) :rtype: @@ -437,12 +413,13 @@ async def begin_create_or_update( 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("FqdnListLocalRulestackResource", pipeline_response) + deserialized = self._deserialize("FqdnListLocalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -455,22 +432,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.FqdnListLocalRulestackResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}" - } + return AsyncLROPoller[_models.FqdnListLocalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -482,39 +457,52 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 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) + 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, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -529,14 +517,6 @@ async def begin_delete( :type local_rulestack_name: str :param name: fqdn list name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :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: @@ -550,7 +530,7 @@ async def begin_delete( 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( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, @@ -560,11 +540,12 @@ async def begin_delete( 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, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -576,14 +557,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_global_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_global_rulestack_operations.py index 33ae27c7c540..3f069776f886 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_global_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_global_rulestack_operations.py @@ -6,10 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +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, @@ -17,12 +19,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +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 @@ -30,7 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request +from ..._utils.serialization import Deserializer, Serializer from ...operations._global_rulestack_operations import ( build_commit_request, build_create_or_update_request, @@ -47,9 +50,11 @@ build_revert_request, build_update_request, ) +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class GlobalRulestackOperations: @@ -66,16 +71,17 @@ class GlobalRulestackOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.GlobalRulestackResource"]: + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.GlobalRulestackResource"]: """List GlobalRulestackResource resources by Tenant. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GlobalRulestackResource or the result of cls(response) :rtype: @@ -88,7 +94,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.GlobalRulestackResource" api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GlobalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -99,14 +105,12 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.GlobalRulestackResource" def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -118,13 +122,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("GlobalRulestackResourceListResult", pipeline_response) @@ -134,37 +137,37 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks"} - @distributed_trace_async async def get(self, global_rulestack_name: str, **kwargs: Any) -> _models.GlobalRulestackResource: """Get a GlobalRulestackResource. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GlobalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -178,41 +181,40 @@ async def get(self, global_rulestack_name: str, **kwargs: Any) -> _models.Global api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GlobalRulestackResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("GlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}"} + return deserialized # type: ignore async def _create_or_update_initial( - self, global_rulestack_name: str, resource: Union[_models.GlobalRulestackResource, IO], **kwargs: Any - ) -> _models.GlobalRulestackResource: - error_map = { + self, global_rulestack_name: str, resource: Union[_models.GlobalRulestackResource, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -225,7 +227,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GlobalRulestackResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -235,46 +237,51 @@ async def _create_or_update_initial( else: _json = self._serialize.body(resource, "GlobalRulestackResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( global_rulestack_name=global_rulestack_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("GlobalRulestackResource", pipeline_response) - + response_headers = {} if response.status_code == 201: - deserialized = self._deserialize("GlobalRulestackResource", pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}" - } - @overload async def begin_create_or_update( self, @@ -293,14 +300,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either GlobalRulestackResource or the result of cls(response) :rtype: @@ -310,25 +309,17 @@ async def begin_create_or_update( @overload async def begin_create_or_update( - self, global_rulestack_name: str, resource: IO, *, content_type: str = "application/json", **kwargs: Any + self, global_rulestack_name: str, resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GlobalRulestackResource]: """Create a GlobalRulestackResource. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either GlobalRulestackResource or the result of cls(response) :rtype: @@ -338,26 +329,15 @@ async def begin_create_or_update( @distributed_trace_async async def begin_create_or_update( - self, global_rulestack_name: str, resource: Union[_models.GlobalRulestackResource, IO], **kwargs: Any + self, global_rulestack_name: str, resource: Union[_models.GlobalRulestackResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GlobalRulestackResource]: """Create a GlobalRulestackResource. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :param resource: Resource create parameters. Is either a GlobalRulestackResource type or a IO - type. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param resource: Resource create parameters. Is either a GlobalRulestackResource type or a + IO[bytes] type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource or IO[bytes] :return: An instance of AsyncLROPoller that returns either GlobalRulestackResource or the result of cls(response) :rtype: @@ -384,12 +364,13 @@ async def begin_create_or_update( 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("GlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("GlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -402,17 +383,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.GlobalRulestackResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}" - } + return AsyncLROPoller[_models.GlobalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload async def update( @@ -432,7 +411,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GlobalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: @@ -440,18 +418,22 @@ async def update( @overload async def update( - self, global_rulestack_name: str, properties: IO, *, content_type: str = "application/json", **kwargs: Any + self, + global_rulestack_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any ) -> _models.GlobalRulestackResource: """Update a GlobalRulestackResource. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str :param properties: The resource properties to be updated. Required. - :type properties: IO + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GlobalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: @@ -459,24 +441,24 @@ async def update( @distributed_trace_async async def update( - self, global_rulestack_name: str, properties: Union[_models.GlobalRulestackResourceUpdate, IO], **kwargs: Any + self, + global_rulestack_name: str, + properties: Union[_models.GlobalRulestackResourceUpdate, IO[bytes]], + **kwargs: Any ) -> _models.GlobalRulestackResource: """Update a GlobalRulestackResource. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str :param properties: The resource properties to be updated. Is either a - GlobalRulestackResourceUpdate type or a IO type. Required. - :type properties: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResourceUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + GlobalRulestackResourceUpdate type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResourceUpdate or + IO[bytes] :return: GlobalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -499,44 +481,41 @@ async def update( else: _json = self._serialize.body(properties, "GlobalRulestackResourceUpdate") - request = build_update_request( + _request = build_update_request( global_rulestack_name=global_rulestack_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("GlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}"} + return deserialized # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, **kwargs: Any - ) -> None: - error_map = { + async def _delete_initial(self, global_rulestack_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -548,34 +527,49 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 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) + 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, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}"} + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, global_rulestack_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -583,14 +577,6 @@ async def begin_delete(self, global_rulestack_name: str, **kwargs: Any) -> Async :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :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: @@ -604,7 +590,7 @@ async def begin_delete(self, global_rulestack_name: str, **kwargs: Any) -> Async 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( # type: ignore + raw_result = await self._delete_initial( global_rulestack_name=global_rulestack_name, api_version=api_version, cls=lambda x, y, z: x, @@ -612,11 +598,12 @@ async def begin_delete(self, global_rulestack_name: str, **kwargs: Any) -> Async 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, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -628,20 +615,16 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}"} - - async def _commit_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, **kwargs: Any - ) -> None: - error_map = { + async def _commit_initial(self, global_rulestack_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -653,36 +636,46 @@ async def _commit_initial( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_commit_request( + _request = build_commit_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self._commit_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + 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, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _commit_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/commit" - } + return deserialized # type: ignore @distributed_trace_async async def begin_commit(self, global_rulestack_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -690,14 +683,6 @@ async def begin_commit(self, global_rulestack_name: str, **kwargs: Any) -> Async :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :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: @@ -711,7 +696,7 @@ async def begin_commit(self, global_rulestack_name: str, **kwargs: Any) -> Async 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._commit_initial( # type: ignore + raw_result = await self._commit_initial( global_rulestack_name=global_rulestack_name, api_version=api_version, cls=lambda x, y, z: x, @@ -719,11 +704,12 @@ async def begin_commit(self, global_rulestack_name: str, **kwargs: Any) -> Async 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, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -734,17 +720,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_commit.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/commit" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get_change_log(self, global_rulestack_name: str, **kwargs: Any) -> _models.Changelog: @@ -752,12 +734,11 @@ async def get_change_log(self, global_rulestack_name: str, **kwargs: Any) -> _mo :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Changelog or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.Changelog :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -771,38 +752,35 @@ async def get_change_log(self, global_rulestack_name: str, **kwargs: Any) -> _mo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Changelog] = kwargs.pop("cls", None) - request = build_get_change_log_request( + _request = build_get_change_log_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.get_change_log.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Changelog", pipeline_response) + deserialized = self._deserialize("Changelog", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_change_log.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/getChangeLog" - } + return deserialized # type: ignore @distributed_trace_async async def list_advanced_security_objects( @@ -823,12 +801,11 @@ async def list_advanced_security_objects( :type skip: str :param top: Default value is None. :type top: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: AdvSecurityObjectListResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectListResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -842,41 +819,38 @@ async def list_advanced_security_objects( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AdvSecurityObjectListResponse] = kwargs.pop("cls", None) - request = build_list_advanced_security_objects_request( + _request = build_list_advanced_security_objects_request( global_rulestack_name=global_rulestack_name, type=type, skip=skip, top=top, api_version=api_version, - template_url=self.list_advanced_security_objects.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AdvSecurityObjectListResponse", pipeline_response) + deserialized = self._deserialize("AdvSecurityObjectListResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_advanced_security_objects.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listAdvancedSecurityObjects" - } + return deserialized # type: ignore @distributed_trace_async async def list_app_ids( @@ -900,12 +874,11 @@ async def list_app_ids( :type skip: str :param top: Default value is None. :type top: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: ListAppIdResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.ListAppIdResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -919,42 +892,39 @@ async def list_app_ids( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListAppIdResponse] = kwargs.pop("cls", None) - request = build_list_app_ids_request( + _request = build_list_app_ids_request( global_rulestack_name=global_rulestack_name, app_id_version=app_id_version, app_prefix=app_prefix, skip=skip, top=top, api_version=api_version, - template_url=self.list_app_ids.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAppIdResponse", pipeline_response) + deserialized = self._deserialize("ListAppIdResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_app_ids.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listAppIds" - } + return deserialized # type: ignore @distributed_trace_async async def list_countries( @@ -968,12 +938,11 @@ async def list_countries( :type skip: str :param top: Default value is None. :type top: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: CountriesResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.CountriesResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -987,40 +956,37 @@ async def list_countries( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CountriesResponse] = kwargs.pop("cls", None) - request = build_list_countries_request( + _request = build_list_countries_request( global_rulestack_name=global_rulestack_name, skip=skip, top=top, api_version=api_version, - template_url=self.list_countries.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CountriesResponse", pipeline_response) + deserialized = self._deserialize("CountriesResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_countries.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listCountries" - } + return deserialized # type: ignore @distributed_trace_async async def list_firewalls(self, global_rulestack_name: str, **kwargs: Any) -> _models.ListFirewallsResponse: @@ -1028,12 +994,11 @@ async def list_firewalls(self, global_rulestack_name: str, **kwargs: Any) -> _mo :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ListFirewallsResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.ListFirewallsResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1047,38 +1012,35 @@ async def list_firewalls(self, global_rulestack_name: str, **kwargs: Any) -> _mo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListFirewallsResponse] = kwargs.pop("cls", None) - request = build_list_firewalls_request( + _request = build_list_firewalls_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.list_firewalls.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListFirewallsResponse", pipeline_response) + deserialized = self._deserialize("ListFirewallsResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_firewalls.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listFirewalls" - } + return deserialized # type: ignore @distributed_trace_async async def list_predefined_url_categories( @@ -1092,12 +1054,11 @@ async def list_predefined_url_categories( :type skip: str :param top: Default value is None. :type top: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: PredefinedUrlCategoriesResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.PredefinedUrlCategoriesResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1111,40 +1072,37 @@ async def list_predefined_url_categories( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PredefinedUrlCategoriesResponse] = kwargs.pop("cls", None) - request = build_list_predefined_url_categories_request( + _request = build_list_predefined_url_categories_request( global_rulestack_name=global_rulestack_name, skip=skip, top=top, api_version=api_version, - template_url=self.list_predefined_url_categories.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PredefinedUrlCategoriesResponse", pipeline_response) + deserialized = self._deserialize("PredefinedUrlCategoriesResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_predefined_url_categories.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listPredefinedUrlCategories" - } + return deserialized # type: ignore @distributed_trace_async async def list_security_services( @@ -1166,12 +1124,11 @@ async def list_security_services( :type skip: str :param top: Default value is None. :type top: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: SecurityServicesResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SecurityServicesResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1185,56 +1142,50 @@ async def list_security_services( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SecurityServicesResponse] = kwargs.pop("cls", None) - request = build_list_security_services_request( + _request = build_list_security_services_request( global_rulestack_name=global_rulestack_name, type=type, skip=skip, top=top, api_version=api_version, - template_url=self.list_security_services.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityServicesResponse", pipeline_response) + deserialized = self._deserialize("SecurityServicesResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_security_services.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listSecurityServices" - } + return deserialized # type: ignore @distributed_trace_async - async def revert( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, **kwargs: Any - ) -> None: + async def revert(self, global_rulestack_name: str, **kwargs: Any) -> None: """Revert rulestack configuration. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1248,29 +1199,28 @@ async def revert( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_revert_request( + _request = build_revert_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.revert.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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, {}) - - revert.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/revert"} + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_local_rules_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_local_rules_operations.py index bc2465ae9396..084d5a94690d 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_local_rules_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_local_rules_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +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, @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +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 @@ -30,7 +32,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request +from ..._utils.serialization import Deserializer, Serializer from ...operations._local_rules_operations import ( build_create_or_update_request, build_delete_request, @@ -40,9 +42,11 @@ build_refresh_counters_request, build_reset_counters_request, ) +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class LocalRulesOperations: @@ -59,15 +63,17 @@ class LocalRulesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + 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_by_local_rulestacks( self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> AsyncIterable["_models.LocalRulesResource"]: + ) -> AsyncItemPaged["_models.LocalRulesResource"]: """List LocalRulesResource resources by LocalRulestacks. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -75,7 +81,6 @@ def list_by_local_rulestacks( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LocalRulesResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource] @@ -87,7 +92,7 @@ def list_by_local_rulestacks( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LocalRulesResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,17 +103,15 @@ def list_by_local_rulestacks( def prepare_request(next_link=None): if not next_link: - request = build_list_by_local_rulestacks_request( + _request = build_list_by_local_rulestacks_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_local_rulestacks.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -120,13 +123,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("LocalRulesResourceListResult", pipeline_response) @@ -136,27 +138,26 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - list_by_local_rulestacks.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules" - } - @distributed_trace_async async def get( self, resource_group_name: str, local_rulestack_name: str, priority: str, **kwargs: Any @@ -170,12 +171,11 @@ async def get( :type local_rulestack_name: str :param priority: Local Rule priority. Required. :type priority: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LocalRulesResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -189,51 +189,48 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LocalRulesResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, priority=priority, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalRulesResource", pipeline_response) + deserialized = self._deserialize("LocalRulesResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, local_rulestack_name: str, priority: str, - resource: Union[_models.LocalRulesResource, IO], + resource: Union[_models.LocalRulesResource, IO[bytes]], **kwargs: Any - ) -> _models.LocalRulesResource: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -246,7 +243,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LocalRulesResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -256,7 +253,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(resource, "LocalRulesResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, priority=priority, @@ -265,40 +262,45 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("LocalRulesResource", pipeline_response) - + response_headers = {} if response.status_code == 201: - deserialized = self._deserialize("LocalRulesResource", pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}" - } - @overload async def begin_create_or_update( self, @@ -324,14 +326,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either LocalRulesResource or the result of cls(response) :rtype: @@ -345,7 +339,7 @@ async def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, priority: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -360,18 +354,10 @@ async def begin_create_or_update( :param priority: Local Rule priority. Required. :type priority: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either LocalRulesResource or the result of cls(response) :rtype: @@ -385,7 +371,7 @@ async def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, priority: str, - resource: Union[_models.LocalRulesResource, IO], + resource: Union[_models.LocalRulesResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.LocalRulesResource]: """Create a LocalRulesResource. @@ -397,20 +383,9 @@ async def begin_create_or_update( :type local_rulestack_name: str :param priority: Local Rule priority. Required. :type priority: str - :param resource: Resource create parameters. Is either a LocalRulesResource type or a IO type. - Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param resource: Resource create parameters. Is either a LocalRulesResource type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource or IO[bytes] :return: An instance of AsyncLROPoller that returns either LocalRulesResource or the result of cls(response) :rtype: @@ -439,12 +414,13 @@ async def begin_create_or_update( 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("LocalRulesResource", pipeline_response) + deserialized = self._deserialize("LocalRulesResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -457,22 +433,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.LocalRulesResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}" - } + return AsyncLROPoller[_models.LocalRulesResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, local_rulestack_name: str, priority: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -484,39 +458,52 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, priority=priority, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 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) + 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, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -531,14 +518,6 @@ async def begin_delete( :type local_rulestack_name: str :param priority: Local Rule priority. Required. :type priority: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :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: @@ -552,7 +531,7 @@ async def begin_delete( 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( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, priority=priority, @@ -562,11 +541,12 @@ async def begin_delete( 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, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -578,17 +558,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get_counters( @@ -610,12 +586,11 @@ async def get_counters( :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCounter or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounter :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -629,45 +604,42 @@ async def get_counters( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RuleCounter] = kwargs.pop("cls", None) - request = build_get_counters_request( + _request = build_get_counters_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, priority=priority, subscription_id=self._config.subscription_id, firewall_name=firewall_name, api_version=api_version, - template_url=self.get_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleCounter", pipeline_response) + deserialized = self._deserialize("RuleCounter", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_counters.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}/getCounters" - } + return deserialized # type: ignore @distributed_trace_async - async def refresh_counters( # pylint: disable=inconsistent-return-statements + async def refresh_counters( self, resource_group_name: str, local_rulestack_name: str, @@ -686,12 +658,11 @@ async def refresh_counters( # pylint: disable=inconsistent-return-statements :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -705,38 +676,35 @@ async def refresh_counters( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_refresh_counters_request( + _request = build_refresh_counters_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, priority=priority, subscription_id=self._config.subscription_id, firewall_name=firewall_name, api_version=api_version, - template_url=self.refresh_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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, {}) - - refresh_counters.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}/refreshCounters" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def reset_counters( @@ -758,12 +726,11 @@ async def reset_counters( :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCounterReset or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounterReset :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -777,39 +744,36 @@ async def reset_counters( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RuleCounterReset] = kwargs.pop("cls", None) - request = build_reset_counters_request( + _request = build_reset_counters_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, priority=priority, subscription_id=self._config.subscription_id, firewall_name=firewall_name, api_version=api_version, - template_url=self.reset_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleCounterReset", pipeline_response) + deserialized = self._deserialize("RuleCounterReset", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - reset_counters.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}/resetCounters" - } + return deserialized # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_local_rulestacks_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_local_rulestacks_operations.py index 92fc81f8b5a5..4e079f746c6f 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_local_rulestacks_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_local_rulestacks_operations.py @@ -6,10 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +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, @@ -17,12 +19,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +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 @@ -30,7 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request +from ..._utils.serialization import Deserializer, Serializer from ...operations._local_rulestacks_operations import ( build_commit_request, build_create_or_update_request, @@ -39,16 +42,21 @@ build_get_request, build_get_support_info_request, build_list_advanced_security_objects_request, + build_list_app_ids_request, build_list_by_resource_group_request, build_list_by_subscription_request, + build_list_countries_request, build_list_firewalls_request, + build_list_predefined_url_categories_request, build_list_security_services_request, build_revert_request, build_update_request, ) +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class LocalRulestacksOperations: @@ -65,16 +73,17 @@ class LocalRulestacksOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + 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_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.LocalRulestackResource"]: + def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.LocalRulestackResource"]: """List LocalRulestackResource resources by subscription ID. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LocalRulestackResource or the result of cls(response) :rtype: @@ -87,7 +96,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.LocalRul api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LocalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,15 +107,13 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.LocalRul def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -118,13 +125,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("LocalRulestackResourceListResult", pipeline_response) @@ -134,37 +140,35 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks" - } - @distributed_trace def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.LocalRulestackResource"]: + ) -> AsyncItemPaged["_models.LocalRulestackResource"]: """List LocalRulestackResource resources by resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LocalRulestackResource or the result of cls(response) :rtype: @@ -177,7 +181,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LocalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -188,16 +192,14 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -209,13 +211,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("LocalRulestackResourceListResult", pipeline_response) @@ -225,27 +226,26 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks" - } - @distributed_trace_async async def get( self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any @@ -257,12 +257,11 @@ async def get( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LocalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -276,49 +275,46 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LocalRulestackResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalRulestackResource", pipeline_response) + deserialized = self._deserialize("LocalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, local_rulestack_name: str, - resource: Union[_models.LocalRulestackResource, IO], + resource: Union[_models.LocalRulestackResource, IO[bytes]], **kwargs: Any - ) -> _models.LocalRulestackResource: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -331,7 +327,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LocalRulestackResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -341,7 +337,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(resource, "LocalRulestackResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, @@ -349,40 +345,45 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("LocalRulestackResource", pipeline_response) - + response_headers = {} if response.status_code == 201: - deserialized = self._deserialize("LocalRulestackResource", pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" - } - @overload async def begin_create_or_update( self, @@ -405,14 +406,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either LocalRulestackResource or the result of cls(response) :rtype: @@ -425,7 +418,7 @@ async def begin_create_or_update( self, resource_group_name: str, local_rulestack_name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -438,18 +431,10 @@ async def begin_create_or_update( :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either LocalRulestackResource or the result of cls(response) :rtype: @@ -462,7 +447,7 @@ async def begin_create_or_update( self, resource_group_name: str, local_rulestack_name: str, - resource: Union[_models.LocalRulestackResource, IO], + resource: Union[_models.LocalRulestackResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.LocalRulestackResource]: """Create a LocalRulestackResource. @@ -472,20 +457,9 @@ async def begin_create_or_update( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :param resource: Resource create parameters. Is either a LocalRulestackResource type or a IO - type. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param resource: Resource create parameters. Is either a LocalRulestackResource type or a + IO[bytes] type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource or IO[bytes] :return: An instance of AsyncLROPoller that returns either LocalRulestackResource or the result of cls(response) :rtype: @@ -513,12 +487,13 @@ async def begin_create_or_update( 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("LocalRulestackResource", pipeline_response) + deserialized = self._deserialize("LocalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -531,17 +506,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.LocalRulestackResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" - } + return AsyncLROPoller[_models.LocalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload async def update( @@ -565,7 +538,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LocalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: @@ -576,7 +548,7 @@ async def update( self, resource_group_name: str, local_rulestack_name: str, - properties: IO, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -589,11 +561,10 @@ async def update( :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str :param properties: The resource properties to be updated. Required. - :type properties: IO + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LocalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: @@ -604,7 +575,7 @@ async def update( self, resource_group_name: str, local_rulestack_name: str, - properties: Union[_models.LocalRulestackResourceUpdate, IO], + properties: Union[_models.LocalRulestackResourceUpdate, IO[bytes]], **kwargs: Any ) -> _models.LocalRulestackResource: """Update a LocalRulestackResource. @@ -615,17 +586,14 @@ async def update( :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str :param properties: The resource properties to be updated. Is either a - LocalRulestackResourceUpdate type or a IO type. Required. - :type properties: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResourceUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + LocalRulestackResourceUpdate type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResourceUpdate or + IO[bytes] :return: LocalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -648,7 +616,7 @@ async def update( else: _json = self._serialize.body(properties, "LocalRulestackResourceUpdate") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, @@ -656,40 +624,37 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalRulestackResource", pipeline_response) + deserialized = self._deserialize("LocalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" - } + return deserialized # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -701,38 +666,51 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 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) + 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, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -745,14 +723,6 @@ async def begin_delete( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :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: @@ -766,7 +736,7 @@ async def begin_delete( 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( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, api_version=api_version, @@ -775,11 +745,12 @@ async def begin_delete( 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, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -791,22 +762,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" - } - - async def _commit_initial( # pylint: disable=inconsistent-return-statements + async def _commit_initial( self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -818,38 +785,48 @@ async def _commit_initial( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_commit_request( + _request = build_commit_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._commit_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + 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, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _commit_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/commit" - } + return deserialized # type: ignore @distributed_trace_async async def begin_commit( @@ -862,14 +839,6 @@ async def begin_commit( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :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: @@ -883,7 +852,7 @@ async def begin_commit( 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._commit_initial( # type: ignore + raw_result = await self._commit_initial( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, api_version=api_version, @@ -892,11 +861,12 @@ async def begin_commit( 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, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -907,17 +877,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_commit.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/commit" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get_change_log( @@ -930,12 +896,11 @@ async def get_change_log( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Changelog or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.Changelog :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -949,40 +914,37 @@ async def get_change_log( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Changelog] = kwargs.pop("cls", None) - request = build_get_change_log_request( + _request = build_get_change_log_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_change_log.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Changelog", pipeline_response) + deserialized = self._deserialize("Changelog", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_change_log.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/getChangeLog" - } + return deserialized # type: ignore @distributed_trace_async async def get_support_info( @@ -997,12 +959,11 @@ async def get_support_info( :type local_rulestack_name: str :param email: email address on behalf of which this API called. Default value is None. :type email: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SupportInfo or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SupportInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1016,41 +977,38 @@ async def get_support_info( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SupportInfo] = kwargs.pop("cls", None) - request = build_get_support_info_request( + _request = build_get_support_info_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, email=email, api_version=api_version, - template_url=self.get_support_info.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SupportInfo", pipeline_response) + deserialized = self._deserialize("SupportInfo", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_support_info.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/getSupportInfo" - } + return deserialized # type: ignore @distributed_trace_async async def list_advanced_security_objects( @@ -1075,12 +1033,11 @@ async def list_advanced_security_objects( :type skip: str :param top: Default value is None. :type top: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: AdvSecurityObjectListResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectListResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1094,7 +1051,7 @@ async def list_advanced_security_objects( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AdvSecurityObjectListResponse] = kwargs.pop("cls", None) - request = build_list_advanced_security_objects_request( + _request = build_list_advanced_security_objects_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, @@ -1102,35 +1059,237 @@ async def list_advanced_security_objects( skip=skip, top=top, api_version=api_version, - template_url=self.list_advanced_security_objects.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AdvSecurityObjectListResponse", pipeline_response) + deserialized = self._deserialize("AdvSecurityObjectListResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_app_ids( + self, + resource_group_name: str, + local_rulestack_name: str, + app_id_version: Optional[str] = None, + app_prefix: Optional[str] = None, + skip: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncItemPaged[str]: + """List of AppIds for LocalRulestack ApiVersion. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param local_rulestack_name: LocalRulestack resource name. Required. + :type local_rulestack_name: str + :param app_id_version: Default value is None. + :type app_id_version: str + :param app_prefix: Default value is None. + :type app_prefix: str + :param skip: Default value is None. + :type skip: str + :param top: Default value is None. + :type top: int + :return: An iterator like instance of either str or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - return deserialized + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ListAppIdResponse] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - list_advanced_security_objects.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listAdvancedSecurityObjects" - } + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_app_ids_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + subscription_id=self._config.subscription_id, + app_id_version=app_id_version, + app_prefix=app_prefix, + skip=skip, + top=top, + 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("ListAppIdResponse", 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_countries( + self, + resource_group_name: str, + local_rulestack_name: str, + skip: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.Country"]: + """List of countries for Rulestack. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param local_rulestack_name: LocalRulestack resource name. Required. + :type local_rulestack_name: str + :param skip: Default value is None. + :type skip: str + :param top: Default value is None. + :type top: int + :return: An iterator like instance of either Country or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.Country] + :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.CountriesResponse] = 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_countries_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + subscription_id=self._config.subscription_id, + skip=skip, + top=top, + 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("CountriesResponse", 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 list_firewalls( @@ -1143,12 +1302,11 @@ async def list_firewalls( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ListFirewallsResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.ListFirewallsResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1162,40 +1320,137 @@ async def list_firewalls( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListFirewallsResponse] = kwargs.pop("cls", None) - request = build_list_firewalls_request( + _request = build_list_firewalls_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_firewalls.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListFirewallsResponse", pipeline_response) + deserialized = self._deserialize("ListFirewallsResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - list_firewalls.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listFirewalls" - } + @distributed_trace + def list_predefined_url_categories( + self, + resource_group_name: str, + local_rulestack_name: str, + skip: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.PredefinedUrlCategory"]: + """List predefined URL categories for rulestack. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param local_rulestack_name: LocalRulestack resource name. Required. + :type local_rulestack_name: str + :param skip: Default value is None. + :type skip: str + :param top: Default value is None. + :type top: int + :return: An iterator like instance of either PredefinedUrlCategory or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.PredefinedUrlCategory] + :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.PredefinedUrlCategoriesResponse] = 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_predefined_url_categories_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + subscription_id=self._config.subscription_id, + skip=skip, + top=top, + 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("PredefinedUrlCategoriesResponse", 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 list_security_services( @@ -1221,12 +1476,11 @@ async def list_security_services( :type skip: str :param top: Default value is None. :type top: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: SecurityServicesResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SecurityServicesResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1240,7 +1494,7 @@ async def list_security_services( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SecurityServicesResponse] = kwargs.pop("cls", None) - request = build_list_security_services_request( + _request = build_list_security_services_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, @@ -1248,40 +1502,35 @@ async def list_security_services( skip=skip, top=top, api_version=api_version, - template_url=self.list_security_services.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityServicesResponse", pipeline_response) + deserialized = self._deserialize("SecurityServicesResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_security_services.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listSecurityServices" - } + return deserialized # type: ignore @distributed_trace_async - async def revert( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> None: + async def revert(self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any) -> None: """Revert rulestack configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1289,12 +1538,11 @@ async def revert( # pylint: disable=inconsistent-return-statements :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1308,33 +1556,30 @@ async def revert( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_revert_request( + _request = build_revert_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.revert.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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, {}) - - revert.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/revert" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_metrics_object_firewall_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_metrics_object_firewall_operations.py new file mode 100644 index 000000000000..6a9fe3e8add7 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_metrics_object_firewall_operations.py @@ -0,0 +1,546 @@ +# 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._metrics_object_firewall_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_firewalls_request, +) +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list + + +class MetricsObjectFirewallOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.paloaltonetworksngfw.aio.PaloAltoNetworksNgfwMgmtClient`'s + :attr:`metrics_object_firewall` 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: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + 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_by_firewalls( + self, resource_group_name: str, firewall_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.MetricsObjectFirewallResource"]: + """List MetricsObjectFirewallResource resources by Firewalls. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param firewall_name: Firewall resource name. Required. + :type firewall_name: str + :return: An iterator like instance of either MetricsObjectFirewallResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.MetricsObjectFirewallResource] + :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.MetricsObjectFirewallResourceListResult] = 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_firewalls_request( + resource_group_name=resource_group_name, + firewall_name=firewall_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("MetricsObjectFirewallResourceListResult", 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, firewall_name: str, **kwargs: Any + ) -> _models.MetricsObjectFirewallResource: + """Get a MetricsObjectFirewallResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param firewall_name: Firewall resource name. Required. + :type firewall_name: str + :return: MetricsObjectFirewallResource or the result of cls(response) + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.MetricsObjectFirewallResource + :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.MetricsObjectFirewallResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + firewall_name=firewall_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("MetricsObjectFirewallResource", 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, + firewall_name: str, + resource: Union[_models.MetricsObjectFirewallResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "MetricsObjectFirewallResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + firewall_name=firewall_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, + firewall_name: str, + resource: _models.MetricsObjectFirewallResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MetricsObjectFirewallResource]: + """Create a MetricsObjectFirewallResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param firewall_name: Firewall resource name. Required. + :type firewall_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.MetricsObjectFirewallResource + :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 MetricsObjectFirewallResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.MetricsObjectFirewallResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + firewall_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MetricsObjectFirewallResource]: + """Create a MetricsObjectFirewallResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param firewall_name: Firewall resource name. Required. + :type firewall_name: str + :param resource: Resource create parameters. Required. + :type resource: 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 MetricsObjectFirewallResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.MetricsObjectFirewallResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + firewall_name: str, + resource: Union[_models.MetricsObjectFirewallResource, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.MetricsObjectFirewallResource]: + """Create a MetricsObjectFirewallResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param firewall_name: Firewall resource name. Required. + :type firewall_name: str + :param resource: Resource create parameters. Is either a MetricsObjectFirewallResource type or + a IO[bytes] type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.MetricsObjectFirewallResource or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either MetricsObjectFirewallResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.MetricsObjectFirewallResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MetricsObjectFirewallResource] = 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, + firewall_name=firewall_name, + resource=resource, + 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("MetricsObjectFirewallResource", 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.MetricsObjectFirewallResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.MetricsObjectFirewallResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, firewall_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, + firewall_name=firewall_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["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 + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Delete a MetricsObjectFirewallResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param firewall_name: Firewall resource name. Required. + :type firewall_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, + firewall_name=firewall_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": "azure-async-operation"}, **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/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_operations.py index 771cc5ea381a..70a8803e6963 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,18 +20,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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 ..._vendor import _convert_request +from ..._utils.serialization import Deserializer, Serializer from ...operations._operations import build_list_request +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class Operations: @@ -47,16 +49,17 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Operation"]: """List the operations for the provider. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Operation or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.Operation] @@ -68,7 +71,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -79,14 +82,12 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -98,13 +99,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) @@ -114,21 +114,22 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/operations"} diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_palo_alto_networks_cloudngfw_operations_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_palo_alto_networks_cloudngfw_operations_operations.py new file mode 100644 index 000000000000..9aa9112729f6 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_palo_alto_networks_cloudngfw_operations_operations.py @@ -0,0 +1,270 @@ +# 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._palo_alto_networks_cloudngfw_operations_operations import ( + build_create_product_serial_number_request, + build_list_cloud_manager_tenants_request, + build_list_product_serial_number_status_request, + build_list_support_info_request, +) +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list + + +class PaloAltoNetworksCloudngfwOperationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.paloaltonetworksngfw.aio.PaloAltoNetworksNgfwMgmtClient`'s + :attr:`palo_alto_networks_cloudngfw_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") + self._config: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + 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 create_product_serial_number(self, **kwargs: Any) -> _models.ProductSerialNumberRequestStatus: + """create_product_serial_number. + + :return: ProductSerialNumberRequestStatus or the result of cls(response) + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.ProductSerialNumberRequestStatus + :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.ProductSerialNumberRequestStatus] = kwargs.pop("cls", None) + + _request = build_create_product_serial_number_request( + 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("ProductSerialNumberRequestStatus", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_cloud_manager_tenants(self, **kwargs: Any) -> _models.CloudManagerTenantList: + """list_cloud_manager_tenants. + + :return: CloudManagerTenantList or the result of cls(response) + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.CloudManagerTenantList + :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.CloudManagerTenantList] = kwargs.pop("cls", None) + + _request = build_list_cloud_manager_tenants_request( + 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("CloudManagerTenantList", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_product_serial_number_status(self, **kwargs: Any) -> Optional[_models.ProductSerialNumberStatus]: + """list_product_serial_number_status. + + :return: ProductSerialNumberStatus or None or the result of cls(response) + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.ProductSerialNumberStatus or 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[Optional[_models.ProductSerialNumberStatus]] = kwargs.pop("cls", None) + + _request = build_list_product_serial_number_status_request( + 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, 404]: + 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 = None + if response.status_code == 200: + deserialized = self._deserialize("ProductSerialNumberStatus", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_support_info(self, **kwargs: Any) -> _models.SupportInfoModel: + """list_support_info. + + :return: SupportInfoModel or the result of cls(response) + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SupportInfoModel + :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.SupportInfoModel] = kwargs.pop("cls", None) + + _request = build_list_support_info_request( + 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("SupportInfoModel", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_patch.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_patch.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_post_rules_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_post_rules_operations.py index b350aa6b3171..eac564b62ce9 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_post_rules_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_post_rules_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +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, @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +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 @@ -30,7 +32,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request +from ..._utils.serialization import Deserializer, Serializer from ...operations._post_rules_operations import ( build_create_or_update_request, build_delete_request, @@ -40,9 +42,11 @@ build_refresh_counters_request, build_reset_counters_request, ) +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class PostRulesOperations: @@ -59,18 +63,19 @@ class PostRulesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + 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, global_rulestack_name: str, **kwargs: Any) -> AsyncIterable["_models.PostRulesResource"]: + def list(self, global_rulestack_name: str, **kwargs: Any) -> AsyncItemPaged["_models.PostRulesResource"]: """List PostRulesResource resources by Tenant. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PostRulesResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource] @@ -82,7 +87,7 @@ def list(self, global_rulestack_name: str, **kwargs: Any) -> AsyncIterable["_mod api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PostRulesResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,15 +98,13 @@ def list(self, global_rulestack_name: str, **kwargs: Any) -> AsyncIterable["_mod def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -113,13 +116,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PostRulesResourceListResult", pipeline_response) @@ -129,25 +131,26 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules"} - @distributed_trace_async async def get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> _models.PostRulesResource: """Get a PostRulesResource. @@ -156,12 +159,11 @@ async def get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> :type global_rulestack_name: str :param priority: Post Rule priority. Required. :type priority: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PostRulesResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -175,44 +177,45 @@ async def get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PostRulesResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PostRulesResource", pipeline_response) + deserialized = self._deserialize("PostRulesResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}" - } + return deserialized # type: ignore async def _create_or_update_initial( - self, global_rulestack_name: str, priority: str, resource: Union[_models.PostRulesResource, IO], **kwargs: Any - ) -> _models.PostRulesResource: - error_map = { + self, + global_rulestack_name: str, + priority: str, + resource: Union[_models.PostRulesResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -225,7 +228,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PostRulesResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -235,47 +238,52 @@ async def _create_or_update_initial( else: _json = self._serialize.body(resource, "PostRulesResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PostRulesResource", pipeline_response) - + response_headers = {} if response.status_code == 201: - deserialized = self._deserialize("PostRulesResource", pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}" - } - @overload async def begin_create_or_update( self, @@ -297,14 +305,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PostRulesResource or the result of cls(response) :rtype: @@ -317,7 +317,7 @@ async def begin_create_or_update( self, global_rulestack_name: str, priority: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -329,18 +329,10 @@ async def begin_create_or_update( :param priority: Post Rule priority. Required. :type priority: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PostRulesResource or the result of cls(response) :rtype: @@ -350,7 +342,11 @@ async def begin_create_or_update( @distributed_trace_async async def begin_create_or_update( - self, global_rulestack_name: str, priority: str, resource: Union[_models.PostRulesResource, IO], **kwargs: Any + self, + global_rulestack_name: str, + priority: str, + resource: Union[_models.PostRulesResource, IO[bytes]], + **kwargs: Any ) -> AsyncLROPoller[_models.PostRulesResource]: """Create a PostRulesResource. @@ -358,20 +354,9 @@ async def begin_create_or_update( :type global_rulestack_name: str :param priority: Post Rule priority. Required. :type priority: str - :param resource: Resource create parameters. Is either a PostRulesResource type or a IO type. - Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param resource: Resource create parameters. Is either a PostRulesResource type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource or IO[bytes] :return: An instance of AsyncLROPoller that returns either PostRulesResource or the result of cls(response) :rtype: @@ -399,12 +384,13 @@ async def begin_create_or_update( 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("PostRulesResource", pipeline_response) + deserialized = self._deserialize("PostRulesResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -417,22 +403,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.PostRulesResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}" - } + return AsyncLROPoller[_models.PostRulesResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, priority: str, **kwargs: Any - ) -> None: - error_map = { + async def _delete_initial(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -444,37 +426,50 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 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) + 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, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -484,14 +479,6 @@ async def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs :type global_rulestack_name: str :param priority: Post Rule priority. Required. :type priority: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :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: @@ -505,7 +492,7 @@ async def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs 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( # type: ignore + raw_result = await self._delete_initial( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, @@ -514,11 +501,12 @@ async def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs 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, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -530,17 +518,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get_counters( @@ -554,12 +538,11 @@ async def get_counters( :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCounter or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounter :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -573,43 +556,40 @@ async def get_counters( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RuleCounter] = kwargs.pop("cls", None) - request = build_get_counters_request( + _request = build_get_counters_request( global_rulestack_name=global_rulestack_name, priority=priority, firewall_name=firewall_name, api_version=api_version, - template_url=self.get_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleCounter", pipeline_response) + deserialized = self._deserialize("RuleCounter", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}/getCounters" - } + return deserialized # type: ignore @distributed_trace_async - async def refresh_counters( # pylint: disable=inconsistent-return-statements + async def refresh_counters( self, global_rulestack_name: str, priority: str, firewall_name: Optional[str] = None, **kwargs: Any ) -> None: """Refresh counters. @@ -620,12 +600,11 @@ async def refresh_counters( # pylint: disable=inconsistent-return-statements :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -639,36 +618,33 @@ async def refresh_counters( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_refresh_counters_request( + _request = build_refresh_counters_request( global_rulestack_name=global_rulestack_name, priority=priority, firewall_name=firewall_name, api_version=api_version, - template_url=self.refresh_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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, {}) - - refresh_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}/refreshCounters" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def reset_counters( @@ -682,12 +658,11 @@ async def reset_counters( :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCounterReset or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounterReset :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -701,37 +676,34 @@ async def reset_counters( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RuleCounterReset] = kwargs.pop("cls", None) - request = build_reset_counters_request( + _request = build_reset_counters_request( global_rulestack_name=global_rulestack_name, priority=priority, firewall_name=firewall_name, api_version=api_version, - template_url=self.reset_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleCounterReset", pipeline_response) + deserialized = self._deserialize("RuleCounterReset", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - reset_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}/resetCounters" - } + return deserialized # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_pre_rules_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_pre_rules_operations.py index f3c54af9d87d..5591694170eb 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_pre_rules_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_pre_rules_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +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, @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +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 @@ -30,7 +32,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request +from ..._utils.serialization import Deserializer, Serializer from ...operations._pre_rules_operations import ( build_create_or_update_request, build_delete_request, @@ -40,9 +42,11 @@ build_refresh_counters_request, build_reset_counters_request, ) +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class PreRulesOperations: @@ -59,18 +63,19 @@ class PreRulesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + 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, global_rulestack_name: str, **kwargs: Any) -> AsyncIterable["_models.PreRulesResource"]: + def list(self, global_rulestack_name: str, **kwargs: Any) -> AsyncItemPaged["_models.PreRulesResource"]: """List PreRulesResource resources by Tenant. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PreRulesResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource] @@ -82,7 +87,7 @@ def list(self, global_rulestack_name: str, **kwargs: Any) -> AsyncIterable["_mod api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PreRulesResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,15 +98,13 @@ def list(self, global_rulestack_name: str, **kwargs: Any) -> AsyncIterable["_mod def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -113,13 +116,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PreRulesResourceListResult", pipeline_response) @@ -129,25 +131,26 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules"} - @distributed_trace_async async def get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> _models.PreRulesResource: """Get a PreRulesResource. @@ -156,12 +159,11 @@ async def get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> :type global_rulestack_name: str :param priority: Pre Rule priority. Required. :type priority: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PreRulesResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -175,44 +177,45 @@ async def get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PreRulesResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PreRulesResource", pipeline_response) + deserialized = self._deserialize("PreRulesResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}" - } + return deserialized # type: ignore async def _create_or_update_initial( - self, global_rulestack_name: str, priority: str, resource: Union[_models.PreRulesResource, IO], **kwargs: Any - ) -> _models.PreRulesResource: - error_map = { + self, + global_rulestack_name: str, + priority: str, + resource: Union[_models.PreRulesResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -225,7 +228,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PreRulesResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -235,47 +238,52 @@ async def _create_or_update_initial( else: _json = self._serialize.body(resource, "PreRulesResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PreRulesResource", pipeline_response) - + response_headers = {} if response.status_code == 201: - deserialized = self._deserialize("PreRulesResource", pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}" - } - @overload async def begin_create_or_update( self, @@ -297,14 +305,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PreRulesResource or the result of cls(response) :rtype: @@ -317,7 +317,7 @@ async def begin_create_or_update( self, global_rulestack_name: str, priority: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -329,18 +329,10 @@ async def begin_create_or_update( :param priority: Pre Rule priority. Required. :type priority: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PreRulesResource or the result of cls(response) :rtype: @@ -350,7 +342,11 @@ async def begin_create_or_update( @distributed_trace_async async def begin_create_or_update( - self, global_rulestack_name: str, priority: str, resource: Union[_models.PreRulesResource, IO], **kwargs: Any + self, + global_rulestack_name: str, + priority: str, + resource: Union[_models.PreRulesResource, IO[bytes]], + **kwargs: Any ) -> AsyncLROPoller[_models.PreRulesResource]: """Create a PreRulesResource. @@ -358,20 +354,9 @@ async def begin_create_or_update( :type global_rulestack_name: str :param priority: Pre Rule priority. Required. :type priority: str - :param resource: Resource create parameters. Is either a PreRulesResource type or a IO type. - Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param resource: Resource create parameters. Is either a PreRulesResource type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource or IO[bytes] :return: An instance of AsyncLROPoller that returns either PreRulesResource or the result of cls(response) :rtype: @@ -399,12 +384,13 @@ async def begin_create_or_update( 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("PreRulesResource", pipeline_response) + deserialized = self._deserialize("PreRulesResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -417,22 +403,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.PreRulesResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}" - } + return AsyncLROPoller[_models.PreRulesResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, priority: str, **kwargs: Any - ) -> None: - error_map = { + async def _delete_initial(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -444,37 +426,50 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 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) + 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, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -484,14 +479,6 @@ async def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs :type global_rulestack_name: str :param priority: Pre Rule priority. Required. :type priority: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :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: @@ -505,7 +492,7 @@ async def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs 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( # type: ignore + raw_result = await self._delete_initial( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, @@ -514,11 +501,12 @@ async def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs 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, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -530,17 +518,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get_counters( @@ -554,12 +538,11 @@ async def get_counters( :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCounter or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounter :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -573,43 +556,40 @@ async def get_counters( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RuleCounter] = kwargs.pop("cls", None) - request = build_get_counters_request( + _request = build_get_counters_request( global_rulestack_name=global_rulestack_name, priority=priority, firewall_name=firewall_name, api_version=api_version, - template_url=self.get_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleCounter", pipeline_response) + deserialized = self._deserialize("RuleCounter", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}/getCounters" - } + return deserialized # type: ignore @distributed_trace_async - async def refresh_counters( # pylint: disable=inconsistent-return-statements + async def refresh_counters( self, global_rulestack_name: str, priority: str, firewall_name: Optional[str] = None, **kwargs: Any ) -> None: """Refresh counters. @@ -620,12 +600,11 @@ async def refresh_counters( # pylint: disable=inconsistent-return-statements :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -639,36 +618,33 @@ async def refresh_counters( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_refresh_counters_request( + _request = build_refresh_counters_request( global_rulestack_name=global_rulestack_name, priority=priority, firewall_name=firewall_name, api_version=api_version, - template_url=self.refresh_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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, {}) - - refresh_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}/refreshCounters" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def reset_counters( @@ -682,12 +658,11 @@ async def reset_counters( :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCounterReset or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounterReset :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -701,37 +676,34 @@ async def reset_counters( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RuleCounterReset] = kwargs.pop("cls", None) - request = build_reset_counters_request( + _request = build_reset_counters_request( global_rulestack_name=global_rulestack_name, priority=priority, firewall_name=firewall_name, api_version=api_version, - template_url=self.reset_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleCounterReset", pipeline_response) + deserialized = self._deserialize("RuleCounterReset", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - reset_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}/resetCounters" - } + return deserialized # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_prefix_list_global_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_prefix_list_global_rulestack_operations.py index 48950b46a194..8abdb3f5c6f2 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_prefix_list_global_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_prefix_list_global_rulestack_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +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, @@ -17,12 +19,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +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 @@ -30,16 +33,18 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request +from ..._utils.serialization import Deserializer, Serializer from ...operations._prefix_list_global_rulestack_operations import ( build_create_or_update_request, build_delete_request, build_get_request, build_list_request, ) +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class PrefixListGlobalRulestackOperations: @@ -56,20 +61,21 @@ class PrefixListGlobalRulestackOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + 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, global_rulestack_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PrefixListGlobalRulestackResource"]: + ) -> AsyncItemPaged["_models.PrefixListGlobalRulestackResource"]: """List PrefixListGlobalRulestackResource resources by Tenant. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrefixListGlobalRulestackResource or the result of cls(response) :rtype: @@ -82,7 +88,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrefixListGlobalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,15 +99,13 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -113,13 +117,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PrefixListGlobalRulestackResourceListResult", pipeline_response) @@ -129,25 +132,26 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists"} - @distributed_trace_async async def get( self, global_rulestack_name: str, name: str, **kwargs: Any @@ -158,12 +162,11 @@ async def get( :type global_rulestack_name: str :param name: Local Rule priority. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrefixListGlobalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -177,48 +180,45 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrefixListGlobalRulestackResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrefixListGlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("PrefixListGlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, global_rulestack_name: str, name: str, - resource: Union[_models.PrefixListGlobalRulestackResource, IO], + resource: Union[_models.PrefixListGlobalRulestackResource, IO[bytes]], **kwargs: Any - ) -> _models.PrefixListGlobalRulestackResource: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -231,7 +231,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrefixListGlobalRulestackResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -241,47 +241,52 @@ async def _create_or_update_initial( else: _json = self._serialize.body(resource, "PrefixListGlobalRulestackResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PrefixListGlobalRulestackResource", pipeline_response) - + response_headers = {} if response.status_code == 201: - deserialized = self._deserialize("PrefixListGlobalRulestackResource", pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}" - } - @overload async def begin_create_or_update( self, @@ -303,14 +308,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PrefixListGlobalRulestackResource or the result of cls(response) :rtype: @@ -323,7 +320,7 @@ async def begin_create_or_update( self, global_rulestack_name: str, name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -335,18 +332,10 @@ async def begin_create_or_update( :param name: Local Rule priority. Required. :type name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PrefixListGlobalRulestackResource or the result of cls(response) :rtype: @@ -359,7 +348,7 @@ async def begin_create_or_update( self, global_rulestack_name: str, name: str, - resource: Union[_models.PrefixListGlobalRulestackResource, IO], + resource: Union[_models.PrefixListGlobalRulestackResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.PrefixListGlobalRulestackResource]: """Create a PrefixListGlobalRulestackResource. @@ -369,19 +358,9 @@ async def begin_create_or_update( :param name: Local Rule priority. Required. :type name: str :param resource: Resource create parameters. Is either a PrefixListGlobalRulestackResource type - or a IO type. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + or a IO[bytes] type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource or + IO[bytes] :return: An instance of AsyncLROPoller that returns either PrefixListGlobalRulestackResource or the result of cls(response) :rtype: @@ -409,12 +388,13 @@ async def begin_create_or_update( 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("PrefixListGlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("PrefixListGlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -427,22 +407,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.PrefixListGlobalRulestackResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}" - } + return AsyncLROPoller[_models.PrefixListGlobalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + async def _delete_initial(self, global_rulestack_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -454,37 +430,50 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 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) + 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, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -494,14 +483,6 @@ async def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: An :type global_rulestack_name: str :param name: Local Rule priority. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :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: @@ -515,7 +496,7 @@ async def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: An 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( # type: ignore + raw_result = await self._delete_initial( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, @@ -524,11 +505,12 @@ async def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: An 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, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -540,14 +522,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_prefix_list_local_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_prefix_list_local_rulestack_operations.py index 162c902c17f3..7f4404cc9080 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_prefix_list_local_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_prefix_list_local_rulestack_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +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, @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +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 @@ -30,16 +32,18 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request +from ..._utils.serialization import Deserializer, Serializer from ...operations._prefix_list_local_rulestack_operations import ( build_create_or_update_request, build_delete_request, build_get_request, build_list_by_local_rulestacks_request, ) +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class PrefixListLocalRulestackOperations: @@ -56,15 +60,17 @@ class PrefixListLocalRulestackOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + 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_by_local_rulestacks( self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PrefixListResource"]: + ) -> AsyncItemPaged["_models.PrefixListResource"]: """List PrefixListResource resources by LocalRulestacks. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -72,7 +78,6 @@ def list_by_local_rulestacks( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrefixListResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource] @@ -84,7 +89,7 @@ def list_by_local_rulestacks( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrefixListResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,17 +100,15 @@ def list_by_local_rulestacks( def prepare_request(next_link=None): if not next_link: - request = build_list_by_local_rulestacks_request( + _request = build_list_by_local_rulestacks_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_local_rulestacks.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -117,13 +120,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PrefixListResourceListResult", pipeline_response) @@ -133,27 +135,26 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - list_by_local_rulestacks.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists" - } - @distributed_trace_async async def get( self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any @@ -167,12 +168,11 @@ async def get( :type local_rulestack_name: str :param name: Local Rule priority. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrefixListResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -186,51 +186,48 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrefixListResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrefixListResource", pipeline_response) + deserialized = self._deserialize("PrefixListResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, local_rulestack_name: str, name: str, - resource: Union[_models.PrefixListResource, IO], + resource: Union[_models.PrefixListResource, IO[bytes]], **kwargs: Any - ) -> _models.PrefixListResource: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -243,7 +240,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrefixListResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -253,7 +250,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(resource, "PrefixListResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, @@ -262,40 +259,45 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PrefixListResource", pipeline_response) - + response_headers = {} if response.status_code == 201: - deserialized = self._deserialize("PrefixListResource", pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}" - } - @overload async def begin_create_or_update( self, @@ -321,14 +323,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PrefixListResource or the result of cls(response) :rtype: @@ -342,7 +336,7 @@ async def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -357,18 +351,10 @@ async def begin_create_or_update( :param name: Local Rule priority. Required. :type name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PrefixListResource or the result of cls(response) :rtype: @@ -382,7 +368,7 @@ async def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, name: str, - resource: Union[_models.PrefixListResource, IO], + resource: Union[_models.PrefixListResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.PrefixListResource]: """Create a PrefixListResource. @@ -394,20 +380,9 @@ async def begin_create_or_update( :type local_rulestack_name: str :param name: Local Rule priority. Required. :type name: str - :param resource: Resource create parameters. Is either a PrefixListResource type or a IO type. - Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param resource: Resource create parameters. Is either a PrefixListResource type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource or IO[bytes] :return: An instance of AsyncLROPoller that returns either PrefixListResource or the result of cls(response) :rtype: @@ -436,12 +411,13 @@ async def begin_create_or_update( 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("PrefixListResource", pipeline_response) + deserialized = self._deserialize("PrefixListResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -454,22 +430,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.PrefixListResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}" - } + return AsyncLROPoller[_models.PrefixListResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -481,39 +455,52 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 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) + 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, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -528,14 +515,6 @@ async def begin_delete( :type local_rulestack_name: str :param name: Local Rule priority. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :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: @@ -549,7 +528,7 @@ async def begin_delete( 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( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, @@ -559,11 +538,12 @@ async def begin_delete( 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, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -575,14 +555,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/__init__.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/__init__.py index 2cb2e2ebaf6b..7af02df597f9 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/__init__.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/__init__.py @@ -5,122 +5,144 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AdvSecurityObjectListResponse -from ._models_py3 import AdvSecurityObjectModel -from ._models_py3 import AppSeenData -from ._models_py3 import AppSeenInfo -from ._models_py3 import ApplicationInsights -from ._models_py3 import AzureResourceManagerManagedIdentityProperties -from ._models_py3 import AzureResourceManagerUserAssignedIdentity -from ._models_py3 import Category -from ._models_py3 import CertificateObjectGlobalRulestackResource -from ._models_py3 import CertificateObjectGlobalRulestackResourceListResult -from ._models_py3 import CertificateObjectLocalRulestackResource -from ._models_py3 import CertificateObjectLocalRulestackResourceListResult -from ._models_py3 import Changelog -from ._models_py3 import CountriesResponse -from ._models_py3 import Country -from ._models_py3 import DNSSettings -from ._models_py3 import DestinationAddr -from ._models_py3 import EndpointConfiguration -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ErrorResponse -from ._models_py3 import EventHub -from ._models_py3 import FirewallResource -from ._models_py3 import FirewallResourceListResult -from ._models_py3 import FirewallResourceUpdate -from ._models_py3 import FirewallResourceUpdateProperties -from ._models_py3 import FirewallStatusResource -from ._models_py3 import FirewallStatusResourceListResult -from ._models_py3 import FqdnListGlobalRulestackResource -from ._models_py3 import FqdnListGlobalRulestackResourceListResult -from ._models_py3 import FqdnListLocalRulestackResource -from ._models_py3 import FqdnListLocalRulestackResourceListResult -from ._models_py3 import FrontendSetting -from ._models_py3 import GlobalRulestackInfo -from ._models_py3 import GlobalRulestackResource -from ._models_py3 import GlobalRulestackResourceListResult -from ._models_py3 import GlobalRulestackResourceUpdate -from ._models_py3 import GlobalRulestackResourceUpdateProperties -from ._models_py3 import IPAddress -from ._models_py3 import IPAddressSpace -from ._models_py3 import ListAppIdResponse -from ._models_py3 import ListFirewallsResponse -from ._models_py3 import LocalRulesResource -from ._models_py3 import LocalRulesResourceListResult -from ._models_py3 import LocalRulestackResource -from ._models_py3 import LocalRulestackResourceListResult -from ._models_py3 import LocalRulestackResourceUpdate -from ._models_py3 import LocalRulestackResourceUpdateProperties -from ._models_py3 import LogDestination -from ._models_py3 import LogSettings -from ._models_py3 import MarketplaceDetails -from ._models_py3 import MonitorLog -from ._models_py3 import NameDescriptionObject -from ._models_py3 import NetworkProfile -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import PanoramaConfig -from ._models_py3 import PanoramaStatus -from ._models_py3 import PlanData -from ._models_py3 import PostRulesResource -from ._models_py3 import PostRulesResourceListResult -from ._models_py3 import PreRulesResource -from ._models_py3 import PreRulesResourceListResult -from ._models_py3 import PredefinedUrlCategoriesResponse -from ._models_py3 import PredefinedUrlCategory -from ._models_py3 import PrefixListGlobalRulestackResource -from ._models_py3 import PrefixListGlobalRulestackResourceListResult -from ._models_py3 import PrefixListResource -from ._models_py3 import PrefixListResourceListResult -from ._models_py3 import ProxyResource -from ._models_py3 import Resource -from ._models_py3 import RuleCounter -from ._models_py3 import RuleCounterReset -from ._models_py3 import RulestackDetails -from ._models_py3 import SecurityServices -from ._models_py3 import SecurityServicesResponse -from ._models_py3 import SecurityServicesTypeList -from ._models_py3 import SourceAddr -from ._models_py3 import StorageAccount -from ._models_py3 import SupportInfo -from ._models_py3 import SystemData -from ._models_py3 import TagInfo -from ._models_py3 import TrackedResource -from ._models_py3 import VnetConfiguration -from ._models_py3 import VwanConfiguration +from typing import TYPE_CHECKING -from ._palo_alto_networks_ngfw_mgmt_client_enums import ActionEnum -from ._palo_alto_networks_ngfw_mgmt_client_enums import ActionType -from ._palo_alto_networks_ngfw_mgmt_client_enums import AdvSecurityObjectTypeEnum -from ._palo_alto_networks_ngfw_mgmt_client_enums import BillingCycle -from ._palo_alto_networks_ngfw_mgmt_client_enums import BooleanEnum -from ._palo_alto_networks_ngfw_mgmt_client_enums import CreatedByType -from ._palo_alto_networks_ngfw_mgmt_client_enums import DNSProxy -from ._palo_alto_networks_ngfw_mgmt_client_enums import DecryptionRuleTypeEnum -from ._palo_alto_networks_ngfw_mgmt_client_enums import DefaultMode -from ._palo_alto_networks_ngfw_mgmt_client_enums import EgressNat -from ._palo_alto_networks_ngfw_mgmt_client_enums import EnabledDNSType -from ._palo_alto_networks_ngfw_mgmt_client_enums import HealthStatus -from ._palo_alto_networks_ngfw_mgmt_client_enums import LogOption -from ._palo_alto_networks_ngfw_mgmt_client_enums import LogType -from ._palo_alto_networks_ngfw_mgmt_client_enums import ManagedIdentityType -from ._palo_alto_networks_ngfw_mgmt_client_enums import MarketplaceSubscriptionStatus -from ._palo_alto_networks_ngfw_mgmt_client_enums import NetworkType -from ._palo_alto_networks_ngfw_mgmt_client_enums import Origin -from ._palo_alto_networks_ngfw_mgmt_client_enums import ProtocolType -from ._palo_alto_networks_ngfw_mgmt_client_enums import ProvisioningState -from ._palo_alto_networks_ngfw_mgmt_client_enums import ReadOnlyProvisioningState -from ._palo_alto_networks_ngfw_mgmt_client_enums import ScopeType -from ._palo_alto_networks_ngfw_mgmt_client_enums import SecurityServicesTypeEnum -from ._palo_alto_networks_ngfw_mgmt_client_enums import ServerStatus -from ._palo_alto_networks_ngfw_mgmt_client_enums import StateEnum -from ._palo_alto_networks_ngfw_mgmt_client_enums import UsageType +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AdvSecurityObjectListResponse, + AdvSecurityObjectModel, + AppSeenData, + AppSeenInfo, + ApplicationInsights, + AzureResourceManagerManagedIdentityProperties, + AzureResourceManagerUserAssignedIdentity, + Category, + CertificateObjectGlobalRulestackResource, + CertificateObjectGlobalRulestackResourceListResult, + CertificateObjectLocalRulestackResource, + CertificateObjectLocalRulestackResourceListResult, + Changelog, + CloudManagerTenantList, + CountriesResponse, + Country, + DNSSettings, + DestinationAddr, + EndpointConfiguration, + ErrorAdditionalInfo, + ErrorDetail, + ErrorResponse, + EventHub, + FirewallResource, + FirewallResourceListResult, + FirewallResourceUpdate, + FirewallResourceUpdateProperties, + FirewallStatusResource, + FirewallStatusResourceListResult, + FqdnListGlobalRulestackResource, + FqdnListGlobalRulestackResourceListResult, + FqdnListLocalRulestackResource, + FqdnListLocalRulestackResourceListResult, + FrontendSetting, + GlobalRulestackInfo, + GlobalRulestackResource, + GlobalRulestackResourceListResult, + GlobalRulestackResourceUpdate, + GlobalRulestackResourceUpdateProperties, + IPAddress, + IPAddressSpace, + ListAppIdResponse, + ListFirewallsResponse, + LocalRulesResource, + LocalRulesResourceListResult, + LocalRulestackResource, + LocalRulestackResourceListResult, + LocalRulestackResourceUpdate, + LocalRulestackResourceUpdateProperties, + LogDestination, + LogSettings, + MarketplaceDetails, + MetricsObjectFirewallResource, + MetricsObjectFirewallResourceListResult, + MonitorLog, + NameDescriptionObject, + NetworkProfile, + Operation, + OperationDisplay, + OperationListResult, + PanoramaConfig, + PanoramaStatus, + PlanData, + PostRulesResource, + PostRulesResourceListResult, + PreRulesResource, + PreRulesResourceListResult, + PredefinedUrlCategoriesResponse, + PredefinedUrlCategory, + PrefixListGlobalRulestackResource, + PrefixListGlobalRulestackResourceListResult, + PrefixListResource, + PrefixListResourceListResult, + ProductSerialNumberRequestStatus, + ProductSerialNumberStatus, + ProxyResource, + Resource, + RuleCounter, + RuleCounterReset, + RulestackDetails, + SecurityServices, + SecurityServicesResponse, + SecurityServicesTypeList, + SourceAddr, + StorageAccount, + StrataCloudManagerConfig, + StrataCloudManagerInfo, + SupportInfo, + SupportInfoModel, + SystemData, + TagInfo, + TrackedResource, + VnetConfiguration, + VwanConfiguration, +) + +from ._palo_alto_networks_ngfw_mgmt_client_enums import ( # type: ignore + ActionEnum, + ActionType, + AdvSecurityObjectTypeEnum, + BillingCycle, + BooleanEnum, + CreatedByType, + DNSProxy, + DecryptionRuleTypeEnum, + DefaultMode, + EgressNat, + EnableStatus, + EnabledDNSType, + HealthStatus, + LogOption, + LogType, + ManagedIdentityType, + MarketplaceSubscriptionStatus, + NetworkType, + Origin, + ProductSerialStatusValues, + ProtocolType, + ProvisioningState, + ReadOnlyProvisioningState, + RegistrationStatus, + ScopeType, + SecurityServicesTypeEnum, + ServerStatus, + StateEnum, + UsageType, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -137,6 +159,7 @@ "CertificateObjectLocalRulestackResource", "CertificateObjectLocalRulestackResourceListResult", "Changelog", + "CloudManagerTenantList", "CountriesResponse", "Country", "DNSSettings", @@ -175,6 +198,8 @@ "LogDestination", "LogSettings", "MarketplaceDetails", + "MetricsObjectFirewallResource", + "MetricsObjectFirewallResourceListResult", "MonitorLog", "NameDescriptionObject", "NetworkProfile", @@ -194,6 +219,8 @@ "PrefixListGlobalRulestackResourceListResult", "PrefixListResource", "PrefixListResourceListResult", + "ProductSerialNumberRequestStatus", + "ProductSerialNumberStatus", "ProxyResource", "Resource", "RuleCounter", @@ -204,7 +231,10 @@ "SecurityServicesTypeList", "SourceAddr", "StorageAccount", + "StrataCloudManagerConfig", + "StrataCloudManagerInfo", "SupportInfo", + "SupportInfoModel", "SystemData", "TagInfo", "TrackedResource", @@ -220,6 +250,7 @@ "DecryptionRuleTypeEnum", "DefaultMode", "EgressNat", + "EnableStatus", "EnabledDNSType", "HealthStatus", "LogOption", @@ -228,14 +259,16 @@ "MarketplaceSubscriptionStatus", "NetworkType", "Origin", + "ProductSerialStatusValues", "ProtocolType", "ProvisioningState", "ReadOnlyProvisioningState", + "RegistrationStatus", "ScopeType", "SecurityServicesTypeEnum", "ServerStatus", "StateEnum", "UsageType", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_models_py3.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_models_py3.py index 9f11b2f7c47f..6c07802245fc 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_models_py3.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_models_py3.py @@ -1,5 +1,5 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 -# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,20 +7,21 @@ # 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, Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Optional, TYPE_CHECKING, Union -from .. import _serialization +from .._utils import serialization as _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models +JSON = MutableMapping[str, Any] class AdvSecurityObjectListResponse(_serialization.Model): """advanced security object. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: response value. Required. :vartype value: ~azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectModel @@ -54,7 +55,7 @@ def __init__( class AdvSecurityObjectModel(_serialization.Model): """List of custom and predefined url category. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar type: type of object. :vartype type: str @@ -72,7 +73,7 @@ class AdvSecurityObjectModel(_serialization.Model): } def __init__( - self, *, entry: List["_models.NameDescriptionObject"], type: Optional[str] = None, **kwargs: Any + self, *, entry: list["_models.NameDescriptionObject"], type: Optional[str] = None, **kwargs: Any ) -> None: """ :keyword type: type of object. @@ -116,7 +117,7 @@ def __init__( class AppSeenData(_serialization.Model): """Data Type for App Seen. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar count: number of rows. Required. :vartype count: int @@ -134,7 +135,7 @@ class AppSeenData(_serialization.Model): "app_seen_list": {"key": "appSeenList", "type": "[AppSeenInfo]"}, } - def __init__(self, *, count: int, app_seen_list: List["_models.AppSeenInfo"], **kwargs: Any) -> None: + def __init__(self, *, count: int, app_seen_list: list["_models.AppSeenInfo"], **kwargs: Any) -> None: """ :keyword count: number of rows. Required. :paramtype count: int @@ -149,7 +150,7 @@ def __init__(self, *, count: int, app_seen_list: List["_models.AppSeenInfo"], ** class AppSeenInfo(_serialization.Model): """Definition for App Seen. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar title: title. Required. :vartype title: str @@ -225,12 +226,12 @@ def __init__( self.standard_ports = standard_ports -class AzureResourceManagerManagedIdentityProperties(_serialization.Model): +class AzureResourceManagerManagedIdentityProperties(_serialization.Model): # pylint: disable=name-too-long """The properties of the managed service identities assigned to this resource. 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 Azure. + All required parameters must be populated in order to send to server. :ivar tenant_id: The Active Directory tenant id of the principal. :vartype tenant_id: str @@ -264,7 +265,7 @@ def __init__( self, *, type: Union[str, "_models.ManagedIdentityType"], - user_assigned_identities: Optional[Dict[str, "_models.AzureResourceManagerUserAssignedIdentity"]] = None, + user_assigned_identities: Optional[dict[str, "_models.AzureResourceManagerUserAssignedIdentity"]] = None, **kwargs: Any ) -> None: """ @@ -276,8 +277,8 @@ def __init__( ~azure.mgmt.paloaltonetworksngfw.models.AzureResourceManagerUserAssignedIdentity] """ super().__init__(**kwargs) - self.tenant_id = None - self.principal_id = None + self.tenant_id: Optional[str] = None + self.principal_id: Optional[str] = None self.type = type self.user_assigned_identities = user_assigned_identities @@ -311,7 +312,7 @@ def __init__(self, *, client_id: Optional[str] = None, principal_id: Optional[st class Category(_serialization.Model): """URL/EDL to match. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar url_custom: custom URL. Required. :vartype url_custom: list[str] @@ -329,7 +330,7 @@ class Category(_serialization.Model): "feeds": {"key": "feeds", "type": "[str]"}, } - def __init__(self, *, url_custom: List[str], feeds: List[str], **kwargs: Any) -> None: + def __init__(self, *, url_custom: list[str], feeds: list[str], **kwargs: Any) -> None: """ :keyword url_custom: custom URL. Required. :paramtype url_custom: list[str] @@ -376,10 +377,10 @@ class Resource(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.system_data: Optional["_models.SystemData"] = None class ProxyResource(Resource): @@ -401,31 +402,13 @@ class ProxyResource(Resource): :vartype system_data: ~azure.mgmt.paloaltonetworksngfw.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) - class CertificateObjectGlobalRulestackResource(ProxyResource): """GlobalRulestack Certificate Object. 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 Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -508,15 +491,15 @@ def __init__( self.audit_comment = audit_comment self.description = description self.etag = etag - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None -class CertificateObjectGlobalRulestackResourceListResult(_serialization.Model): +class CertificateObjectGlobalRulestackResourceListResult(_serialization.Model): # pylint: disable=name-too-long """The response of a CertificateObjectGlobalRulestackResource list operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar value: The items on this page. Required. + :ivar value: The CertificateObjectGlobalRulestackResource items on this page. Required. :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource] :ivar next_link: The link to the next page of items. @@ -535,12 +518,12 @@ class CertificateObjectGlobalRulestackResourceListResult(_serialization.Model): def __init__( self, *, - value: List["_models.CertificateObjectGlobalRulestackResource"], + value: list["_models.CertificateObjectGlobalRulestackResource"], next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword value: The items on this page. Required. + :keyword value: The CertificateObjectGlobalRulestackResource items on this page. Required. :paramtype value: list[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource] :keyword next_link: The link to the next page of items. @@ -556,7 +539,7 @@ class CertificateObjectLocalRulestackResource(ProxyResource): 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 Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -639,15 +622,15 @@ def __init__( self.audit_comment = audit_comment self.description = description self.etag = etag - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None -class CertificateObjectLocalRulestackResourceListResult(_serialization.Model): +class CertificateObjectLocalRulestackResourceListResult(_serialization.Model): # pylint: disable=name-too-long """The response of a CertificateObjectLocalRulestackResource list operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar value: The items on this page. Required. + :ivar value: The CertificateObjectLocalRulestackResource items on this page. Required. :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource] :ivar next_link: The link to the next page of items. @@ -666,12 +649,12 @@ class CertificateObjectLocalRulestackResourceListResult(_serialization.Model): def __init__( self, *, - value: List["_models.CertificateObjectLocalRulestackResource"], + value: list["_models.CertificateObjectLocalRulestackResource"], next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword value: The items on this page. Required. + :keyword value: The CertificateObjectLocalRulestackResource items on this page. Required. :paramtype value: list[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource] :keyword next_link: The link to the next page of items. @@ -685,7 +668,7 @@ def __init__( class Changelog(_serialization.Model): """Changelog list. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar changes: list of changes. Required. :vartype changes: list[str] @@ -708,7 +691,7 @@ class Changelog(_serialization.Model): def __init__( self, *, - changes: List[str], + changes: list[str], last_committed: Optional[datetime.datetime] = None, last_modified: Optional[datetime.datetime] = None, **kwargs: Any @@ -727,14 +710,40 @@ def __init__( self.last_modified = last_modified +class CloudManagerTenantList(_serialization.Model): + """Cloud Manager Tenant. + + All required parameters must be populated in order to send to server. + + :ivar value: List of Cloud Manager Tenants. Required. + :vartype value: list[str] + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[str]"}, + } + + def __init__(self, *, value: list[str], **kwargs: Any) -> None: + """ + :keyword value: List of Cloud Manager Tenants. Required. + :paramtype value: list[str] + """ + super().__init__(**kwargs) + self.value = value + + class CountriesResponse(_serialization.Model): """Countries Response Object. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar value: List of countries. Required. + :ivar value: The Country items on this page. Required. :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.Country] - :ivar next_link: next link. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ @@ -747,11 +756,11 @@ class CountriesResponse(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.Country"], next_link: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, value: list["_models.Country"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword value: List of countries. Required. + :keyword value: The Country items on this page. Required. :paramtype value: list[~azure.mgmt.paloaltonetworksngfw.models.Country] - :keyword next_link: next link. + :keyword next_link: The link to the next page of items. :paramtype next_link: str """ super().__init__(**kwargs) @@ -762,7 +771,7 @@ def __init__(self, *, value: List["_models.Country"], next_link: Optional[str] = class Country(_serialization.Model): """Country Description. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar code: country code. Required. :vartype code: str @@ -817,11 +826,11 @@ class DestinationAddr(_serialization.Model): def __init__( self, *, - cidrs: Optional[List[str]] = None, - countries: Optional[List[str]] = None, - feeds: Optional[List[str]] = None, - prefix_lists: Optional[List[str]] = None, - fqdn_lists: Optional[List[str]] = None, + cidrs: Optional[list[str]] = None, + countries: Optional[list[str]] = None, + feeds: Optional[list[str]] = None, + prefix_lists: Optional[list[str]] = None, + fqdn_lists: Optional[list[str]] = None, **kwargs: Any ) -> None: """ @@ -868,7 +877,7 @@ def __init__( *, enable_dns_proxy: Optional[Union[str, "_models.DNSProxy"]] = None, enabled_dns_type: Optional[Union[str, "_models.EnabledDNSType"]] = None, - dns_servers: Optional[List["_models.IPAddress"]] = None, + dns_servers: Optional[list["_models.IPAddress"]] = None, **kwargs: Any ) -> None: """ @@ -890,7 +899,7 @@ def __init__( class EndpointConfiguration(_serialization.Model): """Endpoint Configuration for frontend and backend. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar port: port ID. Required. :vartype port: str @@ -944,8 +953,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorDetail(_serialization.Model): @@ -984,11 +993,11 @@ class ErrorDetail(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[list["_models.ErrorDetail"]] = None + self.additional_info: Optional[list["_models.ErrorAdditionalInfo"]] = None class ErrorResponse(_serialization.Model): @@ -1071,7 +1080,7 @@ class TrackedResource(Resource): 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 Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -1107,7 +1116,7 @@ class TrackedResource(Resource): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + def __init__(self, *, location: str, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -1119,12 +1128,12 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class FirewallResource(TrackedResource): # pylint: disable=too-many-instance-attributes +class FirewallResource(TrackedResource): """PaloAltoNetworks Firewall. 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 Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -1151,8 +1160,15 @@ class FirewallResource(TrackedResource): # pylint: disable=too-many-instance-at :ivar is_panorama_managed: Panorama Managed: Default is False. Default will be CloudSec managed. Known values are: "TRUE" and "FALSE". :vartype is_panorama_managed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum + :ivar is_strata_cloud_managed: Strata Cloud Managed: Default is False. Default will be CloudSec + managed. Known values are: "TRUE" and "FALSE". + :vartype is_strata_cloud_managed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum :ivar panorama_config: Panorama Configuration. :vartype panorama_config: ~azure.mgmt.paloaltonetworksngfw.models.PanoramaConfig + :ivar strata_cloud_manager_config: Strata Cloud Manager Configuration, only applicable if + Strata Cloud Manager is selected. + :vartype strata_cloud_manager_config: + ~azure.mgmt.paloaltonetworksngfw.models.StrataCloudManagerConfig :ivar associated_rulestack: Associated Rulestack. :vartype associated_rulestack: ~azure.mgmt.paloaltonetworksngfw.models.RulestackDetails :ivar dns_settings: DNS settings for Firewall. Required. @@ -1193,7 +1209,12 @@ class FirewallResource(TrackedResource): # pylint: disable=too-many-instance-at "pan_etag": {"key": "properties.panEtag", "type": "str"}, "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfile"}, "is_panorama_managed": {"key": "properties.isPanoramaManaged", "type": "str"}, + "is_strata_cloud_managed": {"key": "properties.isStrataCloudManaged", "type": "str"}, "panorama_config": {"key": "properties.panoramaConfig", "type": "PanoramaConfig"}, + "strata_cloud_manager_config": { + "key": "properties.strataCloudManagerConfig", + "type": "StrataCloudManagerConfig", + }, "associated_rulestack": {"key": "properties.associatedRulestack", "type": "RulestackDetails"}, "dns_settings": {"key": "properties.dnsSettings", "type": "DNSSettings"}, "front_end_settings": {"key": "properties.frontEndSettings", "type": "[FrontendSetting]"}, @@ -1210,13 +1231,15 @@ def __init__( dns_settings: "_models.DNSSettings", plan_data: "_models.PlanData", marketplace_details: "_models.MarketplaceDetails", - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, identity: Optional["_models.AzureResourceManagerManagedIdentityProperties"] = None, pan_etag: Optional[str] = None, is_panorama_managed: Optional[Union[str, "_models.BooleanEnum"]] = None, + is_strata_cloud_managed: Optional[Union[str, "_models.BooleanEnum"]] = None, panorama_config: Optional["_models.PanoramaConfig"] = None, + strata_cloud_manager_config: Optional["_models.StrataCloudManagerConfig"] = None, associated_rulestack: Optional["_models.RulestackDetails"] = None, - front_end_settings: Optional[List["_models.FrontendSetting"]] = None, + front_end_settings: Optional[list["_models.FrontendSetting"]] = None, **kwargs: Any ) -> None: """ @@ -1234,8 +1257,15 @@ def __init__( :keyword is_panorama_managed: Panorama Managed: Default is False. Default will be CloudSec managed. Known values are: "TRUE" and "FALSE". :paramtype is_panorama_managed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum + :keyword is_strata_cloud_managed: Strata Cloud Managed: Default is False. Default will be + CloudSec managed. Known values are: "TRUE" and "FALSE". + :paramtype is_strata_cloud_managed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum :keyword panorama_config: Panorama Configuration. :paramtype panorama_config: ~azure.mgmt.paloaltonetworksngfw.models.PanoramaConfig + :keyword strata_cloud_manager_config: Strata Cloud Manager Configuration, only applicable if + Strata Cloud Manager is selected. + :paramtype strata_cloud_manager_config: + ~azure.mgmt.paloaltonetworksngfw.models.StrataCloudManagerConfig :keyword associated_rulestack: Associated Rulestack. :paramtype associated_rulestack: ~azure.mgmt.paloaltonetworksngfw.models.RulestackDetails :keyword dns_settings: DNS settings for Firewall. Required. @@ -1252,11 +1282,13 @@ def __init__( self.pan_etag = pan_etag self.network_profile = network_profile self.is_panorama_managed = is_panorama_managed + self.is_strata_cloud_managed = is_strata_cloud_managed self.panorama_config = panorama_config + self.strata_cloud_manager_config = strata_cloud_manager_config self.associated_rulestack = associated_rulestack self.dns_settings = dns_settings self.front_end_settings = front_end_settings - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None self.plan_data = plan_data self.marketplace_details = marketplace_details @@ -1264,9 +1296,9 @@ def __init__( class FirewallResourceListResult(_serialization.Model): """The response of a FirewallResource list operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar value: The items on this page. Required. + :ivar value: The FirewallResource items on this page. Required. :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] :ivar next_link: The link to the next page of items. :vartype next_link: str @@ -1282,10 +1314,10 @@ class FirewallResourceListResult(_serialization.Model): } def __init__( - self, *, value: List["_models.FirewallResource"], next_link: Optional[str] = None, **kwargs: Any + self, *, value: list["_models.FirewallResource"], next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword value: The items on this page. Required. + :keyword value: The FirewallResource items on this page. Required. :paramtype value: list[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] :keyword next_link: The link to the next page of items. :paramtype next_link: str @@ -1317,7 +1349,7 @@ def __init__( self, *, identity: Optional["_models.AzureResourceManagerManagedIdentityProperties"] = None, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, properties: Optional["_models.FirewallResourceUpdateProperties"] = None, **kwargs: Any ) -> None: @@ -1346,8 +1378,15 @@ class FirewallResourceUpdateProperties(_serialization.Model): :ivar is_panorama_managed: Panorama Managed: Default is False. Default will be CloudSec managed. Known values are: "TRUE" and "FALSE". :vartype is_panorama_managed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum + :ivar is_strata_cloud_managed: Strata Cloud Managed: Default is False. Default will be CloudSec + managed. Known values are: "TRUE" and "FALSE". + :vartype is_strata_cloud_managed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum :ivar panorama_config: Panorama Configuration. :vartype panorama_config: ~azure.mgmt.paloaltonetworksngfw.models.PanoramaConfig + :ivar strata_cloud_manager_config: Strata Cloud Manager Configuration, only applicable if + Strata Cloud Manager is selected. + :vartype strata_cloud_manager_config: + ~azure.mgmt.paloaltonetworksngfw.models.StrataCloudManagerConfig :ivar associated_rulestack: Associated Rulestack. :vartype associated_rulestack: ~azure.mgmt.paloaltonetworksngfw.models.RulestackDetails :ivar dns_settings: DNS settings for Firewall. @@ -1364,7 +1403,9 @@ class FirewallResourceUpdateProperties(_serialization.Model): "pan_etag": {"key": "panEtag", "type": "str"}, "network_profile": {"key": "networkProfile", "type": "NetworkProfile"}, "is_panorama_managed": {"key": "isPanoramaManaged", "type": "str"}, + "is_strata_cloud_managed": {"key": "isStrataCloudManaged", "type": "str"}, "panorama_config": {"key": "panoramaConfig", "type": "PanoramaConfig"}, + "strata_cloud_manager_config": {"key": "strataCloudManagerConfig", "type": "StrataCloudManagerConfig"}, "associated_rulestack": {"key": "associatedRulestack", "type": "RulestackDetails"}, "dns_settings": {"key": "dnsSettings", "type": "DNSSettings"}, "front_end_settings": {"key": "frontEndSettings", "type": "[FrontendSetting]"}, @@ -1378,10 +1419,12 @@ def __init__( pan_etag: Optional[str] = None, network_profile: Optional["_models.NetworkProfile"] = None, is_panorama_managed: Optional[Union[str, "_models.BooleanEnum"]] = None, + is_strata_cloud_managed: Optional[Union[str, "_models.BooleanEnum"]] = None, panorama_config: Optional["_models.PanoramaConfig"] = None, + strata_cloud_manager_config: Optional["_models.StrataCloudManagerConfig"] = None, associated_rulestack: Optional["_models.RulestackDetails"] = None, dns_settings: Optional["_models.DNSSettings"] = None, - front_end_settings: Optional[List["_models.FrontendSetting"]] = None, + front_end_settings: Optional[list["_models.FrontendSetting"]] = None, plan_data: Optional["_models.PlanData"] = None, marketplace_details: Optional["_models.MarketplaceDetails"] = None, **kwargs: Any @@ -1394,8 +1437,15 @@ def __init__( :keyword is_panorama_managed: Panorama Managed: Default is False. Default will be CloudSec managed. Known values are: "TRUE" and "FALSE". :paramtype is_panorama_managed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum + :keyword is_strata_cloud_managed: Strata Cloud Managed: Default is False. Default will be + CloudSec managed. Known values are: "TRUE" and "FALSE". + :paramtype is_strata_cloud_managed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum :keyword panorama_config: Panorama Configuration. :paramtype panorama_config: ~azure.mgmt.paloaltonetworksngfw.models.PanoramaConfig + :keyword strata_cloud_manager_config: Strata Cloud Manager Configuration, only applicable if + Strata Cloud Manager is selected. + :paramtype strata_cloud_manager_config: + ~azure.mgmt.paloaltonetworksngfw.models.StrataCloudManagerConfig :keyword associated_rulestack: Associated Rulestack. :paramtype associated_rulestack: ~azure.mgmt.paloaltonetworksngfw.models.RulestackDetails :keyword dns_settings: DNS settings for Firewall. @@ -1411,7 +1461,9 @@ def __init__( self.pan_etag = pan_etag self.network_profile = network_profile self.is_panorama_managed = is_panorama_managed + self.is_strata_cloud_managed = is_strata_cloud_managed self.panorama_config = panorama_config + self.strata_cloud_manager_config = strata_cloud_manager_config self.associated_rulestack = associated_rulestack self.dns_settings = dns_settings self.front_end_settings = front_end_settings @@ -1449,6 +1501,12 @@ class FirewallStatusResource(ProxyResource): "Failed", and "Deleted". :vartype provisioning_state: str or ~azure.mgmt.paloaltonetworksngfw.models.ReadOnlyProvisioningState + :ivar is_strata_cloud_managed: Strata Cloud Manager. Known values are: "TRUE" and "FALSE". + :vartype is_strata_cloud_managed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum + :ivar strata_cloud_manager_info: This field is only present if Strata Cloud Manager is managing + the policy for this firewall. + :vartype strata_cloud_manager_info: + ~azure.mgmt.paloaltonetworksngfw.models.StrataCloudManagerInfo """ _validation = { @@ -1461,6 +1519,7 @@ class FirewallStatusResource(ProxyResource): "health_reason": {"readonly": True}, "panorama_status": {"readonly": True}, "provisioning_state": {"readonly": True}, + "is_strata_cloud_managed": {"readonly": True}, } _attribute_map = { @@ -1473,24 +1532,35 @@ class FirewallStatusResource(ProxyResource): "health_reason": {"key": "properties.healthReason", "type": "str"}, "panorama_status": {"key": "properties.panoramaStatus", "type": "PanoramaStatus"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "is_strata_cloud_managed": {"key": "properties.isStrataCloudManaged", "type": "str"}, + "strata_cloud_manager_info": {"key": "properties.strataCloudManagerInfo", "type": "StrataCloudManagerInfo"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, *, strata_cloud_manager_info: Optional["_models.StrataCloudManagerInfo"] = None, **kwargs: Any + ) -> None: + """ + :keyword strata_cloud_manager_info: This field is only present if Strata Cloud Manager is + managing the policy for this firewall. + :paramtype strata_cloud_manager_info: + ~azure.mgmt.paloaltonetworksngfw.models.StrataCloudManagerInfo + """ super().__init__(**kwargs) - self.is_panorama_managed = None - self.health_status = None - self.health_reason = None - self.panorama_status = None - self.provisioning_state = None + self.is_panorama_managed: Optional[Union[str, "_models.BooleanEnum"]] = None + self.health_status: Optional[Union[str, "_models.HealthStatus"]] = None + self.health_reason: Optional[str] = None + self.panorama_status: Optional["_models.PanoramaStatus"] = None + self.provisioning_state: Optional[Union[str, "_models.ReadOnlyProvisioningState"]] = None + self.is_strata_cloud_managed: Optional[Union[str, "_models.BooleanEnum"]] = None + self.strata_cloud_manager_info = strata_cloud_manager_info class FirewallStatusResourceListResult(_serialization.Model): """The response of a FirewallStatusResource list operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar value: The items on this page. Required. + :ivar value: The FirewallStatusResource items on this page. Required. :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.FirewallStatusResource] :ivar next_link: The link to the next page of items. :vartype next_link: str @@ -1506,10 +1576,10 @@ class FirewallStatusResourceListResult(_serialization.Model): } def __init__( - self, *, value: List["_models.FirewallStatusResource"], next_link: Optional[str] = None, **kwargs: Any + self, *, value: list["_models.FirewallStatusResource"], next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword value: The items on this page. Required. + :keyword value: The FirewallStatusResource items on this page. Required. :paramtype value: list[~azure.mgmt.paloaltonetworksngfw.models.FirewallStatusResource] :keyword next_link: The link to the next page of items. :paramtype next_link: str @@ -1524,7 +1594,7 @@ class FqdnListGlobalRulestackResource(ProxyResource): 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 Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -1575,7 +1645,7 @@ class FqdnListGlobalRulestackResource(ProxyResource): def __init__( self, *, - fqdn_list: List[str], + fqdn_list: list[str], description: Optional[str] = None, etag: Optional[str] = None, audit_comment: Optional[str] = None, @@ -1596,15 +1666,15 @@ def __init__( self.fqdn_list = fqdn_list self.etag = etag self.audit_comment = audit_comment - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None -class FqdnListGlobalRulestackResourceListResult(_serialization.Model): +class FqdnListGlobalRulestackResourceListResult(_serialization.Model): # pylint: disable=name-too-long """The response of a FqdnListGlobalRulestackResource list operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar value: The items on this page. Required. + :ivar value: The FqdnListGlobalRulestackResource items on this page. Required. :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource] :ivar next_link: The link to the next page of items. :vartype next_link: str @@ -1620,10 +1690,10 @@ class FqdnListGlobalRulestackResourceListResult(_serialization.Model): } def __init__( - self, *, value: List["_models.FqdnListGlobalRulestackResource"], next_link: Optional[str] = None, **kwargs: Any + self, *, value: list["_models.FqdnListGlobalRulestackResource"], next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword value: The items on this page. Required. + :keyword value: The FqdnListGlobalRulestackResource items on this page. Required. :paramtype value: list[~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource] :keyword next_link: The link to the next page of items. :paramtype next_link: str @@ -1638,7 +1708,7 @@ class FqdnListLocalRulestackResource(ProxyResource): 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 Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -1689,7 +1759,7 @@ class FqdnListLocalRulestackResource(ProxyResource): def __init__( self, *, - fqdn_list: List[str], + fqdn_list: list[str], description: Optional[str] = None, etag: Optional[str] = None, audit_comment: Optional[str] = None, @@ -1710,15 +1780,15 @@ def __init__( self.fqdn_list = fqdn_list self.etag = etag self.audit_comment = audit_comment - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None class FqdnListLocalRulestackResourceListResult(_serialization.Model): """The response of a FqdnListLocalRulestackResource list operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar value: The items on this page. Required. + :ivar value: The FqdnListLocalRulestackResource items on this page. Required. :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource] :ivar next_link: The link to the next page of items. :vartype next_link: str @@ -1734,10 +1804,10 @@ class FqdnListLocalRulestackResourceListResult(_serialization.Model): } def __init__( - self, *, value: List["_models.FqdnListLocalRulestackResource"], next_link: Optional[str] = None, **kwargs: Any + self, *, value: list["_models.FqdnListLocalRulestackResource"], next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword value: The items on this page. Required. + :keyword value: The FqdnListLocalRulestackResource items on this page. Required. :paramtype value: list[~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource] :keyword next_link: The link to the next page of items. :paramtype next_link: str @@ -1750,7 +1820,7 @@ def __init__( class FrontendSetting(_serialization.Model): """Frontend setting for Firewall. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: Settings name. Required. :vartype name: str @@ -1806,7 +1876,7 @@ def __init__( class GlobalRulestackInfo(_serialization.Model): """PAN Rulestack Describe Object. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar azure_id: rulestack description. Required. :vartype azure_id: str @@ -1829,12 +1899,12 @@ def __init__(self, *, azure_id: str, **kwargs: Any) -> None: self.azure_id = azure_id -class GlobalRulestackResource(ProxyResource): # pylint: disable=too-many-instance-attributes +class GlobalRulestackResource(ProxyResource): """PaloAltoNetworks GlobalRulestack. 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 Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -1910,7 +1980,7 @@ def __init__( pan_etag: Optional[str] = None, pan_location: Optional[str] = None, scope: Optional[Union[str, "_models.ScopeType"]] = None, - associated_subscriptions: Optional[List[str]] = None, + associated_subscriptions: Optional[list[str]] = None, description: Optional[str] = None, default_mode: Optional[Union[str, "_models.DefaultMode"]] = None, min_app_id_version: Optional[str] = None, @@ -1952,16 +2022,16 @@ def __init__( self.description = description self.default_mode = default_mode self.min_app_id_version = min_app_id_version - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None self.security_services = security_services class GlobalRulestackResourceListResult(_serialization.Model): """The response of a GlobalRulestackResource list operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar value: The items on this page. Required. + :ivar value: The GlobalRulestackResource items on this page. Required. :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource] :ivar next_link: The link to the next page of items. :vartype next_link: str @@ -1977,10 +2047,10 @@ class GlobalRulestackResourceListResult(_serialization.Model): } def __init__( - self, *, value: List["_models.GlobalRulestackResource"], next_link: Optional[str] = None, **kwargs: Any + self, *, value: list["_models.GlobalRulestackResource"], next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword value: The items on this page. Required. + :keyword value: The GlobalRulestackResource items on this page. Required. :paramtype value: list[~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource] :keyword next_link: The link to the next page of items. :paramtype next_link: str @@ -2072,7 +2142,7 @@ def __init__( pan_etag: Optional[str] = None, pan_location: Optional[str] = None, scope: Optional[Union[str, "_models.ScopeType"]] = None, - associated_subscriptions: Optional[List[str]] = None, + associated_subscriptions: Optional[list[str]] = None, description: Optional[str] = None, default_mode: Optional[Union[str, "_models.DefaultMode"]] = None, min_app_id_version: Optional[str] = None, @@ -2167,11 +2237,11 @@ def __init__( class ListAppIdResponse(_serialization.Model): """ListAppIdResponse. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar value: List of AppIds. Required. + :ivar value: Required. :vartype value: list[str] - :ivar next_link: next Link. + :ivar next_link: :vartype next_link: str """ @@ -2184,11 +2254,11 @@ class ListAppIdResponse(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List[str], next_link: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, value: list[str], next_link: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword value: List of AppIds. Required. + :keyword value: Required. :paramtype value: list[str] - :keyword next_link: next Link. + :keyword next_link: :paramtype next_link: str """ super().__init__(**kwargs) @@ -2199,7 +2269,7 @@ def __init__(self, *, value: List[str], next_link: Optional[str] = None, **kwarg class ListFirewallsResponse(_serialization.Model): """List firewalls response. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: firewalls list. Required. :vartype value: list[str] @@ -2216,7 +2286,7 @@ class ListFirewallsResponse(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List[str], next_link: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, value: list[str], next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: firewalls list. Required. :paramtype value: list[str] @@ -2228,12 +2298,12 @@ def __init__(self, *, value: List[str], next_link: Optional[str] = None, **kwarg self.next_link = next_link -class LocalRulesResource(ProxyResource): # pylint: disable=too-many-instance-attributes +class LocalRulesResource(ProxyResource): """LocalRulestack rule list. 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 Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -2341,16 +2411,16 @@ def __init__( # pylint: disable=too-many-locals negate_source: Optional[Union[str, "_models.BooleanEnum"]] = None, destination: Optional["_models.DestinationAddr"] = None, negate_destination: Optional[Union[str, "_models.BooleanEnum"]] = None, - applications: Optional[List[str]] = None, + applications: Optional[list[str]] = None, category: Optional["_models.Category"] = None, protocol: str = "application-default", - protocol_port_list: Optional[List[str]] = None, + protocol_port_list: Optional[list[str]] = None, inbound_inspection_certificate: Optional[str] = None, audit_comment: Optional[str] = None, action_type: Optional[Union[str, "_models.ActionEnum"]] = None, enable_logging: Optional[Union[str, "_models.StateEnum"]] = None, decryption_rule_type: Optional[Union[str, "_models.DecryptionRuleTypeEnum"]] = None, - tags: Optional[List["_models.TagInfo"]] = None, + tags: Optional[list["_models.TagInfo"]] = None, **kwargs: Any ) -> None: """ @@ -2397,7 +2467,7 @@ def __init__( # pylint: disable=too-many-locals super().__init__(**kwargs) self.etag = etag self.rule_name = rule_name - self.priority = None + self.priority: Optional[int] = None self.description = description self.rule_state = rule_state self.source = source @@ -2414,15 +2484,15 @@ def __init__( # pylint: disable=too-many-locals self.enable_logging = enable_logging self.decryption_rule_type = decryption_rule_type self.tags = tags - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None class LocalRulesResourceListResult(_serialization.Model): """The response of a LocalRulesResource list operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar value: The items on this page. Required. + :ivar value: The LocalRulesResource items on this page. Required. :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource] :ivar next_link: The link to the next page of items. :vartype next_link: str @@ -2438,10 +2508,10 @@ class LocalRulesResourceListResult(_serialization.Model): } def __init__( - self, *, value: List["_models.LocalRulesResource"], next_link: Optional[str] = None, **kwargs: Any + self, *, value: list["_models.LocalRulesResource"], next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword value: The items on this page. Required. + :keyword value: The LocalRulesResource items on this page. Required. :paramtype value: list[~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource] :keyword next_link: The link to the next page of items. :paramtype next_link: str @@ -2451,12 +2521,12 @@ def __init__( self.next_link = next_link -class LocalRulestackResource(TrackedResource): # pylint: disable=too-many-instance-attributes +class LocalRulestackResource(TrackedResource): """PaloAltoNetworks LocalRulestack. 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 Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -2531,12 +2601,12 @@ def __init__( self, *, location: str, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, identity: Optional["_models.AzureResourceManagerManagedIdentityProperties"] = None, pan_etag: Optional[str] = None, pan_location: Optional[str] = None, scope: Optional[Union[str, "_models.ScopeType"]] = None, - associated_subscriptions: Optional[List[str]] = None, + associated_subscriptions: Optional[list[str]] = None, description: Optional[str] = None, default_mode: Optional[Union[str, "_models.DefaultMode"]] = None, min_app_id_version: Optional[str] = None, @@ -2579,16 +2649,16 @@ def __init__( self.description = description self.default_mode = default_mode self.min_app_id_version = min_app_id_version - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None self.security_services = security_services class LocalRulestackResourceListResult(_serialization.Model): """The response of a LocalRulestackResource list operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar value: The items on this page. Required. + :ivar value: The LocalRulestackResource items on this page. Required. :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource] :ivar next_link: The link to the next page of items. :vartype next_link: str @@ -2604,10 +2674,10 @@ class LocalRulestackResourceListResult(_serialization.Model): } def __init__( - self, *, value: List["_models.LocalRulestackResource"], next_link: Optional[str] = None, **kwargs: Any + self, *, value: list["_models.LocalRulestackResource"], next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword value: The items on this page. Required. + :keyword value: The LocalRulestackResource items on this page. Required. :paramtype value: list[~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource] :keyword next_link: The link to the next page of items. :paramtype next_link: str @@ -2640,7 +2710,7 @@ def __init__( self, *, identity: Optional["_models.AzureResourceManagerManagedIdentityProperties"] = None, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, properties: Optional["_models.LocalRulestackResourceUpdateProperties"] = None, **kwargs: Any ) -> None: @@ -2699,7 +2769,7 @@ def __init__( pan_etag: Optional[str] = None, pan_location: Optional[str] = None, scope: Optional[Union[str, "_models.ScopeType"]] = None, - associated_subscriptions: Optional[List[str]] = None, + associated_subscriptions: Optional[list[str]] = None, description: Optional[str] = None, default_mode: Optional[Union[str, "_models.DefaultMode"]] = None, min_app_id_version: Optional[str] = None, @@ -2852,7 +2922,7 @@ class MarketplaceDetails(_serialization.Model): 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 Azure. + All required parameters must be populated in order to send to server. :ivar marketplace_subscription_id: Marketplace Subscription Id. :vartype marketplace_subscription_id: str @@ -2900,12 +2970,126 @@ def __init__( ~azure.mgmt.paloaltonetworksngfw.models.MarketplaceSubscriptionStatus """ super().__init__(**kwargs) - self.marketplace_subscription_id = None + self.marketplace_subscription_id: Optional[str] = None self.offer_id = offer_id self.publisher_id = publisher_id self.marketplace_subscription_status = marketplace_subscription_status +class MetricsObjectFirewallResource(ProxyResource): + """Firewall Metrics Object. + + 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. 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.paloaltonetworksngfw.models.SystemData + :ivar application_insights_resource_id: Resource Id of application insights resource. Required. + :vartype application_insights_resource_id: str + :ivar application_insights_connection_string: Connection string of application insights + resource. Required. + :vartype application_insights_connection_string: str + :ivar pan_etag: read only string representing last create or update. + :vartype pan_etag: str + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Accepted", + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", and + "NotSpecified". + :vartype provisioning_state: str or ~azure.mgmt.paloaltonetworksngfw.models.ProvisioningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "application_insights_resource_id": {"required": True}, + "application_insights_connection_string": {"required": True}, + "provisioning_state": {"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"}, + "application_insights_resource_id": {"key": "properties.applicationInsightsResourceId", "type": "str"}, + "application_insights_connection_string": { + "key": "properties.applicationInsightsConnectionString", + "type": "str", + }, + "pan_etag": {"key": "properties.panEtag", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + application_insights_resource_id: str, + application_insights_connection_string: str, + pan_etag: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword application_insights_resource_id: Resource Id of application insights resource. + Required. + :paramtype application_insights_resource_id: str + :keyword application_insights_connection_string: Connection string of application insights + resource. Required. + :paramtype application_insights_connection_string: str + :keyword pan_etag: read only string representing last create or update. + :paramtype pan_etag: str + """ + super().__init__(**kwargs) + self.application_insights_resource_id = application_insights_resource_id + self.application_insights_connection_string = application_insights_connection_string + self.pan_etag = pan_etag + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None + + +class MetricsObjectFirewallResourceListResult(_serialization.Model): + """The response of a MetricsObjectFirewallResource list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The MetricsObjectFirewallResource items on this page. Required. + :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.MetricsObjectFirewallResource] + :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": "[MetricsObjectFirewallResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: list["_models.MetricsObjectFirewallResource"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The MetricsObjectFirewallResource items on this page. Required. + :paramtype value: list[~azure.mgmt.paloaltonetworksngfw.models.MetricsObjectFirewallResource] + :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 MonitorLog(_serialization.Model): """MonitorLog configurations. @@ -2962,7 +3146,7 @@ def __init__( class NameDescriptionObject(_serialization.Model): """object type info. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: name value. Required. :vartype name: str @@ -2994,7 +3178,7 @@ def __init__(self, *, name: str, description: Optional[str] = None, **kwargs: An class NetworkProfile(_serialization.Model): """Network settings for Firewall. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar vnet_configuration: Vnet configurations. :vartype vnet_configuration: ~azure.mgmt.paloaltonetworksngfw.models.VnetConfiguration @@ -3012,6 +3196,9 @@ class NetworkProfile(_serialization.Model): :vartype egress_nat_ip: list[~azure.mgmt.paloaltonetworksngfw.models.IPAddress] :ivar trusted_ranges: Non-RFC 1918 address. :vartype trusted_ranges: list[str] + :ivar private_source_nat_rules_destination: Array of ipv4 destination address for which source + NAT is to be performed. + :vartype private_source_nat_rules_destination: list[str] """ _validation = { @@ -3028,18 +3215,20 @@ class NetworkProfile(_serialization.Model): "enable_egress_nat": {"key": "enableEgressNat", "type": "str"}, "egress_nat_ip": {"key": "egressNatIp", "type": "[IPAddress]"}, "trusted_ranges": {"key": "trustedRanges", "type": "[str]"}, + "private_source_nat_rules_destination": {"key": "privateSourceNatRulesDestination", "type": "[str]"}, } def __init__( self, *, network_type: Union[str, "_models.NetworkType"], - public_ips: List["_models.IPAddress"], + public_ips: list["_models.IPAddress"], enable_egress_nat: Union[str, "_models.EgressNat"], vnet_configuration: Optional["_models.VnetConfiguration"] = None, vwan_configuration: Optional["_models.VwanConfiguration"] = None, - egress_nat_ip: Optional[List["_models.IPAddress"]] = None, - trusted_ranges: Optional[List[str]] = None, + egress_nat_ip: Optional[list["_models.IPAddress"]] = None, + trusted_ranges: Optional[list[str]] = None, + private_source_nat_rules_destination: Optional[list[str]] = None, **kwargs: Any ) -> None: """ @@ -3059,6 +3248,9 @@ def __init__( :paramtype egress_nat_ip: list[~azure.mgmt.paloaltonetworksngfw.models.IPAddress] :keyword trusted_ranges: Non-RFC 1918 address. :paramtype trusted_ranges: list[str] + :keyword private_source_nat_rules_destination: Array of ipv4 destination address for which + source NAT is to be performed. + :paramtype private_source_nat_rules_destination: list[str] """ super().__init__(**kwargs) self.vnet_configuration = vnet_configuration @@ -3068,6 +3260,7 @@ def __init__( self.enable_egress_nat = enable_egress_nat self.egress_nat_ip = egress_nat_ip self.trusted_ranges = trusted_ranges + self.private_source_nat_rules_destination = private_source_nat_rules_destination class Operation(_serialization.Model): @@ -3113,11 +3306,11 @@ def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kw :paramtype display: ~azure.mgmt.paloaltonetworksngfw.models.OperationDisplay """ super().__init__(**kwargs) - self.name = None - self.is_data_action = None + self.name: Optional[str] = None + self.is_data_action: Optional[bool] = None self.display = display - self.origin = None - self.action_type = None + self.origin: Optional[Union[str, "_models.Origin"]] = None + self.action_type: Optional[Union[str, "_models.ActionType"]] = None class OperationDisplay(_serialization.Model): @@ -3156,10 +3349,10 @@ class OperationDisplay(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None - self.description = None + self.provider: Optional[str] = None + self.resource: Optional[str] = None + self.operation: Optional[str] = None + self.description: Optional[str] = None class OperationListResult(_serialization.Model): @@ -3187,8 +3380,8 @@ class OperationListResult(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.value: Optional[list["_models.Operation"]] = None + self.next_link: Optional[str] = None class PanoramaConfig(_serialization.Model): @@ -3196,7 +3389,7 @@ class PanoramaConfig(_serialization.Model): 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 Azure. + All required parameters must be populated in order to send to server. :ivar config_string: Base64 encoded string representing Panorama parameters to be used by Firewall to connect to Panorama. This string is generated via azure plugin in Panorama. @@ -3249,13 +3442,13 @@ def __init__(self, *, config_string: str, **kwargs: Any) -> None: """ super().__init__(**kwargs) self.config_string = config_string - self.vm_auth_key = None - self.panorama_server = None - self.panorama_server2 = None - self.dg_name = None - self.tpl_name = None - self.cg_name = None - self.host_name = None + self.vm_auth_key: Optional[str] = None + self.panorama_server: Optional[str] = None + self.panorama_server2: Optional[str] = None + self.dg_name: Optional[str] = None + self.tpl_name: Optional[str] = None + self.cg_name: Optional[str] = None + self.host_name: Optional[str] = None class PanoramaStatus(_serialization.Model): @@ -3284,8 +3477,8 @@ class PanoramaStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.panorama_server_status = None - self.panorama_server2_status = None + self.panorama_server_status: Optional[Union[str, "_models.ServerStatus"]] = None + self.panorama_server2_status: Optional[Union[str, "_models.ServerStatus"]] = None class PlanData(_serialization.Model): @@ -3293,7 +3486,7 @@ class PlanData(_serialization.Model): 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 Azure. + All required parameters must be populated in order to send to server. :ivar usage_type: different usage type like PAYG/COMMITTED. Known values are: "PAYG" and "COMMITTED". @@ -3342,15 +3535,15 @@ def __init__( self.usage_type = usage_type self.billing_cycle = billing_cycle self.plan_id = plan_id - self.effective_date = None + self.effective_date: Optional[datetime.datetime] = None -class PostRulesResource(ProxyResource): # pylint: disable=too-many-instance-attributes +class PostRulesResource(ProxyResource): """PostRulestack rule list. 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 Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -3458,16 +3651,16 @@ def __init__( # pylint: disable=too-many-locals negate_source: Optional[Union[str, "_models.BooleanEnum"]] = None, destination: Optional["_models.DestinationAddr"] = None, negate_destination: Optional[Union[str, "_models.BooleanEnum"]] = None, - applications: Optional[List[str]] = None, + applications: Optional[list[str]] = None, category: Optional["_models.Category"] = None, protocol: str = "application-default", - protocol_port_list: Optional[List[str]] = None, + protocol_port_list: Optional[list[str]] = None, inbound_inspection_certificate: Optional[str] = None, audit_comment: Optional[str] = None, action_type: Optional[Union[str, "_models.ActionEnum"]] = None, enable_logging: Optional[Union[str, "_models.StateEnum"]] = None, decryption_rule_type: Optional[Union[str, "_models.DecryptionRuleTypeEnum"]] = None, - tags: Optional[List["_models.TagInfo"]] = None, + tags: Optional[list["_models.TagInfo"]] = None, **kwargs: Any ) -> None: """ @@ -3514,7 +3707,7 @@ def __init__( # pylint: disable=too-many-locals super().__init__(**kwargs) self.etag = etag self.rule_name = rule_name - self.priority = None + self.priority: Optional[int] = None self.description = description self.rule_state = rule_state self.source = source @@ -3531,15 +3724,15 @@ def __init__( # pylint: disable=too-many-locals self.enable_logging = enable_logging self.decryption_rule_type = decryption_rule_type self.tags = tags - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None class PostRulesResourceListResult(_serialization.Model): """The response of a PostRulesResource list operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar value: The items on this page. Required. + :ivar value: The PostRulesResource items on this page. Required. :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource] :ivar next_link: The link to the next page of items. :vartype next_link: str @@ -3555,10 +3748,10 @@ class PostRulesResourceListResult(_serialization.Model): } def __init__( - self, *, value: List["_models.PostRulesResource"], next_link: Optional[str] = None, **kwargs: Any + self, *, value: list["_models.PostRulesResource"], next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword value: The items on this page. Required. + :keyword value: The PostRulesResource items on this page. Required. :paramtype value: list[~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource] :keyword next_link: The link to the next page of items. :paramtype next_link: str @@ -3571,11 +3764,11 @@ def __init__( class PredefinedUrlCategoriesResponse(_serialization.Model): """predefined url categories response. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar value: predefined url categories. Required. + :ivar value: The PredefinedUrlCategory items on this page. Required. :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.PredefinedUrlCategory] - :ivar next_link: next link. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ @@ -3589,12 +3782,12 @@ class PredefinedUrlCategoriesResponse(_serialization.Model): } def __init__( - self, *, value: List["_models.PredefinedUrlCategory"], next_link: Optional[str] = None, **kwargs: Any + self, *, value: list["_models.PredefinedUrlCategory"], next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword value: predefined url categories. Required. + :keyword value: The PredefinedUrlCategory items on this page. Required. :paramtype value: list[~azure.mgmt.paloaltonetworksngfw.models.PredefinedUrlCategory] - :keyword next_link: next link. + :keyword next_link: The link to the next page of items. :paramtype next_link: str """ super().__init__(**kwargs) @@ -3605,7 +3798,7 @@ def __init__( class PredefinedUrlCategory(_serialization.Model): """Predefined URL category object. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar action: Required. :vartype action: str @@ -3640,7 +3833,7 @@ class PrefixListGlobalRulestackResource(ProxyResource): 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 Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -3691,7 +3884,7 @@ class PrefixListGlobalRulestackResource(ProxyResource): def __init__( self, *, - prefix_list: List[str], + prefix_list: list[str], description: Optional[str] = None, etag: Optional[str] = None, audit_comment: Optional[str] = None, @@ -3712,15 +3905,15 @@ def __init__( self.prefix_list = prefix_list self.etag = etag self.audit_comment = audit_comment - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None -class PrefixListGlobalRulestackResourceListResult(_serialization.Model): +class PrefixListGlobalRulestackResourceListResult(_serialization.Model): # pylint: disable=name-too-long """The response of a PrefixListGlobalRulestackResource list operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar value: The items on this page. Required. + :ivar value: The PrefixListGlobalRulestackResource items on this page. Required. :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource] :ivar next_link: The link to the next page of items. :vartype next_link: str @@ -3738,12 +3931,12 @@ class PrefixListGlobalRulestackResourceListResult(_serialization.Model): def __init__( self, *, - value: List["_models.PrefixListGlobalRulestackResource"], + value: list["_models.PrefixListGlobalRulestackResource"], next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword value: The items on this page. Required. + :keyword value: The PrefixListGlobalRulestackResource items on this page. Required. :paramtype value: list[~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource] :keyword next_link: The link to the next page of items. @@ -3759,7 +3952,7 @@ class PrefixListResource(ProxyResource): 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 Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -3810,7 +4003,7 @@ class PrefixListResource(ProxyResource): def __init__( self, *, - prefix_list: List[str], + prefix_list: list[str], description: Optional[str] = None, etag: Optional[str] = None, audit_comment: Optional[str] = None, @@ -3831,15 +4024,15 @@ def __init__( self.prefix_list = prefix_list self.etag = etag self.audit_comment = audit_comment - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None class PrefixListResourceListResult(_serialization.Model): """The response of a PrefixListResource list operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar value: The items on this page. Required. + :ivar value: The PrefixListResource items on this page. Required. :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource] :ivar next_link: The link to the next page of items. :vartype next_link: str @@ -3855,10 +4048,10 @@ class PrefixListResourceListResult(_serialization.Model): } def __init__( - self, *, value: List["_models.PrefixListResource"], next_link: Optional[str] = None, **kwargs: Any + self, *, value: list["_models.PrefixListResource"], next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword value: The items on this page. Required. + :keyword value: The PrefixListResource items on this page. Required. :paramtype value: list[~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource] :keyword next_link: The link to the next page of items. :paramtype next_link: str @@ -3868,12 +4061,12 @@ def __init__( self.next_link = next_link -class PreRulesResource(ProxyResource): # pylint: disable=too-many-instance-attributes +class PreRulesResource(ProxyResource): """PreRulestack rule list. 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 Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -3981,16 +4174,16 @@ def __init__( # pylint: disable=too-many-locals negate_source: Optional[Union[str, "_models.BooleanEnum"]] = None, destination: Optional["_models.DestinationAddr"] = None, negate_destination: Optional[Union[str, "_models.BooleanEnum"]] = None, - applications: Optional[List[str]] = None, + applications: Optional[list[str]] = None, category: Optional["_models.Category"] = None, protocol: str = "application-default", - protocol_port_list: Optional[List[str]] = None, + protocol_port_list: Optional[list[str]] = None, inbound_inspection_certificate: Optional[str] = None, audit_comment: Optional[str] = None, action_type: Optional[Union[str, "_models.ActionEnum"]] = None, enable_logging: Optional[Union[str, "_models.StateEnum"]] = None, decryption_rule_type: Optional[Union[str, "_models.DecryptionRuleTypeEnum"]] = None, - tags: Optional[List["_models.TagInfo"]] = None, + tags: Optional[list["_models.TagInfo"]] = None, **kwargs: Any ) -> None: """ @@ -4037,7 +4230,7 @@ def __init__( # pylint: disable=too-many-locals super().__init__(**kwargs) self.etag = etag self.rule_name = rule_name - self.priority = None + self.priority: Optional[int] = None self.description = description self.rule_state = rule_state self.source = source @@ -4054,15 +4247,15 @@ def __init__( # pylint: disable=too-many-locals self.enable_logging = enable_logging self.decryption_rule_type = decryption_rule_type self.tags = tags - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None class PreRulesResourceListResult(_serialization.Model): """The response of a PreRulesResource list operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar value: The items on this page. Required. + :ivar value: The PreRulesResource items on this page. Required. :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource] :ivar next_link: The link to the next page of items. :vartype next_link: str @@ -4078,10 +4271,10 @@ class PreRulesResourceListResult(_serialization.Model): } def __init__( - self, *, value: List["_models.PreRulesResource"], next_link: Optional[str] = None, **kwargs: Any + self, *, value: list["_models.PreRulesResource"], next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword value: The items on this page. Required. + :keyword value: The PreRulesResource items on this page. Required. :paramtype value: list[~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource] :keyword next_link: The link to the next page of items. :paramtype next_link: str @@ -4091,10 +4284,76 @@ def __init__( self.next_link = next_link +class ProductSerialNumberRequestStatus(_serialization.Model): + """Create Product Serial Number Request status. + + All required parameters must be populated in order to send to server. + + :ivar status: allocation status of the product serial number. Required. + :vartype status: str + """ + + _validation = { + "status": {"required": True}, + } + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, *, status: str, **kwargs: Any) -> None: + """ + :keyword status: allocation status of the product serial number. Required. + :paramtype status: str + """ + super().__init__(**kwargs) + self.status = status + + +class ProductSerialNumberStatus(_serialization.Model): + """Product serial and status for the service. + + All required parameters must be populated in order to send to server. + + :ivar serial_number: product Serial associated with given resource. + :vartype serial_number: str + :ivar status: allocation status of the product serial number. Required. Known values are: + "Allocated" and "InProgress". + :vartype status: str or ~azure.mgmt.paloaltonetworksngfw.models.ProductSerialStatusValues + """ + + _validation = { + "status": {"required": True}, + } + + _attribute_map = { + "serial_number": {"key": "serialNumber", "type": "str"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__( + self, + *, + status: Union[str, "_models.ProductSerialStatusValues"], + serial_number: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword serial_number: product Serial associated with given resource. + :paramtype serial_number: str + :keyword status: allocation status of the product serial number. Required. Known values are: + "Allocated" and "InProgress". + :paramtype status: str or ~azure.mgmt.paloaltonetworksngfw.models.ProductSerialStatusValues + """ + super().__init__(**kwargs) + self.serial_number = serial_number + self.status = status + + class RuleCounter(_serialization.Model): """Rule counter. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar priority: priority number. Required. :vartype priority: str @@ -4235,7 +4494,7 @@ def __init__( :paramtype rule_name: str """ super().__init__(**kwargs) - self.priority = None + self.priority: Optional[str] = None self.rule_stack_name = rule_stack_name self.rule_list_name = rule_list_name self.firewall_name = firewall_name @@ -4358,7 +4617,7 @@ def __init__( class SecurityServicesResponse(_serialization.Model): """Security services list response. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: response value. Required. :vartype value: ~azure.mgmt.paloaltonetworksngfw.models.SecurityServicesTypeList @@ -4392,7 +4651,7 @@ def __init__( class SecurityServicesTypeList(_serialization.Model): """Security services type list. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar type: security services type. :vartype type: str @@ -4410,7 +4669,7 @@ class SecurityServicesTypeList(_serialization.Model): } def __init__( - self, *, entry: List["_models.NameDescriptionObject"], type: Optional[str] = None, **kwargs: Any + self, *, entry: list["_models.NameDescriptionObject"], type: Optional[str] = None, **kwargs: Any ) -> None: """ :keyword type: security services type. @@ -4446,10 +4705,10 @@ class SourceAddr(_serialization.Model): def __init__( self, *, - cidrs: Optional[List[str]] = None, - countries: Optional[List[str]] = None, - feeds: Optional[List[str]] = None, - prefix_lists: Optional[List[str]] = None, + cidrs: Optional[list[str]] = None, + countries: Optional[list[str]] = None, + feeds: Optional[list[str]] = None, + prefix_lists: Optional[list[str]] = None, **kwargs: Any ) -> None: """ @@ -4508,7 +4767,61 @@ def __init__( self.account_name = account_name -class SupportInfo(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StrataCloudManagerConfig(_serialization.Model): + """This field is only present if Strata Cloud Manager is managing the policy for this firewall. + + All required parameters must be populated in order to send to server. + + :ivar cloud_manager_name: Strata Cloud Manager name which is intended to manage the policy for + this firewall. Required. + :vartype cloud_manager_name: str + """ + + _validation = { + "cloud_manager_name": {"required": True}, + } + + _attribute_map = { + "cloud_manager_name": {"key": "cloudManagerName", "type": "str"}, + } + + def __init__(self, *, cloud_manager_name: str, **kwargs: Any) -> None: + """ + :keyword cloud_manager_name: Strata Cloud Manager name which is intended to manage the policy + for this firewall. Required. + :paramtype cloud_manager_name: str + """ + super().__init__(**kwargs) + self.cloud_manager_name = cloud_manager_name + + +class StrataCloudManagerInfo(_serialization.Model): + """Strata Cloud Manager Info. + + :ivar folder_name: Strata Cloud Manager folder in which this firewall has been placed. + :vartype folder_name: str + :ivar hub_url: URL for Strata Cloud Manager. + :vartype hub_url: str + """ + + _attribute_map = { + "folder_name": {"key": "folderName", "type": "str"}, + "hub_url": {"key": "hubUrl", "type": "str"}, + } + + def __init__(self, *, folder_name: Optional[str] = None, hub_url: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword folder_name: Strata Cloud Manager folder in which this firewall has been placed. + :paramtype folder_name: str + :keyword hub_url: URL for Strata Cloud Manager. + :paramtype hub_url: str + """ + super().__init__(**kwargs) + self.folder_name = folder_name + self.hub_url = hub_url + + +class SupportInfo(_serialization.Model): """Support information for the resource. :ivar product_sku: product SKU associated with given resource. @@ -4617,6 +4930,135 @@ def __init__( self.register_url = register_url +class SupportInfoModel(_serialization.Model): + """Support information for the service. + + :ivar product_sku: product SKU associated with given resource. + :vartype product_sku: str + :ivar product_serial: product Serial associated with given resource. + :vartype product_serial: str + :ivar account_registration_status: account registered in Customer Support Portal. Known values + are: "Registered" and "Not Registered". + :vartype account_registration_status: str or + ~azure.mgmt.paloaltonetworksngfw.models.RegistrationStatus + :ivar account_id: Support account associated with given resource. + :vartype account_id: str + :ivar free_trial: Product usage is in free trial period. Known values are: "Enabled" and + "Disabled". + :vartype free_trial: str or ~azure.mgmt.paloaltonetworksngfw.models.EnableStatus + :ivar free_trial_days_left: Free trial days remaining. + :vartype free_trial_days_left: int + :ivar free_trial_credit_left: Free trial credit remaining. + :vartype free_trial_credit_left: int + :ivar help_url: URL for paloaltonetworks live community. + :vartype help_url: str + :ivar support_url: URL for paloaltonetworks Customer Service Portal. + :vartype support_url: str + :ivar register_url: URL for registering product in paloaltonetworks Customer Service Portal. + :vartype register_url: str + :ivar hub_url: URL for Strata Cloud Manager. + :vartype hub_url: str + :ivar credits: credits purchased, unit per hour. + :vartype credits: int + :ivar monthly_credit_left: monthly credit is computed as credits * days in calendar month. + :vartype monthly_credit_left: int + :ivar start_date_for_credits: date in format yyyy-mm-dd. + :vartype start_date_for_credits: str + :ivar end_date_for_credits: date in format yyyy-mm-dd. + :vartype end_date_for_credits: str + """ + + _attribute_map = { + "product_sku": {"key": "productSku", "type": "str"}, + "product_serial": {"key": "productSerial", "type": "str"}, + "account_registration_status": {"key": "accountRegistrationStatus", "type": "str"}, + "account_id": {"key": "accountId", "type": "str"}, + "free_trial": {"key": "freeTrial", "type": "str"}, + "free_trial_days_left": {"key": "freeTrialDaysLeft", "type": "int"}, + "free_trial_credit_left": {"key": "freeTrialCreditLeft", "type": "int"}, + "help_url": {"key": "helpURL", "type": "str"}, + "support_url": {"key": "supportURL", "type": "str"}, + "register_url": {"key": "registerURL", "type": "str"}, + "hub_url": {"key": "hubUrl", "type": "str"}, + "credits": {"key": "credits", "type": "int"}, + "monthly_credit_left": {"key": "monthlyCreditLeft", "type": "int"}, + "start_date_for_credits": {"key": "startDateForCredits", "type": "str"}, + "end_date_for_credits": {"key": "endDateForCredits", "type": "str"}, + } + + def __init__( + self, + *, + product_sku: Optional[str] = None, + product_serial: Optional[str] = None, + account_registration_status: Optional[Union[str, "_models.RegistrationStatus"]] = None, + account_id: Optional[str] = None, + free_trial: Optional[Union[str, "_models.EnableStatus"]] = None, + free_trial_days_left: Optional[int] = None, + free_trial_credit_left: Optional[int] = None, + help_url: Optional[str] = None, + support_url: Optional[str] = None, + register_url: Optional[str] = None, + hub_url: Optional[str] = None, + credits: Optional[int] = None, + monthly_credit_left: Optional[int] = None, + start_date_for_credits: Optional[str] = None, + end_date_for_credits: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword product_sku: product SKU associated with given resource. + :paramtype product_sku: str + :keyword product_serial: product Serial associated with given resource. + :paramtype product_serial: str + :keyword account_registration_status: account registered in Customer Support Portal. Known + values are: "Registered" and "Not Registered". + :paramtype account_registration_status: str or + ~azure.mgmt.paloaltonetworksngfw.models.RegistrationStatus + :keyword account_id: Support account associated with given resource. + :paramtype account_id: str + :keyword free_trial: Product usage is in free trial period. Known values are: "Enabled" and + "Disabled". + :paramtype free_trial: str or ~azure.mgmt.paloaltonetworksngfw.models.EnableStatus + :keyword free_trial_days_left: Free trial days remaining. + :paramtype free_trial_days_left: int + :keyword free_trial_credit_left: Free trial credit remaining. + :paramtype free_trial_credit_left: int + :keyword help_url: URL for paloaltonetworks live community. + :paramtype help_url: str + :keyword support_url: URL for paloaltonetworks Customer Service Portal. + :paramtype support_url: str + :keyword register_url: URL for registering product in paloaltonetworks Customer Service Portal. + :paramtype register_url: str + :keyword hub_url: URL for Strata Cloud Manager. + :paramtype hub_url: str + :keyword credits: credits purchased, unit per hour. + :paramtype credits: int + :keyword monthly_credit_left: monthly credit is computed as credits * days in calendar month. + :paramtype monthly_credit_left: int + :keyword start_date_for_credits: date in format yyyy-mm-dd. + :paramtype start_date_for_credits: str + :keyword end_date_for_credits: date in format yyyy-mm-dd. + :paramtype end_date_for_credits: str + """ + super().__init__(**kwargs) + self.product_sku = product_sku + self.product_serial = product_serial + self.account_registration_status = account_registration_status + self.account_id = account_id + self.free_trial = free_trial + self.free_trial_days_left = free_trial_days_left + self.free_trial_credit_left = free_trial_credit_left + self.help_url = help_url + self.support_url = support_url + self.register_url = register_url + self.hub_url = hub_url + self.credits = credits + self.monthly_credit_left = monthly_credit_left + self.start_date_for_credits = start_date_for_credits + self.end_date_for_credits = end_date_for_credits + + class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. @@ -4684,7 +5126,7 @@ def __init__( class TagInfo(_serialization.Model): """Tag. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar key: tag name. Required. :vartype key: str @@ -4717,7 +5159,7 @@ def __init__(self, *, key: str, value: str, **kwargs: Any) -> None: class VnetConfiguration(_serialization.Model): """VnetInfo for Firewall Networking. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar vnet: Azure Virtual Network. Required. :vartype vnet: ~azure.mgmt.paloaltonetworksngfw.models.IPAddressSpace @@ -4771,7 +5213,7 @@ def __init__( class VwanConfiguration(_serialization.Model): """VwanInfo for Firewall Networking. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar network_virtual_appliance_id: Network Virtual Appliance resource ID. :vartype network_virtual_appliance_id: str diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_palo_alto_networks_ngfw_mgmt_client_enums.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_palo_alto_networks_ngfw_mgmt_client_enums.py index 58c50e2a512c..6ab85dbde444 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_palo_alto_networks_ngfw_mgmt_client_enums.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_palo_alto_networks_ngfw_mgmt_client_enums.py @@ -92,6 +92,13 @@ class EnabledDNSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): AZURE = "AZURE" +class EnableStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enable status.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + class HealthStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Status Codes for the Firewall.""" @@ -156,6 +163,13 @@ class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): USER_SYSTEM = "user,system" +class ProductSerialStatusValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """allocation status of the product serial number.""" + + ALLOCATED = "Allocated" + IN_PROGRESS = "InProgress" + + class ProtocolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Protocol Enum.""" @@ -185,6 +199,13 @@ class ReadOnlyProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): DELETED = "Deleted" +class RegistrationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Registration status.""" + + REGISTERED = "Registered" + NOT_REGISTERED = "Not Registered" + + class ScopeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Rulestack Type.""" diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_patch.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_patch.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/__init__.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/__init__.py index 72bdc9199a7f..e19c8cbbb5b2 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/__init__.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/__init__.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,24 +6,32 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._global_rulestack_operations import GlobalRulestackOperations -from ._certificate_object_global_rulestack_operations import CertificateObjectGlobalRulestackOperations -from ._fqdn_list_global_rulestack_operations import FqdnListGlobalRulestackOperations -from ._post_rules_operations import PostRulesOperations -from ._prefix_list_global_rulestack_operations import PrefixListGlobalRulestackOperations -from ._pre_rules_operations import PreRulesOperations -from ._operations import Operations -from ._firewalls_operations import FirewallsOperations -from ._local_rulestacks_operations import LocalRulestacksOperations -from ._firewall_status_operations import FirewallStatusOperations -from ._certificate_object_local_rulestack_operations import CertificateObjectLocalRulestackOperations -from ._fqdn_list_local_rulestack_operations import FqdnListLocalRulestackOperations -from ._local_rules_operations import LocalRulesOperations -from ._prefix_list_local_rulestack_operations import PrefixListLocalRulestackOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._global_rulestack_operations import GlobalRulestackOperations # type: ignore +from ._certificate_object_global_rulestack_operations import CertificateObjectGlobalRulestackOperations # type: ignore +from ._fqdn_list_global_rulestack_operations import FqdnListGlobalRulestackOperations # type: ignore +from ._post_rules_operations import PostRulesOperations # type: ignore +from ._pre_rules_operations import PreRulesOperations # type: ignore +from ._prefix_list_global_rulestack_operations import PrefixListGlobalRulestackOperations # type: ignore +from ._operations import Operations # type: ignore +from ._palo_alto_networks_cloudngfw_operations_operations import PaloAltoNetworksCloudngfwOperationsOperations # type: ignore +from ._firewalls_operations import FirewallsOperations # type: ignore +from ._local_rulestacks_operations import LocalRulestacksOperations # type: ignore +from ._metrics_object_firewall_operations import MetricsObjectFirewallOperations # type: ignore +from ._firewall_status_operations import FirewallStatusOperations # type: ignore +from ._certificate_object_local_rulestack_operations import CertificateObjectLocalRulestackOperations # type: ignore +from ._fqdn_list_local_rulestack_operations import FqdnListLocalRulestackOperations # type: ignore +from ._local_rules_operations import LocalRulesOperations # type: ignore +from ._prefix_list_local_rulestack_operations import PrefixListLocalRulestackOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -30,16 +39,18 @@ "CertificateObjectGlobalRulestackOperations", "FqdnListGlobalRulestackOperations", "PostRulesOperations", - "PrefixListGlobalRulestackOperations", "PreRulesOperations", + "PrefixListGlobalRulestackOperations", "Operations", + "PaloAltoNetworksCloudngfwOperationsOperations", "FirewallsOperations", "LocalRulestacksOperations", + "MetricsObjectFirewallOperations", "FirewallStatusOperations", "CertificateObjectLocalRulestackOperations", "FqdnListLocalRulestackOperations", "LocalRulesOperations", "PrefixListLocalRulestackOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_certificate_object_global_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_certificate_object_global_rulestack_operations.py index 037b6f643848..064903f42839 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_certificate_object_global_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_certificate_object_global_rulestack_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,34 +5,38 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +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 .._serialization import Serializer -from .._vendor import _convert_request +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration +from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -43,13 +46,13 @@ def build_list_request(global_rulestack_name: 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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), } @@ -69,14 +72,14 @@ def build_get_request(global_rulestack_name: str, name: str, **kwargs: Any) -> H _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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), "name": _SERIALIZER.url("name", name, "str"), @@ -97,7 +100,7 @@ def build_create_or_update_request(global_rulestack_name: str, name: str, **kwar _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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -105,7 +108,7 @@ def build_create_or_update_request(global_rulestack_name: str, name: str, **kwar _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), "name": _SERIALIZER.url("name", name, "str"), @@ -128,14 +131,14 @@ def build_delete_request(global_rulestack_name: str, name: str, **kwargs: Any) - _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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), "name": _SERIALIZER.url("name", name, "str"), @@ -152,7 +155,7 @@ def build_delete_request(global_rulestack_name: str, name: str, **kwargs: Any) - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -class CertificateObjectGlobalRulestackOperations: +class CertificateObjectGlobalRulestackOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. @@ -164,22 +167,23 @@ class CertificateObjectGlobalRulestackOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + 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, global_rulestack_name: str, **kwargs: Any - ) -> Iterable["_models.CertificateObjectGlobalRulestackResource"]: + ) -> ItemPaged["_models.CertificateObjectGlobalRulestackResource"]: """List CertificateObjectGlobalRulestackResource resources by Tenant. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either CertificateObjectGlobalRulestackResource or the result of cls(response) :rtype: @@ -192,7 +196,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateObjectGlobalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -203,15 +207,13 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -223,13 +225,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("CertificateObjectGlobalRulestackResourceListResult", pipeline_response) @@ -239,25 +240,26 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates"} - @distributed_trace def get( self, global_rulestack_name: str, name: str, **kwargs: Any @@ -268,12 +270,11 @@ def get( :type global_rulestack_name: str :param name: certificate name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateObjectGlobalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -287,48 +288,45 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateObjectGlobalRulestackResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CertificateObjectGlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("CertificateObjectGlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}" - } + return deserialized # type: ignore def _create_or_update_initial( self, global_rulestack_name: str, name: str, - resource: Union[_models.CertificateObjectGlobalRulestackResource, IO], + resource: Union[_models.CertificateObjectGlobalRulestackResource, IO[bytes]], **kwargs: Any - ) -> _models.CertificateObjectGlobalRulestackResource: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -341,7 +339,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateObjectGlobalRulestackResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -351,47 +349,52 @@ def _create_or_update_initial( else: _json = self._serialize.body(resource, "CertificateObjectGlobalRulestackResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CertificateObjectGlobalRulestackResource", pipeline_response) - + response_headers = {} if response.status_code == 201: - deserialized = self._deserialize("CertificateObjectGlobalRulestackResource", pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}" - } - @overload def begin_create_or_update( self, @@ -414,14 +417,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either CertificateObjectGlobalRulestackResource or the result of cls(response) :rtype: @@ -434,7 +429,7 @@ def begin_create_or_update( self, global_rulestack_name: str, name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -446,18 +441,10 @@ def begin_create_or_update( :param name: certificate name. Required. :type name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either CertificateObjectGlobalRulestackResource or the result of cls(response) :rtype: @@ -470,7 +457,7 @@ def begin_create_or_update( self, global_rulestack_name: str, name: str, - resource: Union[_models.CertificateObjectGlobalRulestackResource, IO], + resource: Union[_models.CertificateObjectGlobalRulestackResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.CertificateObjectGlobalRulestackResource]: """Create a CertificateObjectGlobalRulestackResource. @@ -480,20 +467,9 @@ def begin_create_or_update( :param name: certificate name. Required. :type name: str :param resource: Resource create parameters. Is either a - CertificateObjectGlobalRulestackResource type or a IO type. Required. + CertificateObjectGlobalRulestackResource type or a IO[bytes] type. Required. :type resource: - ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource or IO[bytes] :return: An instance of LROPoller that returns either CertificateObjectGlobalRulestackResource or the result of cls(response) :rtype: @@ -521,12 +497,15 @@ def begin_create_or_update( 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("CertificateObjectGlobalRulestackResource", pipeline_response) + deserialized = self._deserialize( + "CertificateObjectGlobalRulestackResource", pipeline_response.http_response + ) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -538,22 +517,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.CertificateObjectGlobalRulestackResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}" - } + return LROPoller[_models.CertificateObjectGlobalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, global_rulestack_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -565,37 +540,50 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 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) + 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, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}" - } + return deserialized # type: ignore @distributed_trace def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -605,14 +593,6 @@ def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> :type global_rulestack_name: str :param name: certificate name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :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: @@ -626,7 +606,7 @@ def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> 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( # type: ignore + raw_result = self._delete_initial( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, @@ -635,11 +615,12 @@ def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> 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, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -650,14 +631,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_certificate_object_local_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_certificate_object_local_rulestack_operations.py index b911c687fa3d..ab382489756e 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_certificate_object_local_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_certificate_object_local_rulestack_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,34 +6,38 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +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 .._serialization import Serializer -from .._vendor import _convert_request +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration +from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -45,14 +49,14 @@ def build_list_by_local_rulestacks_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -78,14 +82,14 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -112,7 +116,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -120,7 +124,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -149,14 +153,14 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -177,7 +181,7 @@ def build_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -class CertificateObjectLocalRulestackOperations: +class CertificateObjectLocalRulestackOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. @@ -189,17 +193,19 @@ class CertificateObjectLocalRulestackOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + 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_by_local_rulestacks( self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> Iterable["_models.CertificateObjectLocalRulestackResource"]: + ) -> ItemPaged["_models.CertificateObjectLocalRulestackResource"]: """List CertificateObjectLocalRulestackResource resources by LocalRulestacks. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -207,7 +213,6 @@ def list_by_local_rulestacks( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either CertificateObjectLocalRulestackResource or the result of cls(response) :rtype: @@ -220,7 +225,7 @@ def list_by_local_rulestacks( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateObjectLocalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -231,17 +236,15 @@ def list_by_local_rulestacks( def prepare_request(next_link=None): if not next_link: - request = build_list_by_local_rulestacks_request( + _request = build_list_by_local_rulestacks_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_local_rulestacks.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -253,13 +256,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("CertificateObjectLocalRulestackResourceListResult", pipeline_response) @@ -269,27 +271,26 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - list_by_local_rulestacks.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates" - } - @distributed_trace def get( self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any @@ -303,12 +304,11 @@ def get( :type local_rulestack_name: str :param name: certificate name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateObjectLocalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -322,51 +322,48 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateObjectLocalRulestackResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CertificateObjectLocalRulestackResource", pipeline_response) + deserialized = self._deserialize("CertificateObjectLocalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, local_rulestack_name: str, name: str, - resource: Union[_models.CertificateObjectLocalRulestackResource, IO], + resource: Union[_models.CertificateObjectLocalRulestackResource, IO[bytes]], **kwargs: Any - ) -> _models.CertificateObjectLocalRulestackResource: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -379,7 +376,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateObjectLocalRulestackResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -389,7 +386,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(resource, "CertificateObjectLocalRulestackResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, @@ -398,40 +395,45 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CertificateObjectLocalRulestackResource", pipeline_response) - + response_headers = {} if response.status_code == 201: - deserialized = self._deserialize("CertificateObjectLocalRulestackResource", pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}" - } - @overload def begin_create_or_update( self, @@ -457,14 +459,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either CertificateObjectLocalRulestackResource or the result of cls(response) :rtype: @@ -478,7 +472,7 @@ def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -493,18 +487,10 @@ def begin_create_or_update( :param name: certificate name. Required. :type name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either CertificateObjectLocalRulestackResource or the result of cls(response) :rtype: @@ -518,7 +504,7 @@ def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, name: str, - resource: Union[_models.CertificateObjectLocalRulestackResource, IO], + resource: Union[_models.CertificateObjectLocalRulestackResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.CertificateObjectLocalRulestackResource]: """Create a CertificateObjectLocalRulestackResource. @@ -531,20 +517,9 @@ def begin_create_or_update( :param name: certificate name. Required. :type name: str :param resource: Resource create parameters. Is either a - CertificateObjectLocalRulestackResource type or a IO type. Required. + CertificateObjectLocalRulestackResource type or a IO[bytes] type. Required. :type resource: ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource - or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + or IO[bytes] :return: An instance of LROPoller that returns either CertificateObjectLocalRulestackResource or the result of cls(response) :rtype: @@ -573,12 +548,13 @@ def begin_create_or_update( 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("CertificateObjectLocalRulestackResource", pipeline_response) + deserialized = self._deserialize("CertificateObjectLocalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -590,22 +566,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.CertificateObjectLocalRulestackResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}" - } + return LROPoller[_models.CertificateObjectLocalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -617,39 +591,52 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 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) + 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, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -664,14 +651,6 @@ def begin_delete( :type local_rulestack_name: str :param name: certificate name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :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: @@ -685,7 +664,7 @@ def begin_delete( 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( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, @@ -695,11 +674,12 @@ def begin_delete( 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, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -710,14 +690,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_firewall_status_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_firewall_status_operations.py index 606fad16f2a0..5fc429192e1a 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_firewall_status_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_firewall_status_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -19,18 +21,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +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 .._serialization import Serializer -from .._vendor import _convert_request +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration +from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -42,20 +44,25 @@ def build_list_by_firewalls_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/statuses", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "firewallName": _SERIALIZER.url("firewall_name", firewall_name, "str"), + "firewallName": _SERIALIZER.url( + "firewall_name", + firewall_name, + "str", + pattern=r"^(?![-_])(?!.*[-_]{2})(?!.*[-_]$)[a-zA-Z0-9][a-zA-Z0-9-]{0,127}$", + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -73,20 +80,25 @@ def build_get_request(resource_group_name: str, firewall_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/statuses/default", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "firewallName": _SERIALIZER.url("firewall_name", firewall_name, "str"), + "firewallName": _SERIALIZER.url( + "firewall_name", + firewall_name, + "str", + pattern=r"^(?![-_])(?!.*[-_]{2})(?!.*[-_]$)[a-zA-Z0-9][a-zA-Z0-9-]{0,127}$", + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -112,17 +124,19 @@ class FirewallStatusOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + 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_by_firewalls( self, resource_group_name: str, firewall_name: str, **kwargs: Any - ) -> Iterable["_models.FirewallStatusResource"]: + ) -> ItemPaged["_models.FirewallStatusResource"]: """List FirewallStatusResource resources by Firewalls. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -130,7 +144,6 @@ def list_by_firewalls( :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FirewallStatusResource or the result of cls(response) :rtype: @@ -143,7 +156,7 @@ def list_by_firewalls( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FirewallStatusResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -154,17 +167,15 @@ def list_by_firewalls( def prepare_request(next_link=None): if not next_link: - request = build_list_by_firewalls_request( + _request = build_list_by_firewalls_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_firewalls.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -176,13 +187,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("FirewallStatusResourceListResult", pipeline_response) @@ -192,27 +202,26 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - list_by_firewalls.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/statuses" - } - @distributed_trace def get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _models.FirewallStatusResource: """Get a FirewallStatusResource. @@ -222,12 +231,11 @@ def get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _m :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FirewallStatusResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallStatusResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -241,37 +249,34 @@ def get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _m api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FirewallStatusResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FirewallStatusResource", pipeline_response) + deserialized = self._deserialize("FirewallStatusResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/statuses/default" - } + return deserialized # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_firewalls_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_firewalls_operations.py index adf8749a7356..272b53553017 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_firewalls_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_firewalls_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,34 +6,38 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +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 .._serialization import Serializer -from .._vendor import _convert_request +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration +from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -43,7 +47,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,14 +71,14 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -97,20 +101,25 @@ def build_get_request(resource_group_name: str, firewall_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "firewallName": _SERIALIZER.url("firewall_name", firewall_name, "str"), + "firewallName": _SERIALIZER.url( + "firewall_name", + firewall_name, + "str", + pattern=r"^(?![-_])(?!.*[-_]{2})(?!.*[-_]$)[a-zA-Z0-9][a-zA-Z0-9-]{0,127}$", + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -130,7 +139,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -138,13 +147,18 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "firewallName": _SERIALIZER.url("firewall_name", firewall_name, "str"), + "firewallName": _SERIALIZER.url( + "firewall_name", + firewall_name, + "str", + pattern=r"^(?![-_])(?!.*[-_]{2})(?!.*[-_]$)[a-zA-Z0-9][a-zA-Z0-9-]{0,127}$", + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -166,7 +180,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -174,13 +188,18 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "firewallName": _SERIALIZER.url("firewall_name", firewall_name, "str"), + "firewallName": _SERIALIZER.url( + "firewall_name", + firewall_name, + "str", + pattern=r"^(?![-_])(?!.*[-_]{2})(?!.*[-_]$)[a-zA-Z0-9][a-zA-Z0-9-]{0,127}$", + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -202,20 +221,25 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "firewallName": _SERIALIZER.url("firewall_name", firewall_name, "str"), + "firewallName": _SERIALIZER.url( + "firewall_name", + firewall_name, + "str", + pattern=r"^(?![-_])(?!.*[-_]{2})(?!.*[-_]$)[a-zA-Z0-9][a-zA-Z0-9-]{0,127}$", + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -235,20 +259,25 @@ def build_get_global_rulestack_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/getGlobalRulestack", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "firewallName": _SERIALIZER.url("firewall_name", firewall_name, "str"), + "firewallName": _SERIALIZER.url( + "firewall_name", + firewall_name, + "str", + pattern=r"^(?![-_])(?!.*[-_]{2})(?!.*[-_]$)[a-zA-Z0-9][a-zA-Z0-9-]{0,127}$", + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -268,20 +297,25 @@ def build_get_log_profile_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/getLogProfile", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "firewallName": _SERIALIZER.url("firewall_name", firewall_name, "str"), + "firewallName": _SERIALIZER.url( + "firewall_name", + firewall_name, + "str", + pattern=r"^(?![-_])(?!.*[-_]{2})(?!.*[-_]$)[a-zA-Z0-9][a-zA-Z0-9-]{0,127}$", + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -301,20 +335,25 @@ def build_get_support_info_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/getSupportInfo", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "firewallName": _SERIALIZER.url("firewall_name", firewall_name, "str"), + "firewallName": _SERIALIZER.url( + "firewall_name", + firewall_name, + "str", + pattern=r"^(?![-_])(?!.*[-_]{2})(?!.*[-_]$)[a-zA-Z0-9][a-zA-Z0-9-]{0,127}$", + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -336,7 +375,7 @@ def build_save_log_profile_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -344,13 +383,18 @@ def build_save_log_profile_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/saveLogProfile", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "firewallName": _SERIALIZER.url("firewall_name", firewall_name, "str"), + "firewallName": _SERIALIZER.url( + "firewall_name", + firewall_name, + "str", + pattern=r"^(?![-_])(?!.*[-_]{2})(?!.*[-_]$)[a-zA-Z0-9][a-zA-Z0-9-]{0,127}$", + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -378,18 +422,19 @@ class FirewallsOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + 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_by_subscription(self, **kwargs: Any) -> Iterable["_models.FirewallResource"]: + def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.FirewallResource"]: """List FirewallResource resources by subscription ID. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FirewallResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] :raises ~azure.core.exceptions.HttpResponseError: @@ -400,7 +445,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.FirewallResou api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FirewallResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -411,15 +456,13 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.FirewallResou def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -431,13 +474,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("FirewallResourceListResult", pipeline_response) @@ -447,35 +489,33 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/firewalls" - } - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.FirewallResource"]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.FirewallResource"]: """List FirewallResource resources by resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FirewallResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] :raises ~azure.core.exceptions.HttpResponseError: @@ -486,7 +526,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FirewallResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -497,16 +537,14 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -518,13 +556,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("FirewallResourceListResult", pipeline_response) @@ -534,27 +571,26 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls" - } - @distributed_trace def get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _models.FirewallResource: """Get a FirewallResource. @@ -564,12 +600,11 @@ def get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _m :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FirewallResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -583,45 +618,46 @@ def get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _m api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FirewallResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FirewallResource", pipeline_response) + deserialized = self._deserialize("FirewallResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" - } + return deserialized # type: ignore def _create_or_update_initial( - self, resource_group_name: str, firewall_name: str, resource: Union[_models.FirewallResource, IO], **kwargs: Any - ) -> _models.FirewallResource: - error_map = { + self, + resource_group_name: str, + firewall_name: str, + resource: Union[_models.FirewallResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -634,7 +670,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FirewallResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -644,7 +680,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(resource, "FirewallResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, @@ -652,40 +688,45 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FirewallResource", pipeline_response) - + response_headers = {} if response.status_code == 201: - deserialized = self._deserialize("FirewallResource", pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" - } - @overload def begin_create_or_update( self, @@ -708,14 +749,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either FirewallResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] @@ -727,7 +760,7 @@ def begin_create_or_update( self, resource_group_name: str, firewall_name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -740,18 +773,10 @@ def begin_create_or_update( :param firewall_name: Firewall resource name. Required. :type firewall_name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either FirewallResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] @@ -760,7 +785,11 @@ def begin_create_or_update( @distributed_trace def begin_create_or_update( - self, resource_group_name: str, firewall_name: str, resource: Union[_models.FirewallResource, IO], **kwargs: Any + self, + resource_group_name: str, + firewall_name: str, + resource: Union[_models.FirewallResource, IO[bytes]], + **kwargs: Any ) -> LROPoller[_models.FirewallResource]: """Create a FirewallResource. @@ -769,20 +798,9 @@ def begin_create_or_update( :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :param resource: Resource create parameters. Is either a FirewallResource type or a IO type. - Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param resource: Resource create parameters. Is either a FirewallResource type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource or IO[bytes] :return: An instance of LROPoller that returns either FirewallResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] @@ -809,12 +827,13 @@ def begin_create_or_update( 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("FirewallResource", pipeline_response) + deserialized = self._deserialize("FirewallResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -826,17 +845,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.FirewallResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" - } + return LROPoller[_models.FirewallResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload def update( @@ -860,7 +877,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FirewallResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource :raises ~azure.core.exceptions.HttpResponseError: @@ -871,7 +887,7 @@ def update( self, resource_group_name: str, firewall_name: str, - properties: IO, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -884,11 +900,10 @@ def update( :param firewall_name: Firewall resource name. Required. :type firewall_name: str :param properties: The resource properties to be updated. Required. - :type properties: IO + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FirewallResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource :raises ~azure.core.exceptions.HttpResponseError: @@ -899,7 +914,7 @@ def update( self, resource_group_name: str, firewall_name: str, - properties: Union[_models.FirewallResourceUpdate, IO], + properties: Union[_models.FirewallResourceUpdate, IO[bytes]], **kwargs: Any ) -> _models.FirewallResource: """Update a FirewallResource. @@ -910,17 +925,13 @@ def update( :param firewall_name: Firewall resource name. Required. :type firewall_name: str :param properties: The resource properties to be updated. Is either a FirewallResourceUpdate - type or a IO type. Required. - :type properties: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResourceUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResourceUpdate or IO[bytes] :return: FirewallResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -943,7 +954,7 @@ def update( else: _json = self._serialize.body(properties, "FirewallResourceUpdate") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, @@ -951,40 +962,35 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FirewallResource", pipeline_response) + deserialized = self._deserialize("FirewallResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" - } + return deserialized # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, firewall_name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -996,38 +1002,51 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 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) + 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, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" - } + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1038,14 +1057,6 @@ def begin_delete(self, resource_group_name: str, firewall_name: str, **kwargs: A :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :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: @@ -1059,7 +1070,7 @@ def begin_delete(self, resource_group_name: str, firewall_name: str, **kwargs: A 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( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, firewall_name=firewall_name, api_version=api_version, @@ -1068,11 +1079,12 @@ def begin_delete(self, resource_group_name: str, firewall_name: str, **kwargs: A 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, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -1083,17 +1095,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get_global_rulestack( @@ -1106,12 +1114,11 @@ def get_global_rulestack( :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GlobalRulestackInfo or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1125,40 +1132,37 @@ def get_global_rulestack( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GlobalRulestackInfo] = kwargs.pop("cls", None) - request = build_get_global_rulestack_request( + _request = build_get_global_rulestack_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_global_rulestack.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GlobalRulestackInfo", pipeline_response) + deserialized = self._deserialize("GlobalRulestackInfo", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_global_rulestack.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/getGlobalRulestack" - } + return deserialized # type: ignore @distributed_trace def get_log_profile(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _models.LogSettings: @@ -1169,12 +1173,11 @@ def get_log_profile(self, resource_group_name: str, firewall_name: str, **kwargs :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LogSettings or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LogSettings :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1188,40 +1191,37 @@ def get_log_profile(self, resource_group_name: str, firewall_name: str, **kwargs api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LogSettings] = kwargs.pop("cls", None) - request = build_get_log_profile_request( + _request = build_get_log_profile_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_log_profile.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LogSettings", pipeline_response) + deserialized = self._deserialize("LogSettings", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_log_profile.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/getLogProfile" - } + return deserialized # type: ignore @distributed_trace def get_support_info( @@ -1236,12 +1236,11 @@ def get_support_info( :type firewall_name: str :param email: email address on behalf of which this API called. Default value is None. :type email: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SupportInfo or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SupportInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1255,44 +1254,41 @@ def get_support_info( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SupportInfo] = kwargs.pop("cls", None) - request = build_get_support_info_request( + _request = build_get_support_info_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, email=email, api_version=api_version, - template_url=self.get_support_info.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SupportInfo", pipeline_response) + deserialized = self._deserialize("SupportInfo", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_support_info.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/getSupportInfo" - } + return deserialized # type: ignore @overload - def save_log_profile( # pylint: disable=inconsistent-return-statements + def save_log_profile( self, resource_group_name: str, firewall_name: str, @@ -1313,18 +1309,17 @@ def save_log_profile( # pylint: disable=inconsistent-return-statements :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def save_log_profile( # pylint: disable=inconsistent-return-statements + def save_log_profile( self, resource_group_name: str, firewall_name: str, - log_settings: Optional[IO] = None, + log_settings: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -1337,11 +1332,10 @@ def save_log_profile( # pylint: disable=inconsistent-return-statements :param firewall_name: Firewall resource name. Required. :type firewall_name: str :param log_settings: Default value is None. - :type log_settings: IO + :type log_settings: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1352,7 +1346,7 @@ def save_log_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, firewall_name: str, - log_settings: Optional[Union[_models.LogSettings, IO]] = None, + log_settings: Optional[Union[_models.LogSettings, IO[bytes]]] = None, **kwargs: Any ) -> None: """Log Profile for Firewall. @@ -1362,17 +1356,13 @@ def save_log_profile( # pylint: disable=inconsistent-return-statements :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :param log_settings: Is either a LogSettings type or a IO type. Default value is None. - :type log_settings: ~azure.mgmt.paloaltonetworksngfw.models.LogSettings or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param log_settings: Is either a LogSettings type or a IO[bytes] type. Default value is None. + :type log_settings: ~azure.mgmt.paloaltonetworksngfw.models.LogSettings or IO[bytes] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1385,9 +1375,10 @@ def save_log_profile( # pylint: disable=inconsistent-return-statements 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 log_settings else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if log_settings else None _json = None _content = None if isinstance(log_settings, (IOBase, bytes)): @@ -1398,7 +1389,7 @@ def save_log_profile( # pylint: disable=inconsistent-return-statements else: _json = None - request = build_save_log_profile_request( + _request = build_save_log_profile_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, @@ -1406,28 +1397,25 @@ def save_log_profile( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self.save_log_profile.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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, {}) - - save_log_profile.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/saveLogProfile" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_fqdn_list_global_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_fqdn_list_global_rulestack_operations.py index 80ba3005d964..0cc23333167d 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_fqdn_list_global_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_fqdn_list_global_rulestack_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,34 +5,38 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +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 .._serialization import Serializer -from .._vendor import _convert_request +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration +from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -43,13 +46,13 @@ def build_list_request(global_rulestack_name: 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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), } @@ -69,13 +72,13 @@ def build_get_request(global_rulestack_name: str, name: str, **kwargs: Any) -> H _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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), "name": _SERIALIZER.url("name", name, "str"), @@ -96,14 +99,14 @@ def build_create_or_update_request(global_rulestack_name: str, name: str, **kwar _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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) 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", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), "name": _SERIALIZER.url("name", name, "str"), @@ -126,13 +129,13 @@ def build_delete_request(global_rulestack_name: str, name: str, **kwargs: Any) - _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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), "name": _SERIALIZER.url("name", name, "str"), @@ -161,20 +164,21 @@ class FqdnListGlobalRulestackOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + 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, global_rulestack_name: str, **kwargs: Any) -> Iterable["_models.FqdnListGlobalRulestackResource"]: + def list(self, global_rulestack_name: str, **kwargs: Any) -> ItemPaged["_models.FqdnListGlobalRulestackResource"]: """List FqdnListGlobalRulestackResource resources by Tenant. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FqdnListGlobalRulestackResource or the result of cls(response) :rtype: @@ -187,7 +191,7 @@ def list(self, global_rulestack_name: str, **kwargs: Any) -> Iterable["_models.F api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FqdnListGlobalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -198,15 +202,13 @@ def list(self, global_rulestack_name: str, **kwargs: Any) -> Iterable["_models.F def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -218,13 +220,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("FqdnListGlobalRulestackResourceListResult", pipeline_response) @@ -234,25 +235,26 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists"} - @distributed_trace def get(self, global_rulestack_name: str, name: str, **kwargs: Any) -> _models.FqdnListGlobalRulestackResource: """Get a FqdnListGlobalRulestackResource. @@ -261,12 +263,11 @@ def get(self, global_rulestack_name: str, name: str, **kwargs: Any) -> _models.F :type global_rulestack_name: str :param name: fqdn list name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FqdnListGlobalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -280,48 +281,45 @@ def get(self, global_rulestack_name: str, name: str, **kwargs: Any) -> _models.F api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FqdnListGlobalRulestackResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FqdnListGlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("FqdnListGlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" - } + return deserialized # type: ignore def _create_or_update_initial( self, global_rulestack_name: str, name: str, - resource: Union[_models.FqdnListGlobalRulestackResource, IO], + resource: Union[_models.FqdnListGlobalRulestackResource, IO[bytes]], **kwargs: Any - ) -> _models.FqdnListGlobalRulestackResource: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -334,7 +332,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FqdnListGlobalRulestackResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -344,47 +342,52 @@ def _create_or_update_initial( else: _json = self._serialize.body(resource, "FqdnListGlobalRulestackResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FqdnListGlobalRulestackResource", pipeline_response) - + response_headers = {} if response.status_code == 201: - deserialized = self._deserialize("FqdnListGlobalRulestackResource", pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" - } - @overload def begin_create_or_update( self, @@ -406,14 +409,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either FqdnListGlobalRulestackResource or the result of cls(response) :rtype: @@ -426,7 +421,7 @@ def begin_create_or_update( self, global_rulestack_name: str, name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -438,18 +433,10 @@ def begin_create_or_update( :param name: fqdn list name. Required. :type name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either FqdnListGlobalRulestackResource or the result of cls(response) :rtype: @@ -462,7 +449,7 @@ def begin_create_or_update( self, global_rulestack_name: str, name: str, - resource: Union[_models.FqdnListGlobalRulestackResource, IO], + resource: Union[_models.FqdnListGlobalRulestackResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.FqdnListGlobalRulestackResource]: """Create a FqdnListGlobalRulestackResource. @@ -472,19 +459,9 @@ def begin_create_or_update( :param name: fqdn list name. Required. :type name: str :param resource: Resource create parameters. Is either a FqdnListGlobalRulestackResource type - or a IO type. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + or a IO[bytes] type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource or + IO[bytes] :return: An instance of LROPoller that returns either FqdnListGlobalRulestackResource or the result of cls(response) :rtype: @@ -512,12 +489,13 @@ def begin_create_or_update( 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("FqdnListGlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("FqdnListGlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -529,22 +507,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.FqdnListGlobalRulestackResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" - } + return LROPoller[_models.FqdnListGlobalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, global_rulestack_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -556,37 +530,50 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 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) + 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, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" - } + return deserialized # type: ignore @distributed_trace def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -596,14 +583,6 @@ def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> :type global_rulestack_name: str :param name: fqdn list name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :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: @@ -617,7 +596,7 @@ def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> 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( # type: ignore + raw_result = self._delete_initial( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, @@ -626,11 +605,12 @@ def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> 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, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -641,14 +621,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_fqdn_list_local_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_fqdn_list_local_rulestack_operations.py index d44277f52f8b..d5c502258594 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_fqdn_list_local_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_fqdn_list_local_rulestack_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,34 +6,38 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +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 .._serialization import Serializer -from .._vendor import _convert_request +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration +from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -45,14 +49,14 @@ def build_list_by_local_rulestacks_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -78,14 +82,14 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -112,7 +116,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -120,7 +124,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -149,14 +153,14 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -189,17 +193,19 @@ class FqdnListLocalRulestackOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + 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_by_local_rulestacks( self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> Iterable["_models.FqdnListLocalRulestackResource"]: + ) -> ItemPaged["_models.FqdnListLocalRulestackResource"]: """List FqdnListLocalRulestackResource resources by LocalRulestacks. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -207,7 +213,6 @@ def list_by_local_rulestacks( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FqdnListLocalRulestackResource or the result of cls(response) :rtype: @@ -220,7 +225,7 @@ def list_by_local_rulestacks( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FqdnListLocalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -231,17 +236,15 @@ def list_by_local_rulestacks( def prepare_request(next_link=None): if not next_link: - request = build_list_by_local_rulestacks_request( + _request = build_list_by_local_rulestacks_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_local_rulestacks.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -253,13 +256,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("FqdnListLocalRulestackResourceListResult", pipeline_response) @@ -269,27 +271,26 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - list_by_local_rulestacks.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists" - } - @distributed_trace def get( self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any @@ -303,12 +304,11 @@ def get( :type local_rulestack_name: str :param name: fqdn list name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FqdnListLocalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -322,51 +322,48 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FqdnListLocalRulestackResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FqdnListLocalRulestackResource", pipeline_response) + deserialized = self._deserialize("FqdnListLocalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, local_rulestack_name: str, name: str, - resource: Union[_models.FqdnListLocalRulestackResource, IO], + resource: Union[_models.FqdnListLocalRulestackResource, IO[bytes]], **kwargs: Any - ) -> _models.FqdnListLocalRulestackResource: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -379,7 +376,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FqdnListLocalRulestackResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -389,7 +386,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(resource, "FqdnListLocalRulestackResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, @@ -398,40 +395,45 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FqdnListLocalRulestackResource", pipeline_response) - + response_headers = {} if response.status_code == 201: - deserialized = self._deserialize("FqdnListLocalRulestackResource", pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}" - } - @overload def begin_create_or_update( self, @@ -457,14 +459,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either FqdnListLocalRulestackResource or the result of cls(response) :rtype: @@ -478,7 +472,7 @@ def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -493,18 +487,10 @@ def begin_create_or_update( :param name: fqdn list name. Required. :type name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either FqdnListLocalRulestackResource or the result of cls(response) :rtype: @@ -518,7 +504,7 @@ def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, name: str, - resource: Union[_models.FqdnListLocalRulestackResource, IO], + resource: Union[_models.FqdnListLocalRulestackResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.FqdnListLocalRulestackResource]: """Create a FqdnListLocalRulestackResource. @@ -531,19 +517,9 @@ def begin_create_or_update( :param name: fqdn list name. Required. :type name: str :param resource: Resource create parameters. Is either a FqdnListLocalRulestackResource type or - a IO type. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + a IO[bytes] type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource or + IO[bytes] :return: An instance of LROPoller that returns either FqdnListLocalRulestackResource or the result of cls(response) :rtype: @@ -572,12 +548,13 @@ def begin_create_or_update( 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("FqdnListLocalRulestackResource", pipeline_response) + deserialized = self._deserialize("FqdnListLocalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -589,22 +566,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.FqdnListLocalRulestackResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}" - } + return LROPoller[_models.FqdnListLocalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -616,39 +591,52 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 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) + 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, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -663,14 +651,6 @@ def begin_delete( :type local_rulestack_name: str :param name: fqdn list name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :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: @@ -684,7 +664,7 @@ def begin_delete( 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( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, @@ -694,11 +674,12 @@ def begin_delete( 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, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -709,14 +690,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_global_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_global_rulestack_operations.py index 005c272705f0..4b1117f4b9f6 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_global_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_global_rulestack_operations.py @@ -6,34 +6,38 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +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 .._serialization import Serializer -from .._vendor import _convert_request +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration +from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -43,7 +47,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +66,7 @@ def build_get_request(global_rulestack_name: 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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,7 +90,7 @@ def build_create_or_update_request(global_rulestack_name: str, **kwargs: Any) -> _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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -113,7 +117,7 @@ def build_update_request(global_rulestack_name: str, **kwargs: Any) -> HttpReque _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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -140,7 +144,7 @@ def build_delete_request(global_rulestack_name: str, **kwargs: Any) -> HttpReque _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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +168,7 @@ def build_commit_request(global_rulestack_name: str, **kwargs: Any) -> HttpReque _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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -190,13 +194,13 @@ def build_get_change_log_request(global_rulestack_name: str, **kwargs: Any) -> H _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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/getChangeLog" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), } @@ -212,7 +216,7 @@ def build_get_change_log_request(global_rulestack_name: str, **kwargs: Any) -> H return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_advanced_security_objects_request( +def build_list_advanced_security_objects_request( # pylint: disable=name-too-long global_rulestack_name: str, *, type: Union[str, _models.AdvSecurityObjectTypeEnum], @@ -223,14 +227,14 @@ def build_list_advanced_security_objects_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listAdvancedSecurityObjects", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), } @@ -263,13 +267,13 @@ def build_list_app_ids_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listAppIds" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), } @@ -299,13 +303,13 @@ def build_list_countries_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listCountries" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), } @@ -329,13 +333,13 @@ def build_list_firewalls_request(global_rulestack_name: str, **kwargs: Any) -> H _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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listFirewalls" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), } @@ -351,20 +355,20 @@ def build_list_firewalls_request(global_rulestack_name: str, **kwargs: Any) -> H return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_predefined_url_categories_request( +def build_list_predefined_url_categories_request( # pylint: disable=name-too-long global_rulestack_name: str, *, skip: Optional[str] = None, top: Optional[int] = None, **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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listPredefinedUrlCategories", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), } @@ -395,14 +399,14 @@ def build_list_security_services_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listSecurityServices", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), } @@ -427,7 +431,7 @@ def build_revert_request(global_rulestack_name: str, **kwargs: Any) -> HttpReque _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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -461,18 +465,19 @@ class GlobalRulestackOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.GlobalRulestackResource"]: + def list(self, **kwargs: Any) -> ItemPaged["_models.GlobalRulestackResource"]: """List GlobalRulestackResource resources by Tenant. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GlobalRulestackResource or the result of cls(response) :rtype: @@ -485,7 +490,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.GlobalRulestackResource"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GlobalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -496,14 +501,12 @@ def list(self, **kwargs: Any) -> Iterable["_models.GlobalRulestackResource"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -515,13 +518,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("GlobalRulestackResourceListResult", pipeline_response) @@ -531,37 +533,37 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks"} - @distributed_trace def get(self, global_rulestack_name: str, **kwargs: Any) -> _models.GlobalRulestackResource: """Get a GlobalRulestackResource. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GlobalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -575,41 +577,40 @@ def get(self, global_rulestack_name: str, **kwargs: Any) -> _models.GlobalRulest api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GlobalRulestackResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("GlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}"} + return deserialized # type: ignore def _create_or_update_initial( - self, global_rulestack_name: str, resource: Union[_models.GlobalRulestackResource, IO], **kwargs: Any - ) -> _models.GlobalRulestackResource: - error_map = { + self, global_rulestack_name: str, resource: Union[_models.GlobalRulestackResource, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -622,7 +623,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GlobalRulestackResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -632,46 +633,51 @@ def _create_or_update_initial( else: _json = self._serialize.body(resource, "GlobalRulestackResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( global_rulestack_name=global_rulestack_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("GlobalRulestackResource", pipeline_response) - + response_headers = {} if response.status_code == 201: - deserialized = self._deserialize("GlobalRulestackResource", pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}" - } - @overload def begin_create_or_update( self, @@ -690,14 +696,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either GlobalRulestackResource or the result of cls(response) :rtype: @@ -707,25 +705,17 @@ def begin_create_or_update( @overload def begin_create_or_update( - self, global_rulestack_name: str, resource: IO, *, content_type: str = "application/json", **kwargs: Any + self, global_rulestack_name: str, resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GlobalRulestackResource]: """Create a GlobalRulestackResource. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either GlobalRulestackResource or the result of cls(response) :rtype: @@ -735,26 +725,15 @@ def begin_create_or_update( @distributed_trace def begin_create_or_update( - self, global_rulestack_name: str, resource: Union[_models.GlobalRulestackResource, IO], **kwargs: Any + self, global_rulestack_name: str, resource: Union[_models.GlobalRulestackResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GlobalRulestackResource]: """Create a GlobalRulestackResource. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :param resource: Resource create parameters. Is either a GlobalRulestackResource type or a IO - type. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param resource: Resource create parameters. Is either a GlobalRulestackResource type or a + IO[bytes] type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource or IO[bytes] :return: An instance of LROPoller that returns either GlobalRulestackResource or the result of cls(response) :rtype: @@ -781,12 +760,13 @@ def begin_create_or_update( 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("GlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("GlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -798,17 +778,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.GlobalRulestackResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}" - } + return LROPoller[_models.GlobalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload def update( @@ -828,7 +806,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GlobalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: @@ -836,18 +813,22 @@ def update( @overload def update( - self, global_rulestack_name: str, properties: IO, *, content_type: str = "application/json", **kwargs: Any + self, + global_rulestack_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any ) -> _models.GlobalRulestackResource: """Update a GlobalRulestackResource. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str :param properties: The resource properties to be updated. Required. - :type properties: IO + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GlobalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: @@ -855,24 +836,24 @@ def update( @distributed_trace def update( - self, global_rulestack_name: str, properties: Union[_models.GlobalRulestackResourceUpdate, IO], **kwargs: Any + self, + global_rulestack_name: str, + properties: Union[_models.GlobalRulestackResourceUpdate, IO[bytes]], + **kwargs: Any ) -> _models.GlobalRulestackResource: """Update a GlobalRulestackResource. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str :param properties: The resource properties to be updated. Is either a - GlobalRulestackResourceUpdate type or a IO type. Required. - :type properties: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResourceUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + GlobalRulestackResourceUpdate type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResourceUpdate or + IO[bytes] :return: GlobalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -895,44 +876,41 @@ def update( else: _json = self._serialize.body(properties, "GlobalRulestackResourceUpdate") - request = build_update_request( + _request = build_update_request( global_rulestack_name=global_rulestack_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("GlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}"} + return deserialized # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, global_rulestack_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -944,34 +922,49 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 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) + 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, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}"} + return deserialized # type: ignore @distributed_trace def begin_delete(self, global_rulestack_name: str, **kwargs: Any) -> LROPoller[None]: @@ -979,14 +972,6 @@ def begin_delete(self, global_rulestack_name: str, **kwargs: Any) -> LROPoller[N :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :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: @@ -1000,7 +985,7 @@ def begin_delete(self, global_rulestack_name: str, **kwargs: Any) -> LROPoller[N 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( # type: ignore + raw_result = self._delete_initial( global_rulestack_name=global_rulestack_name, api_version=api_version, cls=lambda x, y, z: x, @@ -1008,11 +993,12 @@ def begin_delete(self, global_rulestack_name: str, **kwargs: Any) -> LROPoller[N 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, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -1023,20 +1009,16 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}"} - - def _commit_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, **kwargs: Any - ) -> None: - error_map = { + def _commit_initial(self, global_rulestack_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1048,36 +1030,46 @@ def _commit_initial( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_commit_request( + _request = build_commit_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self._commit_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + 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, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _commit_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/commit" - } + return deserialized # type: ignore @distributed_trace def begin_commit(self, global_rulestack_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1085,14 +1077,6 @@ def begin_commit(self, global_rulestack_name: str, **kwargs: Any) -> LROPoller[N :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :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: @@ -1106,7 +1090,7 @@ def begin_commit(self, global_rulestack_name: str, **kwargs: Any) -> LROPoller[N 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._commit_initial( # type: ignore + raw_result = self._commit_initial( global_rulestack_name=global_rulestack_name, api_version=api_version, cls=lambda x, y, z: x, @@ -1114,11 +1098,12 @@ def begin_commit(self, global_rulestack_name: str, **kwargs: Any) -> LROPoller[N 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, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -1129,17 +1114,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_commit.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/commit" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get_change_log(self, global_rulestack_name: str, **kwargs: Any) -> _models.Changelog: @@ -1147,12 +1128,11 @@ def get_change_log(self, global_rulestack_name: str, **kwargs: Any) -> _models.C :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Changelog or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.Changelog :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1166,38 +1146,35 @@ def get_change_log(self, global_rulestack_name: str, **kwargs: Any) -> _models.C api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Changelog] = kwargs.pop("cls", None) - request = build_get_change_log_request( + _request = build_get_change_log_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.get_change_log.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Changelog", pipeline_response) + deserialized = self._deserialize("Changelog", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_change_log.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/getChangeLog" - } + return deserialized # type: ignore @distributed_trace def list_advanced_security_objects( @@ -1218,12 +1195,11 @@ def list_advanced_security_objects( :type skip: str :param top: Default value is None. :type top: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: AdvSecurityObjectListResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectListResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1237,41 +1213,38 @@ def list_advanced_security_objects( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AdvSecurityObjectListResponse] = kwargs.pop("cls", None) - request = build_list_advanced_security_objects_request( + _request = build_list_advanced_security_objects_request( global_rulestack_name=global_rulestack_name, type=type, skip=skip, top=top, api_version=api_version, - template_url=self.list_advanced_security_objects.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AdvSecurityObjectListResponse", pipeline_response) + deserialized = self._deserialize("AdvSecurityObjectListResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_advanced_security_objects.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listAdvancedSecurityObjects" - } + return deserialized # type: ignore @distributed_trace def list_app_ids( @@ -1295,12 +1268,11 @@ def list_app_ids( :type skip: str :param top: Default value is None. :type top: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: ListAppIdResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.ListAppIdResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1314,42 +1286,39 @@ def list_app_ids( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListAppIdResponse] = kwargs.pop("cls", None) - request = build_list_app_ids_request( + _request = build_list_app_ids_request( global_rulestack_name=global_rulestack_name, app_id_version=app_id_version, app_prefix=app_prefix, skip=skip, top=top, api_version=api_version, - template_url=self.list_app_ids.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAppIdResponse", pipeline_response) + deserialized = self._deserialize("ListAppIdResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_app_ids.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listAppIds" - } + return deserialized # type: ignore @distributed_trace def list_countries( @@ -1363,12 +1332,11 @@ def list_countries( :type skip: str :param top: Default value is None. :type top: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: CountriesResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.CountriesResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1382,40 +1350,37 @@ def list_countries( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CountriesResponse] = kwargs.pop("cls", None) - request = build_list_countries_request( + _request = build_list_countries_request( global_rulestack_name=global_rulestack_name, skip=skip, top=top, api_version=api_version, - template_url=self.list_countries.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CountriesResponse", pipeline_response) + deserialized = self._deserialize("CountriesResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_countries.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listCountries" - } + return deserialized # type: ignore @distributed_trace def list_firewalls(self, global_rulestack_name: str, **kwargs: Any) -> _models.ListFirewallsResponse: @@ -1423,12 +1388,11 @@ def list_firewalls(self, global_rulestack_name: str, **kwargs: Any) -> _models.L :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ListFirewallsResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.ListFirewallsResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1442,38 +1406,35 @@ def list_firewalls(self, global_rulestack_name: str, **kwargs: Any) -> _models.L api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListFirewallsResponse] = kwargs.pop("cls", None) - request = build_list_firewalls_request( + _request = build_list_firewalls_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.list_firewalls.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListFirewallsResponse", pipeline_response) + deserialized = self._deserialize("ListFirewallsResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_firewalls.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listFirewalls" - } + return deserialized # type: ignore @distributed_trace def list_predefined_url_categories( @@ -1487,12 +1448,11 @@ def list_predefined_url_categories( :type skip: str :param top: Default value is None. :type top: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: PredefinedUrlCategoriesResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.PredefinedUrlCategoriesResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1506,40 +1466,37 @@ def list_predefined_url_categories( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PredefinedUrlCategoriesResponse] = kwargs.pop("cls", None) - request = build_list_predefined_url_categories_request( + _request = build_list_predefined_url_categories_request( global_rulestack_name=global_rulestack_name, skip=skip, top=top, api_version=api_version, - template_url=self.list_predefined_url_categories.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PredefinedUrlCategoriesResponse", pipeline_response) + deserialized = self._deserialize("PredefinedUrlCategoriesResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_predefined_url_categories.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listPredefinedUrlCategories" - } + return deserialized # type: ignore @distributed_trace def list_security_services( @@ -1561,12 +1518,11 @@ def list_security_services( :type skip: str :param top: Default value is None. :type top: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: SecurityServicesResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SecurityServicesResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1580,41 +1536,38 @@ def list_security_services( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SecurityServicesResponse] = kwargs.pop("cls", None) - request = build_list_security_services_request( + _request = build_list_security_services_request( global_rulestack_name=global_rulestack_name, type=type, skip=skip, top=top, api_version=api_version, - template_url=self.list_security_services.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityServicesResponse", pipeline_response) + deserialized = self._deserialize("SecurityServicesResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_security_services.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listSecurityServices" - } + return deserialized # type: ignore @distributed_trace def revert( # pylint: disable=inconsistent-return-statements @@ -1624,12 +1577,11 @@ def revert( # pylint: disable=inconsistent-return-statements :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1643,29 +1595,28 @@ def revert( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_revert_request( + _request = build_revert_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.revert.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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, {}) - - revert.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/revert"} + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_local_rules_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_local_rules_operations.py index 66ce2c4250d2..433df83c4155 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_local_rules_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_local_rules_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,34 +6,38 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +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 .._serialization import Serializer -from .._vendor import _convert_request +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration +from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -45,14 +49,14 @@ def build_list_by_local_rulestacks_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -78,14 +82,14 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -112,7 +116,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -120,7 +124,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -149,14 +153,14 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -189,14 +193,14 @@ def build_get_counters_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}/getCounters", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -231,14 +235,14 @@ def build_refresh_counters_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}/refreshCounters", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -273,14 +277,14 @@ def build_reset_counters_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}/resetCounters", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -315,17 +319,19 @@ class LocalRulesOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + 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_by_local_rulestacks( self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> Iterable["_models.LocalRulesResource"]: + ) -> ItemPaged["_models.LocalRulesResource"]: """List LocalRulesResource resources by LocalRulestacks. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -333,7 +339,6 @@ def list_by_local_rulestacks( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LocalRulesResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource] @@ -345,7 +350,7 @@ def list_by_local_rulestacks( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LocalRulesResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -356,17 +361,15 @@ def list_by_local_rulestacks( def prepare_request(next_link=None): if not next_link: - request = build_list_by_local_rulestacks_request( + _request = build_list_by_local_rulestacks_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_local_rulestacks.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -378,13 +381,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("LocalRulesResourceListResult", pipeline_response) @@ -394,27 +396,26 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - list_by_local_rulestacks.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules" - } - @distributed_trace def get( self, resource_group_name: str, local_rulestack_name: str, priority: str, **kwargs: Any @@ -428,12 +429,11 @@ def get( :type local_rulestack_name: str :param priority: Local Rule priority. Required. :type priority: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LocalRulesResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -447,51 +447,48 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LocalRulesResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, priority=priority, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalRulesResource", pipeline_response) + deserialized = self._deserialize("LocalRulesResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, local_rulestack_name: str, priority: str, - resource: Union[_models.LocalRulesResource, IO], + resource: Union[_models.LocalRulesResource, IO[bytes]], **kwargs: Any - ) -> _models.LocalRulesResource: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -504,7 +501,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LocalRulesResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -514,7 +511,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(resource, "LocalRulesResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, priority=priority, @@ -523,40 +520,45 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("LocalRulesResource", pipeline_response) - + response_headers = {} if response.status_code == 201: - deserialized = self._deserialize("LocalRulesResource", pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}" - } - @overload def begin_create_or_update( self, @@ -582,14 +584,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either LocalRulesResource or the result of cls(response) :rtype: @@ -603,7 +597,7 @@ def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, priority: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -618,18 +612,10 @@ def begin_create_or_update( :param priority: Local Rule priority. Required. :type priority: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either LocalRulesResource or the result of cls(response) :rtype: @@ -643,7 +629,7 @@ def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, priority: str, - resource: Union[_models.LocalRulesResource, IO], + resource: Union[_models.LocalRulesResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.LocalRulesResource]: """Create a LocalRulesResource. @@ -655,20 +641,9 @@ def begin_create_or_update( :type local_rulestack_name: str :param priority: Local Rule priority. Required. :type priority: str - :param resource: Resource create parameters. Is either a LocalRulesResource type or a IO type. - Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param resource: Resource create parameters. Is either a LocalRulesResource type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource or IO[bytes] :return: An instance of LROPoller that returns either LocalRulesResource or the result of cls(response) :rtype: @@ -697,12 +672,13 @@ def begin_create_or_update( 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("LocalRulesResource", pipeline_response) + deserialized = self._deserialize("LocalRulesResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -714,22 +690,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.LocalRulesResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}" - } + return LROPoller[_models.LocalRulesResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, local_rulestack_name: str, priority: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -741,39 +715,52 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, priority=priority, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 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) + 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, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -788,14 +775,6 @@ def begin_delete( :type local_rulestack_name: str :param priority: Local Rule priority. Required. :type priority: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :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: @@ -809,7 +788,7 @@ def begin_delete( 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( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, priority=priority, @@ -819,11 +798,12 @@ def begin_delete( 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, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -834,17 +814,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get_counters( @@ -866,12 +842,11 @@ def get_counters( :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCounter or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounter :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -885,42 +860,39 @@ def get_counters( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RuleCounter] = kwargs.pop("cls", None) - request = build_get_counters_request( + _request = build_get_counters_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, priority=priority, subscription_id=self._config.subscription_id, firewall_name=firewall_name, api_version=api_version, - template_url=self.get_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleCounter", pipeline_response) + deserialized = self._deserialize("RuleCounter", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_counters.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}/getCounters" - } + return deserialized # type: ignore @distributed_trace def refresh_counters( # pylint: disable=inconsistent-return-statements @@ -942,12 +914,11 @@ def refresh_counters( # pylint: disable=inconsistent-return-statements :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -961,38 +932,35 @@ def refresh_counters( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_refresh_counters_request( + _request = build_refresh_counters_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, priority=priority, subscription_id=self._config.subscription_id, firewall_name=firewall_name, api_version=api_version, - template_url=self.refresh_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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, {}) - - refresh_counters.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}/refreshCounters" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def reset_counters( @@ -1014,12 +982,11 @@ def reset_counters( :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCounterReset or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounterReset :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1033,39 +1000,36 @@ def reset_counters( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RuleCounterReset] = kwargs.pop("cls", None) - request = build_reset_counters_request( + _request = build_reset_counters_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, priority=priority, subscription_id=self._config.subscription_id, firewall_name=firewall_name, api_version=api_version, - template_url=self.reset_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleCounterReset", pipeline_response) + deserialized = self._deserialize("RuleCounterReset", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - reset_counters.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}/resetCounters" - } + return deserialized # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_local_rulestacks_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_local_rulestacks_operations.py index 465af4ad9ac9..5870e7defd31 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_local_rulestacks_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_local_rulestacks_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,34 +6,38 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +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 .._serialization import Serializer -from .._vendor import _convert_request +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration +from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -43,7 +47,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,14 +73,14 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -101,14 +105,14 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -134,7 +138,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -142,7 +146,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -170,7 +174,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -178,7 +182,7 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -206,14 +210,14 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -239,14 +243,14 @@ def build_commit_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/commit", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -272,14 +276,14 @@ def build_get_change_log_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/getChangeLog", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -310,14 +314,14 @@ def build_get_support_info_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/getSupportInfo", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -339,7 +343,7 @@ def build_get_support_info_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_advanced_security_objects_request( +def build_list_advanced_security_objects_request( # pylint: disable=name-too-long resource_group_name: str, local_rulestack_name: str, subscription_id: str, @@ -352,14 +356,14 @@ def build_list_advanced_security_objects_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listAdvancedSecurityObjects", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -384,20 +388,112 @@ def build_list_advanced_security_objects_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) +def build_list_app_ids_request( + resource_group_name: str, + local_rulestack_name: str, + subscription_id: str, + *, + app_id_version: Optional[str] = None, + app_prefix: Optional[str] = None, + skip: Optional[str] = None, + top: Optional[int] = None, + **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-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listAppIds", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if app_id_version is not None: + _params["appIdVersion"] = _SERIALIZER.query("app_id_version", app_id_version, "str") + if app_prefix is not None: + _params["appPrefix"] = _SERIALIZER.query("app_prefix", app_prefix, "str") + if skip is not None: + _params["skip"] = _SERIALIZER.query("skip", skip, "str") + if top is not None: + _params["top"] = _SERIALIZER.query("top", top, "int") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_countries_request( + resource_group_name: str, + local_rulestack_name: str, + subscription_id: str, + *, + skip: Optional[str] = None, + top: Optional[int] = None, + **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-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listCountries", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip is not None: + _params["skip"] = _SERIALIZER.query("skip", skip, "str") + if top is not None: + _params["top"] = _SERIALIZER.query("top", top, "int") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + def build_list_firewalls_request( resource_group_name: str, local_rulestack_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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listFirewalls", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -417,6 +513,49 @@ def build_list_firewalls_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) +def build_list_predefined_url_categories_request( # pylint: disable=name-too-long + resource_group_name: str, + local_rulestack_name: str, + subscription_id: str, + *, + skip: Optional[str] = None, + top: Optional[int] = None, + **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-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listPredefinedUrlCategories", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip is not None: + _params["skip"] = _SERIALIZER.query("skip", skip, "str") + if top is not None: + _params["top"] = _SERIALIZER.query("top", top, "int") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + def build_list_security_services_request( resource_group_name: str, local_rulestack_name: str, @@ -430,14 +569,14 @@ def build_list_security_services_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listSecurityServices", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -468,14 +607,14 @@ def build_revert_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/revert", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -507,18 +646,19 @@ class LocalRulestacksOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + 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_by_subscription(self, **kwargs: Any) -> Iterable["_models.LocalRulestackResource"]: + def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.LocalRulestackResource"]: """List LocalRulestackResource resources by subscription ID. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LocalRulestackResource or the result of cls(response) :rtype: @@ -531,7 +671,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.LocalRulestac api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LocalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -542,15 +682,13 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.LocalRulestac def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -562,13 +700,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("LocalRulestackResourceListResult", pipeline_response) @@ -578,37 +715,35 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks" - } - @distributed_trace def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.LocalRulestackResource"]: + ) -> ItemPaged["_models.LocalRulestackResource"]: """List LocalRulestackResource resources by resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LocalRulestackResource or the result of cls(response) :rtype: @@ -621,7 +756,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LocalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -632,16 +767,14 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -653,13 +786,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("LocalRulestackResourceListResult", pipeline_response) @@ -669,27 +801,26 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks" - } - @distributed_trace def get(self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any) -> _models.LocalRulestackResource: """Get a LocalRulestackResource. @@ -699,12 +830,11 @@ def get(self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LocalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -718,49 +848,46 @@ def get(self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LocalRulestackResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalRulestackResource", pipeline_response) + deserialized = self._deserialize("LocalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, local_rulestack_name: str, - resource: Union[_models.LocalRulestackResource, IO], + resource: Union[_models.LocalRulestackResource, IO[bytes]], **kwargs: Any - ) -> _models.LocalRulestackResource: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -773,7 +900,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LocalRulestackResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -783,7 +910,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(resource, "LocalRulestackResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, @@ -791,40 +918,45 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("LocalRulestackResource", pipeline_response) - + response_headers = {} if response.status_code == 201: - deserialized = self._deserialize("LocalRulestackResource", pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" - } - @overload def begin_create_or_update( self, @@ -847,14 +979,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either LocalRulestackResource or the result of cls(response) :rtype: @@ -867,7 +991,7 @@ def begin_create_or_update( self, resource_group_name: str, local_rulestack_name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -880,18 +1004,10 @@ def begin_create_or_update( :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either LocalRulestackResource or the result of cls(response) :rtype: @@ -904,7 +1020,7 @@ def begin_create_or_update( self, resource_group_name: str, local_rulestack_name: str, - resource: Union[_models.LocalRulestackResource, IO], + resource: Union[_models.LocalRulestackResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.LocalRulestackResource]: """Create a LocalRulestackResource. @@ -914,20 +1030,9 @@ def begin_create_or_update( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :param resource: Resource create parameters. Is either a LocalRulestackResource type or a IO - type. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param resource: Resource create parameters. Is either a LocalRulestackResource type or a + IO[bytes] type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource or IO[bytes] :return: An instance of LROPoller that returns either LocalRulestackResource or the result of cls(response) :rtype: @@ -955,12 +1060,13 @@ def begin_create_or_update( 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("LocalRulestackResource", pipeline_response) + deserialized = self._deserialize("LocalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -972,17 +1078,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.LocalRulestackResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" - } + return LROPoller[_models.LocalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload def update( @@ -1006,7 +1110,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LocalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: @@ -1017,7 +1120,7 @@ def update( self, resource_group_name: str, local_rulestack_name: str, - properties: IO, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1030,11 +1133,10 @@ def update( :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str :param properties: The resource properties to be updated. Required. - :type properties: IO + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LocalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: @@ -1045,7 +1147,7 @@ def update( self, resource_group_name: str, local_rulestack_name: str, - properties: Union[_models.LocalRulestackResourceUpdate, IO], + properties: Union[_models.LocalRulestackResourceUpdate, IO[bytes]], **kwargs: Any ) -> _models.LocalRulestackResource: """Update a LocalRulestackResource. @@ -1056,17 +1158,14 @@ def update( :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str :param properties: The resource properties to be updated. Is either a - LocalRulestackResourceUpdate type or a IO type. Required. - :type properties: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResourceUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + LocalRulestackResourceUpdate type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResourceUpdate or + IO[bytes] :return: LocalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1089,7 +1188,7 @@ def update( else: _json = self._serialize.body(properties, "LocalRulestackResourceUpdate") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, @@ -1097,40 +1196,35 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalRulestackResource", pipeline_response) + deserialized = self._deserialize("LocalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" - } + return deserialized # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1142,38 +1236,51 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 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) + 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, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" - } + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1184,14 +1291,6 @@ def begin_delete(self, resource_group_name: str, local_rulestack_name: str, **kw :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :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: @@ -1205,7 +1304,7 @@ def begin_delete(self, resource_group_name: str, local_rulestack_name: str, **kw 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( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, api_version=api_version, @@ -1214,11 +1313,12 @@ def begin_delete(self, resource_group_name: str, local_rulestack_name: str, **kw 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, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -1229,22 +1329,16 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _commit_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> None: - error_map = { + def _commit_initial(self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1256,38 +1350,48 @@ def _commit_initial( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_commit_request( + _request = build_commit_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._commit_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + 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, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _commit_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/commit" - } + return deserialized # type: ignore @distributed_trace def begin_commit(self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1298,14 +1402,6 @@ def begin_commit(self, resource_group_name: str, local_rulestack_name: str, **kw :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :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: @@ -1319,7 +1415,7 @@ def begin_commit(self, resource_group_name: str, local_rulestack_name: str, **kw 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._commit_initial( # type: ignore + raw_result = self._commit_initial( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, api_version=api_version, @@ -1328,11 +1424,12 @@ def begin_commit(self, resource_group_name: str, local_rulestack_name: str, **kw 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, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -1343,17 +1440,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_commit.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/commit" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get_change_log(self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any) -> _models.Changelog: @@ -1364,12 +1457,11 @@ def get_change_log(self, resource_group_name: str, local_rulestack_name: str, ** :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Changelog or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.Changelog :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1383,40 +1475,37 @@ def get_change_log(self, resource_group_name: str, local_rulestack_name: str, ** api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Changelog] = kwargs.pop("cls", None) - request = build_get_change_log_request( + _request = build_get_change_log_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_change_log.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Changelog", pipeline_response) + deserialized = self._deserialize("Changelog", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_change_log.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/getChangeLog" - } + return deserialized # type: ignore @distributed_trace def get_support_info( @@ -1431,12 +1520,11 @@ def get_support_info( :type local_rulestack_name: str :param email: email address on behalf of which this API called. Default value is None. :type email: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SupportInfo or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SupportInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1450,41 +1538,38 @@ def get_support_info( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SupportInfo] = kwargs.pop("cls", None) - request = build_get_support_info_request( + _request = build_get_support_info_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, email=email, api_version=api_version, - template_url=self.get_support_info.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SupportInfo", pipeline_response) + deserialized = self._deserialize("SupportInfo", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_support_info.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/getSupportInfo" - } + return deserialized # type: ignore @distributed_trace def list_advanced_security_objects( @@ -1509,12 +1594,11 @@ def list_advanced_security_objects( :type skip: str :param top: Default value is None. :type top: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: AdvSecurityObjectListResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectListResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1528,7 +1612,7 @@ def list_advanced_security_objects( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AdvSecurityObjectListResponse] = kwargs.pop("cls", None) - request = build_list_advanced_security_objects_request( + _request = build_list_advanced_security_objects_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, @@ -1536,35 +1620,236 @@ def list_advanced_security_objects( skip=skip, top=top, api_version=api_version, - template_url=self.list_advanced_security_objects.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AdvSecurityObjectListResponse", pipeline_response) + deserialized = self._deserialize("AdvSecurityObjectListResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - list_advanced_security_objects.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listAdvancedSecurityObjects" - } + @distributed_trace + def list_app_ids( + self, + resource_group_name: str, + local_rulestack_name: str, + app_id_version: Optional[str] = None, + app_prefix: Optional[str] = None, + skip: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> ItemPaged[str]: + """List of AppIds for LocalRulestack ApiVersion. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param local_rulestack_name: LocalRulestack resource name. Required. + :type local_rulestack_name: str + :param app_id_version: Default value is None. + :type app_id_version: str + :param app_prefix: Default value is None. + :type app_prefix: str + :param skip: Default value is None. + :type skip: str + :param top: Default value is None. + :type top: int + :return: An iterator like instance of either str or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[str] + :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.ListAppIdResponse] = 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_app_ids_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + subscription_id=self._config.subscription_id, + app_id_version=app_id_version, + app_prefix=app_prefix, + skip=skip, + top=top, + 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("ListAppIdResponse", 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_countries( + self, + resource_group_name: str, + local_rulestack_name: str, + skip: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> ItemPaged["_models.Country"]: + """List of countries for Rulestack. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param local_rulestack_name: LocalRulestack resource name. Required. + :type local_rulestack_name: str + :param skip: Default value is None. + :type skip: str + :param top: Default value is None. + :type top: int + :return: An iterator like instance of either Country or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.Country] + :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.CountriesResponse] = 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_countries_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + subscription_id=self._config.subscription_id, + skip=skip, + top=top, + 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("CountriesResponse", 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_firewalls( @@ -1577,12 +1862,11 @@ def list_firewalls( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ListFirewallsResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.ListFirewallsResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1596,40 +1880,137 @@ def list_firewalls( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListFirewallsResponse] = kwargs.pop("cls", None) - request = build_list_firewalls_request( + _request = build_list_firewalls_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_firewalls.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListFirewallsResponse", pipeline_response) + deserialized = self._deserialize("ListFirewallsResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - list_firewalls.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listFirewalls" - } + @distributed_trace + def list_predefined_url_categories( + self, + resource_group_name: str, + local_rulestack_name: str, + skip: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> ItemPaged["_models.PredefinedUrlCategory"]: + """List predefined URL categories for rulestack. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param local_rulestack_name: LocalRulestack resource name. Required. + :type local_rulestack_name: str + :param skip: Default value is None. + :type skip: str + :param top: Default value is None. + :type top: int + :return: An iterator like instance of either PredefinedUrlCategory or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.PredefinedUrlCategory] + :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.PredefinedUrlCategoriesResponse] = 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_predefined_url_categories_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + subscription_id=self._config.subscription_id, + skip=skip, + top=top, + 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("PredefinedUrlCategoriesResponse", 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_security_services( @@ -1655,12 +2036,11 @@ def list_security_services( :type skip: str :param top: Default value is None. :type top: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: SecurityServicesResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SecurityServicesResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1674,7 +2054,7 @@ def list_security_services( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SecurityServicesResponse] = kwargs.pop("cls", None) - request = build_list_security_services_request( + _request = build_list_security_services_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, @@ -1682,35 +2062,32 @@ def list_security_services( skip=skip, top=top, api_version=api_version, - template_url=self.list_security_services.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityServicesResponse", pipeline_response) + deserialized = self._deserialize("SecurityServicesResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_security_services.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listSecurityServices" - } + return deserialized # type: ignore @distributed_trace def revert( # pylint: disable=inconsistent-return-statements @@ -1723,12 +2100,11 @@ def revert( # pylint: disable=inconsistent-return-statements :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1742,33 +2118,30 @@ def revert( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_revert_request( + _request = build_revert_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.revert.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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, {}) - - revert.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/revert" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_metrics_object_firewall_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_metrics_object_firewall_operations.py new file mode 100644 index 000000000000..65806823c614 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_metrics_object_firewall_operations.py @@ -0,0 +1,690 @@ +# 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 PaloAltoNetworksNgfwMgmtClientConfiguration +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_by_firewalls_request( + resource_group_name: str, firewall_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-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/metrics", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "firewallName": _SERIALIZER.url( + "firewall_name", + firewall_name, + "str", + pattern=r"^(?![-_])(?!.*[-_]{2})(?!.*[-_]$)[a-zA-Z0-9][a-zA-Z0-9-]{0,127}$", + ), + } + + _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, firewall_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-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/metrics/default", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "firewallName": _SERIALIZER.url( + "firewall_name", + firewall_name, + "str", + pattern=r"^(?![-_])(?!.*[-_]{2})(?!.*[-_]$)[a-zA-Z0-9][a-zA-Z0-9-]{0,127}$", + ), + } + + _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, firewall_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-10-08")) + 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/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/metrics/default", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "firewallName": _SERIALIZER.url( + "firewall_name", + firewall_name, + "str", + pattern=r"^(?![-_])(?!.*[-_]{2})(?!.*[-_]$)[a-zA-Z0-9][a-zA-Z0-9-]{0,127}$", + ), + } + + _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, firewall_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-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/metrics/default", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "firewallName": _SERIALIZER.url( + "firewall_name", + firewall_name, + "str", + pattern=r"^(?![-_])(?!.*[-_]{2})(?!.*[-_]$)[a-zA-Z0-9][a-zA-Z0-9-]{0,127}$", + ), + } + + _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 MetricsObjectFirewallOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient`'s + :attr:`metrics_object_firewall` 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: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + 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_by_firewalls( + self, resource_group_name: str, firewall_name: str, **kwargs: Any + ) -> ItemPaged["_models.MetricsObjectFirewallResource"]: + """List MetricsObjectFirewallResource resources by Firewalls. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param firewall_name: Firewall resource name. Required. + :type firewall_name: str + :return: An iterator like instance of either MetricsObjectFirewallResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.MetricsObjectFirewallResource] + :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.MetricsObjectFirewallResourceListResult] = 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_firewalls_request( + resource_group_name=resource_group_name, + firewall_name=firewall_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("MetricsObjectFirewallResourceListResult", 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, firewall_name: str, **kwargs: Any) -> _models.MetricsObjectFirewallResource: + """Get a MetricsObjectFirewallResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param firewall_name: Firewall resource name. Required. + :type firewall_name: str + :return: MetricsObjectFirewallResource or the result of cls(response) + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.MetricsObjectFirewallResource + :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.MetricsObjectFirewallResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + firewall_name=firewall_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("MetricsObjectFirewallResource", 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, + firewall_name: str, + resource: Union[_models.MetricsObjectFirewallResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "MetricsObjectFirewallResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + firewall_name=firewall_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, + firewall_name: str, + resource: _models.MetricsObjectFirewallResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MetricsObjectFirewallResource]: + """Create a MetricsObjectFirewallResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param firewall_name: Firewall resource name. Required. + :type firewall_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.MetricsObjectFirewallResource + :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 MetricsObjectFirewallResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.MetricsObjectFirewallResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + firewall_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MetricsObjectFirewallResource]: + """Create a MetricsObjectFirewallResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param firewall_name: Firewall resource name. Required. + :type firewall_name: str + :param resource: Resource create parameters. Required. + :type resource: 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 MetricsObjectFirewallResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.MetricsObjectFirewallResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + firewall_name: str, + resource: Union[_models.MetricsObjectFirewallResource, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.MetricsObjectFirewallResource]: + """Create a MetricsObjectFirewallResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param firewall_name: Firewall resource name. Required. + :type firewall_name: str + :param resource: Resource create parameters. Is either a MetricsObjectFirewallResource type or + a IO[bytes] type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.MetricsObjectFirewallResource or + IO[bytes] + :return: An instance of LROPoller that returns either MetricsObjectFirewallResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.MetricsObjectFirewallResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MetricsObjectFirewallResource] = 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, + firewall_name=firewall_name, + resource=resource, + 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("MetricsObjectFirewallResource", 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.MetricsObjectFirewallResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.MetricsObjectFirewallResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, resource_group_name: str, firewall_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, + firewall_name=firewall_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["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 + + @distributed_trace + def begin_delete(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> LROPoller[None]: + """Delete a MetricsObjectFirewallResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param firewall_name: Firewall resource name. Required. + :type firewall_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, + firewall_name=firewall_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": "azure-async-operation"}, **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/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_operations.py index f169399f6005..60059a3187f7 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -19,18 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +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 .._serialization import Serializer -from .._vendor import _convert_request +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration +from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -40,7 +41,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,18 +68,19 @@ class Operations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: + def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: """List the operations for the provider. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Operation or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: @@ -89,7 +91,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,14 +102,12 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -119,13 +119,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) @@ -135,21 +134,22 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/operations"} diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_palo_alto_networks_cloudngfw_operations_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_palo_alto_networks_cloudngfw_operations_operations.py new file mode 100644 index 000000000000..39dd925a1836 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_palo_alto_networks_cloudngfw_operations_operations.py @@ -0,0 +1,376 @@ +# 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 PaloAltoNetworksNgfwMgmtClientConfiguration +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_create_product_serial_number_request( # pylint: disable=name-too-long + 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-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/createProductSerialNumber" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", 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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_cloud_manager_tenants_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-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/listCloudManagerTenants" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", 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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_product_serial_number_status_request( # pylint: disable=name-too-long + 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-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/listProductSerialNumberStatus", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", 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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_support_info_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-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/listSupportInfo" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", 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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class PaloAltoNetworksCloudngfwOperationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient`'s + :attr:`palo_alto_networks_cloudngfw_operations` 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: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + 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 create_product_serial_number(self, **kwargs: Any) -> _models.ProductSerialNumberRequestStatus: + """create_product_serial_number. + + :return: ProductSerialNumberRequestStatus or the result of cls(response) + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.ProductSerialNumberRequestStatus + :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.ProductSerialNumberRequestStatus] = kwargs.pop("cls", None) + + _request = build_create_product_serial_number_request( + 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("ProductSerialNumberRequestStatus", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_cloud_manager_tenants(self, **kwargs: Any) -> _models.CloudManagerTenantList: + """list_cloud_manager_tenants. + + :return: CloudManagerTenantList or the result of cls(response) + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.CloudManagerTenantList + :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.CloudManagerTenantList] = kwargs.pop("cls", None) + + _request = build_list_cloud_manager_tenants_request( + 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("CloudManagerTenantList", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_product_serial_number_status(self, **kwargs: Any) -> Optional[_models.ProductSerialNumberStatus]: + """list_product_serial_number_status. + + :return: ProductSerialNumberStatus or None or the result of cls(response) + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.ProductSerialNumberStatus or 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[Optional[_models.ProductSerialNumberStatus]] = kwargs.pop("cls", None) + + _request = build_list_product_serial_number_status_request( + 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, 404]: + 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 = None + if response.status_code == 200: + deserialized = self._deserialize("ProductSerialNumberStatus", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_support_info(self, **kwargs: Any) -> _models.SupportInfoModel: + """list_support_info. + + :return: SupportInfoModel or the result of cls(response) + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SupportInfoModel + :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.SupportInfoModel] = kwargs.pop("cls", None) + + _request = build_list_support_info_request( + 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("SupportInfoModel", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_patch.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_patch.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_post_rules_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_post_rules_operations.py index 9fb02c01406a..27497fc13250 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_post_rules_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_post_rules_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,34 +6,38 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +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 .._serialization import Serializer -from .._vendor import _convert_request +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration +from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -43,13 +47,13 @@ def build_list_request(global_rulestack_name: 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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), } @@ -69,14 +73,14 @@ def build_get_request(global_rulestack_name: str, priority: str, **kwargs: Any) _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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), "priority": _SERIALIZER.url("priority", priority, "str"), @@ -97,7 +101,7 @@ def build_create_or_update_request(global_rulestack_name: str, priority: str, ** _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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -105,7 +109,7 @@ def build_create_or_update_request(global_rulestack_name: str, priority: str, ** _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), "priority": _SERIALIZER.url("priority", priority, "str"), @@ -128,14 +132,14 @@ def build_delete_request(global_rulestack_name: str, priority: str, **kwargs: An _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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), "priority": _SERIALIZER.url("priority", priority, "str"), @@ -158,14 +162,14 @@ def build_get_counters_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}/getCounters", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), "priority": _SERIALIZER.url("priority", priority, "str"), @@ -190,14 +194,14 @@ def build_refresh_counters_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}/refreshCounters", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), "priority": _SERIALIZER.url("priority", priority, "str"), @@ -222,14 +226,14 @@ def build_reset_counters_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}/resetCounters", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), "priority": _SERIALIZER.url("priority", priority, "str"), @@ -260,20 +264,21 @@ class PostRulesOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + 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, global_rulestack_name: str, **kwargs: Any) -> Iterable["_models.PostRulesResource"]: + def list(self, global_rulestack_name: str, **kwargs: Any) -> ItemPaged["_models.PostRulesResource"]: """List PostRulesResource resources by Tenant. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PostRulesResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource] :raises ~azure.core.exceptions.HttpResponseError: @@ -284,7 +289,7 @@ def list(self, global_rulestack_name: str, **kwargs: Any) -> Iterable["_models.P api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PostRulesResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -295,15 +300,13 @@ def list(self, global_rulestack_name: str, **kwargs: Any) -> Iterable["_models.P def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -315,13 +318,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PostRulesResourceListResult", pipeline_response) @@ -331,25 +333,26 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules"} - @distributed_trace def get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> _models.PostRulesResource: """Get a PostRulesResource. @@ -358,12 +361,11 @@ def get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> _mode :type global_rulestack_name: str :param priority: Post Rule priority. Required. :type priority: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PostRulesResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -377,44 +379,45 @@ def get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> _mode api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PostRulesResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PostRulesResource", pipeline_response) + deserialized = self._deserialize("PostRulesResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}" - } + return deserialized # type: ignore def _create_or_update_initial( - self, global_rulestack_name: str, priority: str, resource: Union[_models.PostRulesResource, IO], **kwargs: Any - ) -> _models.PostRulesResource: - error_map = { + self, + global_rulestack_name: str, + priority: str, + resource: Union[_models.PostRulesResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -427,7 +430,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PostRulesResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -437,47 +440,52 @@ def _create_or_update_initial( else: _json = self._serialize.body(resource, "PostRulesResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PostRulesResource", pipeline_response) - + response_headers = {} if response.status_code == 201: - deserialized = self._deserialize("PostRulesResource", pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}" - } - @overload def begin_create_or_update( self, @@ -499,14 +507,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PostRulesResource or the result of cls(response) :rtype: @@ -519,7 +519,7 @@ def begin_create_or_update( self, global_rulestack_name: str, priority: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -531,18 +531,10 @@ def begin_create_or_update( :param priority: Post Rule priority. Required. :type priority: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PostRulesResource or the result of cls(response) :rtype: @@ -552,7 +544,11 @@ def begin_create_or_update( @distributed_trace def begin_create_or_update( - self, global_rulestack_name: str, priority: str, resource: Union[_models.PostRulesResource, IO], **kwargs: Any + self, + global_rulestack_name: str, + priority: str, + resource: Union[_models.PostRulesResource, IO[bytes]], + **kwargs: Any ) -> LROPoller[_models.PostRulesResource]: """Create a PostRulesResource. @@ -560,20 +556,9 @@ def begin_create_or_update( :type global_rulestack_name: str :param priority: Post Rule priority. Required. :type priority: str - :param resource: Resource create parameters. Is either a PostRulesResource type or a IO type. - Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param resource: Resource create parameters. Is either a PostRulesResource type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource or IO[bytes] :return: An instance of LROPoller that returns either PostRulesResource or the result of cls(response) :rtype: @@ -601,12 +586,13 @@ def begin_create_or_update( 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("PostRulesResource", pipeline_response) + deserialized = self._deserialize("PostRulesResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -618,22 +604,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.PostRulesResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}" - } + return LROPoller[_models.PostRulesResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, priority: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -645,37 +627,50 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 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) + 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, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}" - } + return deserialized # type: ignore @distributed_trace def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> LROPoller[None]: @@ -685,14 +680,6 @@ def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs: Any) :type global_rulestack_name: str :param priority: Post Rule priority. Required. :type priority: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :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: @@ -706,7 +693,7 @@ def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs: Any) 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( # type: ignore + raw_result = self._delete_initial( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, @@ -715,11 +702,12 @@ def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs: Any) 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, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -730,17 +718,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get_counters( @@ -754,12 +738,11 @@ def get_counters( :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCounter or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounter :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -773,40 +756,37 @@ def get_counters( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RuleCounter] = kwargs.pop("cls", None) - request = build_get_counters_request( + _request = build_get_counters_request( global_rulestack_name=global_rulestack_name, priority=priority, firewall_name=firewall_name, api_version=api_version, - template_url=self.get_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleCounter", pipeline_response) + deserialized = self._deserialize("RuleCounter", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}/getCounters" - } + return deserialized # type: ignore @distributed_trace def refresh_counters( # pylint: disable=inconsistent-return-statements @@ -820,12 +800,11 @@ def refresh_counters( # pylint: disable=inconsistent-return-statements :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -839,36 +818,33 @@ def refresh_counters( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_refresh_counters_request( + _request = build_refresh_counters_request( global_rulestack_name=global_rulestack_name, priority=priority, firewall_name=firewall_name, api_version=api_version, - template_url=self.refresh_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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, {}) - - refresh_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}/refreshCounters" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def reset_counters( @@ -882,12 +858,11 @@ def reset_counters( :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCounterReset or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounterReset :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -901,37 +876,34 @@ def reset_counters( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RuleCounterReset] = kwargs.pop("cls", None) - request = build_reset_counters_request( + _request = build_reset_counters_request( global_rulestack_name=global_rulestack_name, priority=priority, firewall_name=firewall_name, api_version=api_version, - template_url=self.reset_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleCounterReset", pipeline_response) + deserialized = self._deserialize("RuleCounterReset", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - reset_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}/resetCounters" - } + return deserialized # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_pre_rules_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_pre_rules_operations.py index d272deda4bc9..25ef80bc5964 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_pre_rules_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_pre_rules_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,34 +6,38 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +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 .._serialization import Serializer -from .._vendor import _convert_request +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration +from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -43,13 +47,13 @@ def build_list_request(global_rulestack_name: 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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), } @@ -69,14 +73,14 @@ def build_get_request(global_rulestack_name: str, priority: str, **kwargs: Any) _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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), "priority": _SERIALIZER.url("priority", priority, "str"), @@ -97,7 +101,7 @@ def build_create_or_update_request(global_rulestack_name: str, priority: str, ** _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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -105,7 +109,7 @@ def build_create_or_update_request(global_rulestack_name: str, priority: str, ** _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), "priority": _SERIALIZER.url("priority", priority, "str"), @@ -128,14 +132,14 @@ def build_delete_request(global_rulestack_name: str, priority: str, **kwargs: An _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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), "priority": _SERIALIZER.url("priority", priority, "str"), @@ -158,14 +162,14 @@ def build_get_counters_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}/getCounters", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), "priority": _SERIALIZER.url("priority", priority, "str"), @@ -190,14 +194,14 @@ def build_refresh_counters_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}/refreshCounters", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), "priority": _SERIALIZER.url("priority", priority, "str"), @@ -222,14 +226,14 @@ def build_reset_counters_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}/resetCounters", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), "priority": _SERIALIZER.url("priority", priority, "str"), @@ -260,20 +264,21 @@ class PreRulesOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + 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, global_rulestack_name: str, **kwargs: Any) -> Iterable["_models.PreRulesResource"]: + def list(self, global_rulestack_name: str, **kwargs: Any) -> ItemPaged["_models.PreRulesResource"]: """List PreRulesResource resources by Tenant. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PreRulesResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource] :raises ~azure.core.exceptions.HttpResponseError: @@ -284,7 +289,7 @@ def list(self, global_rulestack_name: str, **kwargs: Any) -> Iterable["_models.P api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PreRulesResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -295,15 +300,13 @@ def list(self, global_rulestack_name: str, **kwargs: Any) -> Iterable["_models.P def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -315,13 +318,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PreRulesResourceListResult", pipeline_response) @@ -331,25 +333,26 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules"} - @distributed_trace def get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> _models.PreRulesResource: """Get a PreRulesResource. @@ -358,12 +361,11 @@ def get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> _mode :type global_rulestack_name: str :param priority: Pre Rule priority. Required. :type priority: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PreRulesResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -377,44 +379,45 @@ def get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> _mode api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PreRulesResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PreRulesResource", pipeline_response) + deserialized = self._deserialize("PreRulesResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}" - } + return deserialized # type: ignore def _create_or_update_initial( - self, global_rulestack_name: str, priority: str, resource: Union[_models.PreRulesResource, IO], **kwargs: Any - ) -> _models.PreRulesResource: - error_map = { + self, + global_rulestack_name: str, + priority: str, + resource: Union[_models.PreRulesResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -427,7 +430,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PreRulesResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -437,47 +440,52 @@ def _create_or_update_initial( else: _json = self._serialize.body(resource, "PreRulesResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PreRulesResource", pipeline_response) - + response_headers = {} if response.status_code == 201: - deserialized = self._deserialize("PreRulesResource", pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}" - } - @overload def begin_create_or_update( self, @@ -499,14 +507,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PreRulesResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource] @@ -518,7 +518,7 @@ def begin_create_or_update( self, global_rulestack_name: str, priority: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -530,18 +530,10 @@ def begin_create_or_update( :param priority: Pre Rule priority. Required. :type priority: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PreRulesResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource] @@ -550,7 +542,11 @@ def begin_create_or_update( @distributed_trace def begin_create_or_update( - self, global_rulestack_name: str, priority: str, resource: Union[_models.PreRulesResource, IO], **kwargs: Any + self, + global_rulestack_name: str, + priority: str, + resource: Union[_models.PreRulesResource, IO[bytes]], + **kwargs: Any ) -> LROPoller[_models.PreRulesResource]: """Create a PreRulesResource. @@ -558,20 +554,9 @@ def begin_create_or_update( :type global_rulestack_name: str :param priority: Pre Rule priority. Required. :type priority: str - :param resource: Resource create parameters. Is either a PreRulesResource type or a IO type. - Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param resource: Resource create parameters. Is either a PreRulesResource type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource or IO[bytes] :return: An instance of LROPoller that returns either PreRulesResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource] @@ -598,12 +583,13 @@ def begin_create_or_update( 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("PreRulesResource", pipeline_response) + deserialized = self._deserialize("PreRulesResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -615,22 +601,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.PreRulesResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}" - } + return LROPoller[_models.PreRulesResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, priority: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -642,37 +624,50 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 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) + 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, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}" - } + return deserialized # type: ignore @distributed_trace def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> LROPoller[None]: @@ -682,14 +677,6 @@ def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs: Any) :type global_rulestack_name: str :param priority: Pre Rule priority. Required. :type priority: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :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: @@ -703,7 +690,7 @@ def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs: Any) 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( # type: ignore + raw_result = self._delete_initial( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, @@ -712,11 +699,12 @@ def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs: Any) 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, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -727,17 +715,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get_counters( @@ -751,12 +735,11 @@ def get_counters( :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCounter or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounter :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -770,40 +753,37 @@ def get_counters( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RuleCounter] = kwargs.pop("cls", None) - request = build_get_counters_request( + _request = build_get_counters_request( global_rulestack_name=global_rulestack_name, priority=priority, firewall_name=firewall_name, api_version=api_version, - template_url=self.get_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleCounter", pipeline_response) + deserialized = self._deserialize("RuleCounter", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}/getCounters" - } + return deserialized # type: ignore @distributed_trace def refresh_counters( # pylint: disable=inconsistent-return-statements @@ -817,12 +797,11 @@ def refresh_counters( # pylint: disable=inconsistent-return-statements :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -836,36 +815,33 @@ def refresh_counters( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_refresh_counters_request( + _request = build_refresh_counters_request( global_rulestack_name=global_rulestack_name, priority=priority, firewall_name=firewall_name, api_version=api_version, - template_url=self.refresh_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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, {}) - - refresh_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}/refreshCounters" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def reset_counters( @@ -879,12 +855,11 @@ def reset_counters( :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCounterReset or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounterReset :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -898,37 +873,34 @@ def reset_counters( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RuleCounterReset] = kwargs.pop("cls", None) - request = build_reset_counters_request( + _request = build_reset_counters_request( global_rulestack_name=global_rulestack_name, priority=priority, firewall_name=firewall_name, api_version=api_version, - template_url=self.reset_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleCounterReset", pipeline_response) + deserialized = self._deserialize("RuleCounterReset", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - reset_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}/resetCounters" - } + return deserialized # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_prefix_list_global_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_prefix_list_global_rulestack_operations.py index 983965edf4db..4fcd1f0a0a97 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_prefix_list_global_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_prefix_list_global_rulestack_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,34 +5,38 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +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 .._serialization import Serializer -from .._vendor import _convert_request +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration +from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -43,13 +46,13 @@ def build_list_request(global_rulestack_name: 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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), } @@ -69,14 +72,14 @@ def build_get_request(global_rulestack_name: str, name: str, **kwargs: Any) -> H _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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), "name": _SERIALIZER.url("name", name, "str"), @@ -97,7 +100,7 @@ def build_create_or_update_request(global_rulestack_name: str, name: str, **kwar _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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -105,7 +108,7 @@ def build_create_or_update_request(global_rulestack_name: str, name: str, **kwar _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), "name": _SERIALIZER.url("name", name, "str"), @@ -128,14 +131,14 @@ def build_delete_request(global_rulestack_name: str, name: str, **kwargs: Any) - _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", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), "name": _SERIALIZER.url("name", name, "str"), @@ -164,20 +167,21 @@ class PrefixListGlobalRulestackOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + 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, global_rulestack_name: str, **kwargs: Any) -> Iterable["_models.PrefixListGlobalRulestackResource"]: + def list(self, global_rulestack_name: str, **kwargs: Any) -> ItemPaged["_models.PrefixListGlobalRulestackResource"]: """List PrefixListGlobalRulestackResource resources by Tenant. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrefixListGlobalRulestackResource or the result of cls(response) :rtype: @@ -190,7 +194,7 @@ def list(self, global_rulestack_name: str, **kwargs: Any) -> Iterable["_models.P api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrefixListGlobalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,15 +205,13 @@ def list(self, global_rulestack_name: str, **kwargs: Any) -> Iterable["_models.P def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -221,13 +223,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PrefixListGlobalRulestackResourceListResult", pipeline_response) @@ -237,25 +238,26 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists"} - @distributed_trace def get(self, global_rulestack_name: str, name: str, **kwargs: Any) -> _models.PrefixListGlobalRulestackResource: """Get a PrefixListGlobalRulestackResource. @@ -264,12 +266,11 @@ def get(self, global_rulestack_name: str, name: str, **kwargs: Any) -> _models.P :type global_rulestack_name: str :param name: Local Rule priority. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrefixListGlobalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -283,48 +284,45 @@ def get(self, global_rulestack_name: str, name: str, **kwargs: Any) -> _models.P api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrefixListGlobalRulestackResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrefixListGlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("PrefixListGlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}" - } + return deserialized # type: ignore def _create_or_update_initial( self, global_rulestack_name: str, name: str, - resource: Union[_models.PrefixListGlobalRulestackResource, IO], + resource: Union[_models.PrefixListGlobalRulestackResource, IO[bytes]], **kwargs: Any - ) -> _models.PrefixListGlobalRulestackResource: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -337,7 +335,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrefixListGlobalRulestackResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -347,47 +345,52 @@ def _create_or_update_initial( else: _json = self._serialize.body(resource, "PrefixListGlobalRulestackResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PrefixListGlobalRulestackResource", pipeline_response) - + response_headers = {} if response.status_code == 201: - deserialized = self._deserialize("PrefixListGlobalRulestackResource", pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}" - } - @overload def begin_create_or_update( self, @@ -409,14 +412,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PrefixListGlobalRulestackResource or the result of cls(response) :rtype: @@ -429,7 +424,7 @@ def begin_create_or_update( self, global_rulestack_name: str, name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -441,18 +436,10 @@ def begin_create_or_update( :param name: Local Rule priority. Required. :type name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PrefixListGlobalRulestackResource or the result of cls(response) :rtype: @@ -465,7 +452,7 @@ def begin_create_or_update( self, global_rulestack_name: str, name: str, - resource: Union[_models.PrefixListGlobalRulestackResource, IO], + resource: Union[_models.PrefixListGlobalRulestackResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.PrefixListGlobalRulestackResource]: """Create a PrefixListGlobalRulestackResource. @@ -475,19 +462,9 @@ def begin_create_or_update( :param name: Local Rule priority. Required. :type name: str :param resource: Resource create parameters. Is either a PrefixListGlobalRulestackResource type - or a IO type. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + or a IO[bytes] type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource or + IO[bytes] :return: An instance of LROPoller that returns either PrefixListGlobalRulestackResource or the result of cls(response) :rtype: @@ -515,12 +492,13 @@ def begin_create_or_update( 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("PrefixListGlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("PrefixListGlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -532,22 +510,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.PrefixListGlobalRulestackResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}" - } + return LROPoller[_models.PrefixListGlobalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, global_rulestack_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -559,37 +533,50 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 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) + 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, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}" - } + return deserialized # type: ignore @distributed_trace def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -599,14 +586,6 @@ def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> :type global_rulestack_name: str :param name: Local Rule priority. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :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: @@ -620,7 +599,7 @@ def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> 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( # type: ignore + raw_result = self._delete_initial( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, @@ -629,11 +608,12 @@ def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> 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, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -644,14 +624,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_prefix_list_local_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_prefix_list_local_rulestack_operations.py index 06fdd5142ac4..848d463a75be 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_prefix_list_local_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_prefix_list_local_rulestack_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,34 +6,38 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +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 .._serialization import Serializer -from .._vendor import _convert_request +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration +from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -45,14 +49,14 @@ def build_list_by_local_rulestacks_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -78,14 +82,14 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -112,7 +116,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -120,7 +124,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -149,14 +153,14 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -189,17 +193,19 @@ class PrefixListLocalRulestackOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PaloAltoNetworksNgfwMgmtClientConfiguration = ( + 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_by_local_rulestacks( self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> Iterable["_models.PrefixListResource"]: + ) -> ItemPaged["_models.PrefixListResource"]: """List PrefixListResource resources by LocalRulestacks. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -207,7 +213,6 @@ def list_by_local_rulestacks( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrefixListResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource] @@ -219,7 +224,7 @@ def list_by_local_rulestacks( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrefixListResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -230,17 +235,15 @@ def list_by_local_rulestacks( def prepare_request(next_link=None): if not next_link: - request = build_list_by_local_rulestacks_request( + _request = build_list_by_local_rulestacks_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_local_rulestacks.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -252,13 +255,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PrefixListResourceListResult", pipeline_response) @@ -268,27 +270,26 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + 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) - list_by_local_rulestacks.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists" - } - @distributed_trace def get( self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any @@ -302,12 +303,11 @@ def get( :type local_rulestack_name: str :param name: Local Rule priority. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrefixListResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -321,51 +321,48 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrefixListResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrefixListResource", pipeline_response) + deserialized = self._deserialize("PrefixListResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, local_rulestack_name: str, name: str, - resource: Union[_models.PrefixListResource, IO], + resource: Union[_models.PrefixListResource, IO[bytes]], **kwargs: Any - ) -> _models.PrefixListResource: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -378,7 +375,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrefixListResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -388,7 +385,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(resource, "PrefixListResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, @@ -397,40 +394,45 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PrefixListResource", pipeline_response) - + response_headers = {} if response.status_code == 201: - deserialized = self._deserialize("PrefixListResource", pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}" - } - @overload def begin_create_or_update( self, @@ -456,14 +458,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PrefixListResource or the result of cls(response) :rtype: @@ -477,7 +471,7 @@ def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -492,18 +486,10 @@ def begin_create_or_update( :param name: Local Rule priority. Required. :type name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PrefixListResource or the result of cls(response) :rtype: @@ -517,7 +503,7 @@ def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, name: str, - resource: Union[_models.PrefixListResource, IO], + resource: Union[_models.PrefixListResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.PrefixListResource]: """Create a PrefixListResource. @@ -529,20 +515,9 @@ def begin_create_or_update( :type local_rulestack_name: str :param name: Local Rule priority. Required. :type name: str - :param resource: Resource create parameters. Is either a PrefixListResource type or a IO type. - Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param resource: Resource create parameters. Is either a PrefixListResource type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource or IO[bytes] :return: An instance of LROPoller that returns either PrefixListResource or the result of cls(response) :rtype: @@ -571,12 +546,13 @@ def begin_create_or_update( 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("PrefixListResource", pipeline_response) + deserialized = self._deserialize("PrefixListResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -588,22 +564,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.PrefixListResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}" - } + return LROPoller[_models.PrefixListResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -615,39 +589,52 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 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) + 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, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -662,14 +649,6 @@ def begin_delete( :type local_rulestack_name: str :param name: Local Rule priority. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :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: @@ -683,7 +662,7 @@ def begin_delete( 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( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, @@ -693,11 +672,12 @@ def begin_delete( 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, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -708,14 +688,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/dev_requirements.txt b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/dev_requirements.txt index 3d4691d0e417..8e0ca828ce26 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/dev_requirements.txt +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/dev_requirements.txt @@ -1,2 +1,3 @@ -e ../../../eng/tools/azure-sdk-tools -e ../../identity/azure-identity +aiohttp diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_create_or_update_maximum_set_gen.py index 23819e971747..f2c6f74a4ca7 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_create_or_update_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -46,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectGlobalRulestack_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/CertificateObjectGlobalRulestack_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_create_or_update_minimum_set_gen.py index d6b52a02301b..a643907cf261 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_create_or_update_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectGlobalRulestack_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/CertificateObjectGlobalRulestack_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_delete_maximum_set_gen.py index 23c9a4923db9..026807d8cd7b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_delete_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectGlobalRulestack_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/CertificateObjectGlobalRulestack_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_delete_minimum_set_gen.py index 93b98d14b3b6..815d9c6eab16 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_delete_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectGlobalRulestack_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/CertificateObjectGlobalRulestack_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_get_maximum_set_gen.py index 823c7d7ab63c..e75a8c08a862 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_get_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectGlobalRulestack_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/CertificateObjectGlobalRulestack_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_get_minimum_set_gen.py index 638d55431086..da7b2c029406 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_get_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectGlobalRulestack_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/CertificateObjectGlobalRulestack_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_list_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_list_maximum_set_gen.py index 1a2dddaa4693..6739dcdea990 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_list_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_list_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectGlobalRulestack_List_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/CertificateObjectGlobalRulestack_List_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_list_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_list_minimum_set_gen.py index 8b3ad0d56e4f..2e38243533d6 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_list_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_list_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectGlobalRulestack_List_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/CertificateObjectGlobalRulestack_List_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_create_or_update_maximum_set_gen.py index 79094c46195a..c752ddb4cd9c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_create_or_update_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -47,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectLocalRulestack_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/CertificateObjectLocalRulestack_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_create_or_update_minimum_set_gen.py index bdad14463402..ff993e189df7 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_create_or_update_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -38,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectLocalRulestack_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/CertificateObjectLocalRulestack_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_delete_maximum_set_gen.py index 81bb32451e7c..7d9a2558bc73 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_delete_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectLocalRulestack_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/CertificateObjectLocalRulestack_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_delete_minimum_set_gen.py index 753229a822c7..784945cec290 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_delete_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectLocalRulestack_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/CertificateObjectLocalRulestack_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_get_maximum_set_gen.py index 5c07521f4537..24e376341208 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_get_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectLocalRulestack_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/CertificateObjectLocalRulestack_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_get_minimum_set_gen.py index f3cdfcb764e5..f5bd976f68b3 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_get_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectLocalRulestack_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/CertificateObjectLocalRulestack_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py index 86e38ce4ef6f..f5aab98bd211 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectLocalRulestack_ListByLocalRulestacks_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/CertificateObjectLocalRulestack_ListByLocalRulestacks_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py index 19a0e9f1e245..060a869108e0 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectLocalRulestack_ListByLocalRulestacks_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/CertificateObjectLocalRulestack_ListByLocalRulestacks_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_get_maximum_set_gen.py index cafeab689658..0f77a8b7c94c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_get_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FirewallStatus_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/FirewallStatus_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_get_minimum_set_gen.py index 47f0eb3d91e4..8ed06bf867f3 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_get_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FirewallStatus_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/FirewallStatus_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_list_by_firewalls_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_list_by_firewalls_maximum_set_gen.py index e2fb41099ee0..a1902077dc3e 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_list_by_firewalls_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_list_by_firewalls_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FirewallStatus_ListByFirewalls_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/FirewallStatus_ListByFirewalls_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_list_by_firewalls_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_list_by_firewalls_minimum_set_gen.py index edb9daa09def..4f44ee4d55fb 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_list_by_firewalls_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_list_by_firewalls_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FirewallStatus_ListByFirewalls_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/FirewallStatus_ListByFirewalls_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_create_or_update_maximum_set_gen.py index 0d47ac446a7a..49b7aa901659 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_create_or_update_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -85,6 +87,7 @@ def main(): ], "enableEgressNat": "ENABLED", "networkType": "VNET", + "privateSourceNatRulesDestination": ["20.22.92.11"], "publicIps": [ { "address": "20.22.92.11", @@ -141,6 +144,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/Firewalls_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_create_or_update_minimum_set_gen.py index 907b6a555063..c775e6cfa564 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_create_or_update_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -54,6 +56,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/Firewalls_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_delete_maximum_set_gen.py index 90323214cd3d..84db50c26a20 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_delete_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/Firewalls_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_delete_minimum_set_gen.py index 3c88823d3656..0e330e052c99 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_delete_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/Firewalls_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_global_rulestack_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_global_rulestack_maximum_set_gen.py index c263d4c6f1de..ce03a4b35722 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_global_rulestack_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_global_rulestack_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_getGlobalRulestack_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/Firewalls_getGlobalRulestack_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_global_rulestack_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_global_rulestack_minimum_set_gen.py index 42e0870b8e43..25c3cf6442ed 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_global_rulestack_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_global_rulestack_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_getGlobalRulestack_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/Firewalls_getGlobalRulestack_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_log_profile_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_log_profile_maximum_set_gen.py index f7fb33b4d8e5..c6c844574009 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_log_profile_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_log_profile_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_getLogProfile_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/Firewalls_getLogProfile_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_log_profile_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_log_profile_minimum_set_gen.py index 9590498132b1..23188f924f98 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_log_profile_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_log_profile_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_getLogProfile_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/Firewalls_getLogProfile_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_maximum_set_gen.py index d4e973378f41..96a193bdac04 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/Firewalls_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_minimum_set_gen.py index aaa50b05781a..29843bace6cc 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/Firewalls_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_support_info_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_support_info_maximum_set_gen.py index a6dcbacb0933..d9783c80c201 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_support_info_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_support_info_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_getSupportInfo_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/Firewalls_getSupportInfo_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_support_info_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_support_info_minimum_set_gen.py index f062b94c73d8..31a41429a4d7 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_support_info_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_support_info_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_getSupportInfo_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/Firewalls_getSupportInfo_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_resource_group_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_resource_group_maximum_set_gen.py index ee6960a2cfaf..283ec79f6dd9 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_resource_group_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_resource_group_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_ListByResourceGroup_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/Firewalls_ListByResourceGroup_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_resource_group_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_resource_group_minimum_set_gen.py index 3fbdfc83485f..018504a7b2cc 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_resource_group_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_resource_group_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_ListByResourceGroup_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/Firewalls_ListByResourceGroup_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_subscription_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_subscription_maximum_set_gen.py index d0327773108b..e874ff74cd07 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_subscription_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_subscription_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_ListBySubscription_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/Firewalls_ListBySubscription_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_subscription_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_subscription_minimum_set_gen.py index 6034893d5594..2c526cf64183 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_subscription_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_subscription_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_ListBySubscription_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/Firewalls_ListBySubscription_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_save_log_profile_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_save_log_profile_maximum_set_gen.py index cae3c4800078..a3f4ce31844e 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_save_log_profile_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_save_log_profile_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_saveLogProfile_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/Firewalls_saveLogProfile_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_save_log_profile_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_save_log_profile_minimum_set_gen.py index 31576fc2f57b..2d4f7a32fa3b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_save_log_profile_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_save_log_profile_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_saveLogProfile_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/Firewalls_saveLogProfile_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_update_maximum_set_gen.py index 41587d1bbde5..8f5b6fdd9172 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_update_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -88,6 +90,7 @@ def main(): ], "enableEgressNat": "ENABLED", "networkType": "VNET", + "privateSourceNatRulesDestination": ["20.22.92.11"], "publicIps": [ { "address": "20.22.92.11", @@ -147,6 +150,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_Update_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/Firewalls_Update_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_create_or_update_maximum_set_gen.py index ee8096ff89e5..87135a7b2713 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_create_or_update_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -45,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListGlobalRulestack_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/FqdnListGlobalRulestack_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_create_or_update_minimum_set_gen.py index 99e27224e06f..cb17d65b15b4 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_create_or_update_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListGlobalRulestack_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/FqdnListGlobalRulestack_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_delete_maximum_set_gen.py index 8f7c21b94dfe..9f579386fa91 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_delete_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListGlobalRulestack_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/FqdnListGlobalRulestack_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_delete_minimum_set_gen.py index 3643d4608173..c15c9fee2fdc 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_delete_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListGlobalRulestack_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/FqdnListGlobalRulestack_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_get_maximum_set_gen.py index fa1307d59269..ffe8bbc4962d 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_get_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListGlobalRulestack_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/FqdnListGlobalRulestack_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_get_minimum_set_gen.py index ed45e1ecdc90..000af872d8e3 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_get_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListGlobalRulestack_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/FqdnListGlobalRulestack_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_list_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_list_maximum_set_gen.py index 03e9523e332c..d68a8a94a295 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_list_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_list_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListGlobalRulestack_List_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/FqdnListGlobalRulestack_List_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_list_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_list_minimum_set_gen.py index c80a43412c5a..52cfd3f2c24b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_list_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_list_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListGlobalRulestack_List_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/FqdnListGlobalRulestack_List_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_create_or_update_maximum_set_gen.py index 55740bd17197..121d9f7d0e8e 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_create_or_update_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -46,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListLocalRulestack_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/FqdnListLocalRulestack_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_create_or_update_minimum_set_gen.py index 690f350b1e35..2ee387681ca4 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_create_or_update_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -38,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListLocalRulestack_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/FqdnListLocalRulestack_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_delete_maximum_set_gen.py index d72776834fc5..eb87d646a0f1 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_delete_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListLocalRulestack_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/FqdnListLocalRulestack_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_delete_minimum_set_gen.py index 951ac8fdb7d3..5668d8ac7a10 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_delete_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListLocalRulestack_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/FqdnListLocalRulestack_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_get_maximum_set_gen.py index 6b838068cd6a..f3b2a8dec865 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_get_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListLocalRulestack_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/FqdnListLocalRulestack_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_get_minimum_set_gen.py index a6eadc6e6c31..f1803f0e902a 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_get_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListLocalRulestack_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/FqdnListLocalRulestack_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py index 684515bd8577..00a2f11eb4b2 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListLocalRulestack_ListByLocalRulestacks_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/FqdnListLocalRulestack_ListByLocalRulestacks_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py index 2278c005100c..dd2a7858eb59 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListLocalRulestack_ListByLocalRulestacks_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/FqdnListLocalRulestack_ListByLocalRulestacks_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_commit_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_commit_maximum_set_gen.py index c3dc1685bd91..44d1a1cf8187 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_commit_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_commit_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_commit_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/GlobalRulestack_commit_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_commit_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_commit_minimum_set_gen.py index cde18a8c7386..850f1546ac61 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_commit_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_commit_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_commit_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/GlobalRulestack_commit_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_create_or_update_maximum_set_gen.py index 8d2cfacd8f9d..b677830ca37b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_create_or_update_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -62,6 +64,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/GlobalRulestack_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_create_or_update_minimum_set_gen.py index 07e2a6a96ce7..8bf43c09270b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_create_or_update_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/GlobalRulestack_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_delete_maximum_set_gen.py index 5ce5cf03b477..2387a16dcd03 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_delete_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/GlobalRulestack_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_delete_minimum_set_gen.py index 8808d17fa9a1..6631b234c36c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_delete_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/GlobalRulestack_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_change_log_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_change_log_maximum_set_gen.py index a9248ed2fac5..6c22f38ef3e1 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_change_log_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_change_log_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_getChangeLog_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/GlobalRulestack_getChangeLog_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_change_log_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_change_log_minimum_set_gen.py index aa88e2e44575..0ac7e64ebc12 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_change_log_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_change_log_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_getChangeLog_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/GlobalRulestack_getChangeLog_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_maximum_set_gen.py index ef67bf85b3bf..08e55a56bfc1 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/GlobalRulestack_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_minimum_set_gen.py index 9b8c0f48edf3..772091e5f9ac 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/GlobalRulestack_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_advanced_security_objects_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_advanced_security_objects_maximum_set_gen.py index 2a5ca1085f3c..2e0aaef1dc7e 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_advanced_security_objects_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_advanced_security_objects_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listAdvancedSecurityObjects_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/GlobalRulestack_listAdvancedSecurityObjects_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_advanced_security_objects_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_advanced_security_objects_minimum_set_gen.py index ed6b7fe582c6..2626faaa18cc 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_advanced_security_objects_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_advanced_security_objects_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listAdvancedSecurityObjects_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/GlobalRulestack_listAdvancedSecurityObjects_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_app_ids_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_app_ids_maximum_set_gen.py index b3877f042802..3b2e64136b9b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_app_ids_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_app_ids_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listAppIds_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/GlobalRulestack_listAppIds_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_app_ids_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_app_ids_minimum_set_gen.py index 685eae22ac86..2254d426269c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_app_ids_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_app_ids_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listAppIds_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/GlobalRulestack_listAppIds_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_countries_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_countries_maximum_set_gen.py index 252542846687..6ffba71da15d 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_countries_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_countries_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listCountries_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/GlobalRulestack_listCountries_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_countries_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_countries_minimum_set_gen.py index 8eb0ca1b9d03..30b277011e2b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_countries_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_countries_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listCountries_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/GlobalRulestack_listCountries_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_firewalls_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_firewalls_maximum_set_gen.py index 9029ffa38317..bb808eb5a40c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_firewalls_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_firewalls_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listFirewalls_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/GlobalRulestack_listFirewalls_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_firewalls_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_firewalls_minimum_set_gen.py index 7a9557a32825..0971db92abbb 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_firewalls_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_firewalls_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listFirewalls_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/GlobalRulestack_listFirewalls_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_maximum_set_gen.py index 5aad8ed63ed0..cda79ce1be75 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_List_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/GlobalRulestack_List_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_minimum_set_gen.py index 58065bcc5716..1abb25b94a02 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_List_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/GlobalRulestack_List_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_predefined_url_categories_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_predefined_url_categories_maximum_set_gen.py index 964d901d20fa..a4065363e15e 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_predefined_url_categories_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_predefined_url_categories_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listPredefinedUrlCategories_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/GlobalRulestack_listPredefinedUrlCategories_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_predefined_url_categories_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_predefined_url_categories_minimum_set_gen.py index bdd4cd37986b..a1161fbe967b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_predefined_url_categories_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_predefined_url_categories_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listPredefinedUrlCategories_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/GlobalRulestack_listPredefinedUrlCategories_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_security_services_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_security_services_maximum_set_gen.py index 397aac6e4a65..6731af51c99c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_security_services_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_security_services_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listSecurityServices_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/GlobalRulestack_listSecurityServices_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_security_services_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_security_services_minimum_set_gen.py index 7ca7fd602342..ccd8478ce9bb 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_security_services_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_security_services_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listSecurityServices_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/GlobalRulestack_listSecurityServices_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_revert_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_revert_maximum_set_gen.py index 0320c011c77c..bd919426114a 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_revert_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_revert_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_revert_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/GlobalRulestack_revert_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_revert_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_revert_minimum_set_gen.py index 9d2ca31088fb..c9aed05bbab8 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_revert_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_revert_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_revert_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/GlobalRulestack_revert_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_update_maximum_set_gen.py index c2d9decb49aa..6d86be38c73b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_update_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -61,6 +63,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_Update_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/GlobalRulestack_Update_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_create_or_update_maximum_set_gen.py index 89b1eddf363f..649ef1570212 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_create_or_update_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -66,6 +68,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRules_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_create_or_update_minimum_set_gen.py index 88a2fdcd6c91..a253e1ae91c6 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_create_or_update_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -38,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRules_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_delete_maximum_set_gen.py index f54c39aac8a1..9c0da1bb8d37 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_delete_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRules_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_delete_minimum_set_gen.py index d5327972133c..b7722a60afff 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_delete_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRules_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_counters_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_counters_maximum_set_gen.py index cc3edf26f4c2..0f2802e22dba 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_counters_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_counters_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_getCounters_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRules_getCounters_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_counters_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_counters_minimum_set_gen.py index f61cdf92e5e2..dfaa6157d23b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_counters_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_counters_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_getCounters_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRules_getCounters_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_maximum_set_gen.py index 8ce51d148c76..d55ae38ce71c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRules_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_minimum_set_gen.py index e807fb6846a6..a84750c39deb 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRules_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_list_by_local_rulestacks_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_list_by_local_rulestacks_maximum_set_gen.py index 4b255afc184b..da839aab3738 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_list_by_local_rulestacks_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_list_by_local_rulestacks_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_ListByLocalRulestacks_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRules_ListByLocalRulestacks_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_list_by_local_rulestacks_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_list_by_local_rulestacks_minimum_set_gen.py index 493878857f31..8caa3b888ec9 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_list_by_local_rulestacks_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_list_by_local_rulestacks_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_ListByLocalRulestacks_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRules_ListByLocalRulestacks_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_refresh_counters_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_refresh_counters_maximum_set_gen.py index 022b9d627e94..87cb7b018283 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_refresh_counters_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_refresh_counters_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_refreshCounters_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRules_refreshCounters_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_refresh_counters_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_refresh_counters_minimum_set_gen.py index 961e44655cdc..19a0726c878f 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_refresh_counters_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_refresh_counters_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_refreshCounters_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRules_refreshCounters_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_reset_counters_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_reset_counters_maximum_set_gen.py index 67739b720b2e..843214001edc 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_reset_counters_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_reset_counters_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_resetCounters_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRules_resetCounters_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_reset_counters_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_reset_counters_minimum_set_gen.py index 58ab9f6ba27a..d5a87fba8e19 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_reset_counters_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_reset_counters_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_resetCounters_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRules_resetCounters_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_commit_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_commit_maximum_set_gen.py index c2137adf3102..b04b6e3d556e 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_commit_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_commit_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_commit_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_commit_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_commit_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_commit_minimum_set_gen.py index 7cbe940a6ed9..c463a93139d2 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_commit_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_commit_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_commit_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_commit_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_create_or_update_maximum_set_gen.py index 1423c45e1e7f..72c3657e9902 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_create_or_update_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -64,6 +66,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_create_or_update_minimum_set_gen.py index 35f90a7c46bf..a033bf800589 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_create_or_update_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_delete_maximum_set_gen.py index 52618393949c..fae42cf13ae1 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_delete_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_delete_minimum_set_gen.py index 703b2b9dfbe4..d862d0a13589 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_delete_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_change_log_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_change_log_maximum_set_gen.py index 84c8f8a1b78e..0115c5106d83 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_change_log_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_change_log_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_getChangeLog_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_getChangeLog_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_change_log_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_change_log_minimum_set_gen.py index 1177a44ef2bd..69acc067ae4e 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_change_log_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_change_log_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_getChangeLog_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_getChangeLog_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_maximum_set_gen.py index 93e934f87de0..99b50de7a2a8 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_minimum_set_gen.py index f044e21f08a6..c473856a485e 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_support_info_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_support_info_maximum_set_gen.py index 4a8048ba38dc..89d6773598c4 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_support_info_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_support_info_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_getSupportInfo_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_getSupportInfo_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_support_info_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_support_info_minimum_set_gen.py index 7a1b3ce20340..b7d9faae8ba0 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_support_info_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_support_info_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_getSupportInfo_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_getSupportInfo_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_advanced_security_objects_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_advanced_security_objects_maximum_set_gen.py index e3d8274539c9..3d4a1ea2f56b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_advanced_security_objects_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_advanced_security_objects_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_listAdvancedSecurityObjects_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_listAdvancedSecurityObjects_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_advanced_security_objects_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_advanced_security_objects_minimum_set_gen.py index 4270bf6bda34..26e5b84d71a1 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_advanced_security_objects_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_advanced_security_objects_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_listAdvancedSecurityObjects_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_listAdvancedSecurityObjects_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_app_ids_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_app_ids_maximum_set_gen.py new file mode 100644 index 000000000000..11fcceda8171 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_app_ids_maximum_set_gen.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python local_rulestacks_list_app_ids_maximum_set_gen.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 = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + ) + + response = client.local_rulestacks.list_app_ids( + resource_group_name="rgopenapi", + local_rulestack_name="lrs1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_listAppIds_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_app_ids_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_app_ids_minimum_set_gen.py new file mode 100644 index 000000000000..083b8ec9134d --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_app_ids_minimum_set_gen.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python local_rulestacks_list_app_ids_minimum_set_gen.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 = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + ) + + response = client.local_rulestacks.list_app_ids( + resource_group_name="rgopenapi", + local_rulestack_name="lrs1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_listAppIds_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_resource_group_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_resource_group_maximum_set_gen.py index 55c424674922..1f8bad45a5ab 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_resource_group_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_resource_group_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_ListByResourceGroup_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_ListByResourceGroup_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_resource_group_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_resource_group_minimum_set_gen.py index ea91a51a4830..d326f096f0ba 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_resource_group_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_resource_group_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_ListByResourceGroup_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_ListByResourceGroup_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_subscription_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_subscription_maximum_set_gen.py index 995720ac3fda..28c8bf46867b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_subscription_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_subscription_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_ListBySubscription_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_ListBySubscription_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_subscription_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_subscription_minimum_set_gen.py index ef350a40c51f..3821844e2ca2 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_subscription_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_subscription_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_ListBySubscription_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_ListBySubscription_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_countries_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_countries_maximum_set_gen.py new file mode 100644 index 000000000000..77c399670d1e --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_countries_maximum_set_gen.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python local_rulestacks_list_countries_maximum_set_gen.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 = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + ) + + response = client.local_rulestacks.list_countries( + resource_group_name="rgopenapi", + local_rulestack_name="lrs1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_listCountries_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_countries_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_countries_minimum_set_gen.py new file mode 100644 index 000000000000..a0c00509a2e7 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_countries_minimum_set_gen.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python local_rulestacks_list_countries_minimum_set_gen.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 = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + ) + + response = client.local_rulestacks.list_countries( + resource_group_name="rgopenapi", + local_rulestack_name="lrs1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_listCountries_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_firewalls_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_firewalls_maximum_set_gen.py index 8b856d4daa04..af66191faf55 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_firewalls_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_firewalls_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_listFirewalls_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_listFirewalls_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_firewalls_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_firewalls_minimum_set_gen.py index 9b48a105e88b..980ca8a36a4d 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_firewalls_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_firewalls_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_listFirewalls_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_listFirewalls_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_predefined_url_categories_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_predefined_url_categories_maximum_set_gen.py new file mode 100644 index 000000000000..3a1cac58b786 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_predefined_url_categories_maximum_set_gen.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python local_rulestacks_list_predefined_url_categories_maximum_set_gen.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 = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + ) + + response = client.local_rulestacks.list_predefined_url_categories( + resource_group_name="rgopenapi", + local_rulestack_name="lrs1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_listPredefinedUrlCategories_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_predefined_url_categories_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_predefined_url_categories_minimum_set_gen.py new file mode 100644 index 000000000000..723bddafe0d9 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_predefined_url_categories_minimum_set_gen.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python local_rulestacks_list_predefined_url_categories_minimum_set_gen.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 = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + ) + + response = client.local_rulestacks.list_predefined_url_categories( + resource_group_name="rgopenapi", + local_rulestack_name="lrs1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_listPredefinedUrlCategories_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_security_services_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_security_services_maximum_set_gen.py index 417fd7decb11..7f4859332993 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_security_services_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_security_services_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_listSecurityServices_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_listSecurityServices_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_security_services_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_security_services_minimum_set_gen.py index c163e2920674..49bdc78d0593 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_security_services_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_security_services_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_listSecurityServices_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_listSecurityServices_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_revert_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_revert_maximum_set_gen.py index 0b9ae2cffb0a..7e18b6c9e2e4 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_revert_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_revert_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_revert_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_revert_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_revert_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_revert_minimum_set_gen.py index aa91454ec5c5..564a708ae34b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_revert_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_revert_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_revert_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_revert_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_update_maximum_set_gen.py index de8c33521830..1946fdb16fcf 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_update_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -62,6 +64,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_Update_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/LocalRulestacks_Update_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_create_or_update_maximum_set_gen.py new file mode 100644 index 000000000000..b4d6c57d8ada --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_create_or_update_maximum_set_gen.py @@ -0,0 +1,50 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python metrics_object_firewall_create_or_update_maximum_set_gen.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 = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="aaaaaaa", + ) + + response = client.metrics_object_firewall.begin_create_or_update( + resource_group_name="rgopenapi", + firewall_name="aaaaaaaaaaaaaaaaaaaaaaaa", + resource={ + "properties": { + "applicationInsightsConnectionString": "aaa", + "applicationInsightsResourceId": "aaaaaaaaaaaaaaa", + "panEtag": "aaaaaaaaaa", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/MetricsObjectFirewall_CreateOrUpdate_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_create_or_update_minimum_set_gen.py new file mode 100644 index 000000000000..a869c24b195e --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_create_or_update_minimum_set_gen.py @@ -0,0 +1,49 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python metrics_object_firewall_create_or_update_minimum_set_gen.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 = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="aaaaaaa", + ) + + response = client.metrics_object_firewall.begin_create_or_update( + resource_group_name="rgopenapi", + firewall_name="aaaaaaaaaaaaaaaaaaaaaaaa", + resource={ + "properties": { + "applicationInsightsConnectionString": "aaa", + "applicationInsightsResourceId": "aaaaaaaaaaaaaaa", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/MetricsObjectFirewall_CreateOrUpdate_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_delete_maximum_set_gen.py new file mode 100644 index 000000000000..475e77ce9409 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_delete_maximum_set_gen.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python metrics_object_firewall_delete_maximum_set_gen.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 = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="aaaaaaa", + ) + + client.metrics_object_firewall.begin_delete( + resource_group_name="rgopenapi", + firewall_name="aaaaaaaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/MetricsObjectFirewall_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_delete_minimum_set_gen.py new file mode 100644 index 000000000000..3fbc69c90a68 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_delete_minimum_set_gen.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python metrics_object_firewall_delete_minimum_set_gen.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 = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="aaaaaaa", + ) + + client.metrics_object_firewall.begin_delete( + resource_group_name="rgopenapi", + firewall_name="aaaaaaaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/MetricsObjectFirewall_Delete_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_get_maximum_set_gen.py new file mode 100644 index 000000000000..f386e91bdce7 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_get_maximum_set_gen.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python metrics_object_firewall_get_maximum_set_gen.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 = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="aaaaaaa", + ) + + response = client.metrics_object_firewall.get( + resource_group_name="rgopenapi", + firewall_name="aaaaaaaaaaaaaaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/MetricsObjectFirewall_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_get_minimum_set_gen.py new file mode 100644 index 000000000000..9569abf6e14c --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_get_minimum_set_gen.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python metrics_object_firewall_get_minimum_set_gen.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 = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="aaaaaaa", + ) + + response = client.metrics_object_firewall.get( + resource_group_name="rgopenapi", + firewall_name="aaaaaaaaaaaaaaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/MetricsObjectFirewall_Get_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_list_by_firewalls_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_list_by_firewalls_maximum_set_gen.py new file mode 100644 index 000000000000..f6066a3e0ba6 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_list_by_firewalls_maximum_set_gen.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python metrics_object_firewall_list_by_firewalls_maximum_set_gen.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 = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="aaaaaaaaaaaaaaaaaaaaaaaaa", + ) + + response = client.metrics_object_firewall.list_by_firewalls( + resource_group_name="rgopenapi", + firewall_name="IFTDk", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/MetricsObjectFirewall_ListByFirewalls_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_list_by_firewalls_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_list_by_firewalls_minimum_set_gen.py new file mode 100644 index 000000000000..26b4513ef49b --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_list_by_firewalls_minimum_set_gen.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python metrics_object_firewall_list_by_firewalls_minimum_set_gen.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 = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="aaaaaaaaaaaaaaaaaaaaaaaaa", + ) + + response = client.metrics_object_firewall.list_by_firewalls( + resource_group_name="rgopenapi", + firewall_name="IFTDk", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/MetricsObjectFirewall_ListByFirewalls_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/operations_list_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/operations_list_maximum_set_gen.py index cfaf85c2bda0..1a0e1d89f1a9 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/operations_list_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/operations_list_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Operations_List_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/Operations_List_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/operations_list_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/operations_list_minimum_set_gen.py index 62ea229587fe..afbebf6d194b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/operations_list_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/operations_list_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Operations_List_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/Operations_List_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_operations_create_product_serial_number_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_operations_create_product_serial_number_maximum_set_gen.py new file mode 100644 index 000000000000..aae90a90e44d --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_operations_create_product_serial_number_maximum_set_gen.py @@ -0,0 +1,40 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python palo_alto_networks_cloudngfw_operations_create_product_serial_number_maximum_set_gen.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 = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + ) + + response = client.palo_alto_networks_cloudngfw_operations.create_product_serial_number() + print(response) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PaloAltoNetworksCloudngfwOperations_createProductSerialNumber_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_operations_create_product_serial_number_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_operations_create_product_serial_number_minimum_set_gen.py new file mode 100644 index 000000000000..104e1f8b0440 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_operations_create_product_serial_number_minimum_set_gen.py @@ -0,0 +1,40 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python palo_alto_networks_cloudngfw_operations_create_product_serial_number_minimum_set_gen.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 = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + ) + + response = client.palo_alto_networks_cloudngfw_operations.create_product_serial_number() + print(response) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PaloAltoNetworksCloudngfwOperations_createProductSerialNumber_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_operations_list_cloud_manager_tenants_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_operations_list_cloud_manager_tenants_maximum_set_gen.py new file mode 100644 index 000000000000..76cf421d93ce --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_operations_list_cloud_manager_tenants_maximum_set_gen.py @@ -0,0 +1,40 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python palo_alto_networks_cloudngfw_operations_list_cloud_manager_tenants_maximum_set_gen.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 = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + ) + + response = client.palo_alto_networks_cloudngfw_operations.list_cloud_manager_tenants() + print(response) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PaloAltoNetworksCloudngfwOperations_listCloudManagerTenants_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_operations_list_cloud_manager_tenants_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_operations_list_cloud_manager_tenants_minimum_set_gen.py new file mode 100644 index 000000000000..a328dbea3dd6 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_operations_list_cloud_manager_tenants_minimum_set_gen.py @@ -0,0 +1,40 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python palo_alto_networks_cloudngfw_operations_list_cloud_manager_tenants_minimum_set_gen.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 = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + ) + + response = client.palo_alto_networks_cloudngfw_operations.list_cloud_manager_tenants() + print(response) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PaloAltoNetworksCloudngfwOperations_listCloudManagerTenants_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_operations_list_product_serial_number_status_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_operations_list_product_serial_number_status_maximum_set_gen.py new file mode 100644 index 000000000000..d6732e12467f --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_operations_list_product_serial_number_status_maximum_set_gen.py @@ -0,0 +1,40 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python palo_alto_networks_cloudngfw_operations_list_product_serial_number_status_maximum_set_gen.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 = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + ) + + response = client.palo_alto_networks_cloudngfw_operations.list_product_serial_number_status() + print(response) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PaloAltoNetworksCloudngfwOperations_listProductSerialNumberStatus_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_operations_list_product_serial_number_status_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_operations_list_product_serial_number_status_minimum_set_gen.py new file mode 100644 index 000000000000..98304511e68c --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_operations_list_product_serial_number_status_minimum_set_gen.py @@ -0,0 +1,40 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python palo_alto_networks_cloudngfw_operations_list_product_serial_number_status_minimum_set_gen.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 = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + ) + + response = client.palo_alto_networks_cloudngfw_operations.list_product_serial_number_status() + print(response) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PaloAltoNetworksCloudngfwOperations_listProductSerialNumberStatus_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_operations_list_support_info_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_operations_list_support_info_maximum_set_gen.py new file mode 100644 index 000000000000..4dd6217d73a1 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_operations_list_support_info_maximum_set_gen.py @@ -0,0 +1,40 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python palo_alto_networks_cloudngfw_operations_list_support_info_maximum_set_gen.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 = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + ) + + response = client.palo_alto_networks_cloudngfw_operations.list_support_info() + print(response) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PaloAltoNetworksCloudngfwOperations_listSupportInfo_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_operations_list_support_info_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_operations_list_support_info_minimum_set_gen.py new file mode 100644 index 000000000000..b2d77b790831 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_operations_list_support_info_minimum_set_gen.py @@ -0,0 +1,40 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python palo_alto_networks_cloudngfw_operations_list_support_info_minimum_set_gen.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 = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + ) + + response = client.palo_alto_networks_cloudngfw_operations.list_support_info() + print(response) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PaloAltoNetworksCloudngfwOperations_listSupportInfo_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_create_or_update_maximum_set_gen.py index cd0b9a52e039..f862d51916ac 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_create_or_update_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -65,6 +67,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PostRules_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_create_or_update_minimum_set_gen.py index 64f622b2e1c8..dfafc578f2cc 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_create_or_update_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PostRules_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_delete_maximum_set_gen.py index c29eebf1a30f..97309963b0a6 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_delete_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PostRules_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_delete_minimum_set_gen.py index 09af61799237..c40b8dce3436 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_delete_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PostRules_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_counters_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_counters_maximum_set_gen.py index c77c59c9e4eb..a7715a362b5d 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_counters_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_counters_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_getCounters_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PostRules_getCounters_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_counters_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_counters_minimum_set_gen.py index 5ea03e8594e3..cc668cc5f0fd 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_counters_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_counters_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_getCounters_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PostRules_getCounters_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_maximum_set_gen.py index 78f456080d43..f9b59a4c7325 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PostRules_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_minimum_set_gen.py index 1958c19ed55b..3ca09be53d1c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PostRules_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_list_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_list_maximum_set_gen.py index 96693c160426..e709350dd53e 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_list_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_list_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_List_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PostRules_List_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_list_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_list_minimum_set_gen.py index d745503854ce..64032183cbd3 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_list_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_list_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_List_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PostRules_List_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_refresh_counters_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_refresh_counters_maximum_set_gen.py index 78ced62854e2..32beefef69aa 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_refresh_counters_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_refresh_counters_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_refreshCounters_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PostRules_refreshCounters_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_refresh_counters_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_refresh_counters_minimum_set_gen.py index 598d7686bec3..d119c13c3df0 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_refresh_counters_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_refresh_counters_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_refreshCounters_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PostRules_refreshCounters_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_reset_counters_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_reset_counters_maximum_set_gen.py index 64dd83e52a49..9a11e534e83f 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_reset_counters_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_reset_counters_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_resetCounters_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PostRules_resetCounters_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_reset_counters_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_reset_counters_minimum_set_gen.py index f0a41a386e4f..8e97ac5af2b0 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_reset_counters_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_reset_counters_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_resetCounters_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PostRules_resetCounters_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_create_or_update_maximum_set_gen.py index fc6918e926a3..359718e22686 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_create_or_update_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -65,6 +67,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PreRules_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_create_or_update_minimum_set_gen.py index f02e7bc83b1c..3b7ded598e62 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_create_or_update_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PreRules_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_delete_maximum_set_gen.py index 12d5c623f679..b90d4da141b7 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_delete_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PreRules_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_delete_minimum_set_gen.py index 8d680018ef5d..46b3e5a4d644 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_delete_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PreRules_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_counters_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_counters_maximum_set_gen.py index c31471107029..441f716a2f2a 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_counters_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_counters_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_getCounters_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PreRules_getCounters_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_counters_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_counters_minimum_set_gen.py index 9ca7c2a5a464..8b39a041707b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_counters_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_counters_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_getCounters_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PreRules_getCounters_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_maximum_set_gen.py index cee729320321..82cc55b5fafb 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PreRules_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_minimum_set_gen.py index db38c3564330..f6ed6283429d 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PreRules_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_list_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_list_maximum_set_gen.py index bdd4727cf04e..b12773014683 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_list_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_list_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_List_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PreRules_List_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_list_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_list_minimum_set_gen.py index f4b34d445f20..10d1277c5141 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_list_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_list_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_List_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PreRules_List_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_refresh_counters_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_refresh_counters_maximum_set_gen.py index 6869b39ea93f..b7b47043fc78 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_refresh_counters_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_refresh_counters_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_refreshCounters_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PreRules_refreshCounters_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_refresh_counters_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_refresh_counters_minimum_set_gen.py index 4997bf81f87c..038341fd90da 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_refresh_counters_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_refresh_counters_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_refreshCounters_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PreRules_refreshCounters_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_reset_counters_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_reset_counters_maximum_set_gen.py index 94f64b4ad95e..fb78ef1d9a49 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_reset_counters_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_reset_counters_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_resetCounters_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PreRules_resetCounters_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_reset_counters_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_reset_counters_minimum_set_gen.py index 3782366f3270..577407e3d498 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_reset_counters_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_reset_counters_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_resetCounters_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PreRules_resetCounters_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_create_or_update_maximum_set_gen.py index 857d5b5c95fe..67438acb051b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_create_or_update_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -45,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListGlobalRulestack_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PrefixListGlobalRulestack_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_create_or_update_minimum_set_gen.py index 96356fd59da4..9ce937d9217f 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_create_or_update_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListGlobalRulestack_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PrefixListGlobalRulestack_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_delete_maximum_set_gen.py index 9e7cec848ccc..b132beb71f9b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_delete_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListGlobalRulestack_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PrefixListGlobalRulestack_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_delete_minimum_set_gen.py index 432985ee899b..61e45d961769 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_delete_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListGlobalRulestack_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PrefixListGlobalRulestack_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_get_maximum_set_gen.py index 8ba7421844a2..599ab6b029ca 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_get_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListGlobalRulestack_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PrefixListGlobalRulestack_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_get_minimum_set_gen.py index 1197c371bde9..63a9755ded32 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_get_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListGlobalRulestack_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PrefixListGlobalRulestack_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_list_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_list_maximum_set_gen.py index 11666ccb8b85..4da4eb0fc679 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_list_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_list_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListGlobalRulestack_List_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PrefixListGlobalRulestack_List_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_list_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_list_minimum_set_gen.py index 157c1a3628c1..cd6df209be71 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_list_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_list_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListGlobalRulestack_List_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PrefixListGlobalRulestack_List_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_create_or_update_maximum_set_gen.py index 7e79667026b0..f7804919cfab 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_create_or_update_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -46,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListLocalRulestack_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PrefixListLocalRulestack_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_create_or_update_minimum_set_gen.py index 7c75fb9895d3..3578b88bbad6 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_create_or_update_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -38,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListLocalRulestack_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PrefixListLocalRulestack_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_delete_maximum_set_gen.py index cf8241f8b4cb..0caf9a36d0b2 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_delete_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListLocalRulestack_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PrefixListLocalRulestack_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_delete_minimum_set_gen.py index 550041be8fde..8ea2deb18932 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_delete_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListLocalRulestack_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PrefixListLocalRulestack_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_get_maximum_set_gen.py index 705081bdfe20..2aba98929d16 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_get_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListLocalRulestack_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PrefixListLocalRulestack_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_get_minimum_set_gen.py index 97e5b4032c03..55cb5e68b321 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_get_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListLocalRulestack_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PrefixListLocalRulestack_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py index 8222e318c811..8309c15a9002 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListLocalRulestack_ListByLocalRulestacks_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PrefixListLocalRulestack_ListByLocalRulestacks_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py index 0963ee87e98d..fb5e178aeca7 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +8,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListLocalRulestack_ListByLocalRulestacks_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2025-10-08/examples/PrefixListLocalRulestack_ListByLocalRulestacks_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/conftest.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/conftest.py new file mode 100644 index 000000000000..2d9975133ae3 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/conftest.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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# For security, please avoid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + paloaltonetworksngfwmgmt_subscription_id = os.environ.get( + "AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" + ) + paloaltonetworksngfwmgmt_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + paloaltonetworksngfwmgmt_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + paloaltonetworksngfwmgmt_client_secret = os.environ.get( + "AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=paloaltonetworksngfwmgmt_subscription_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer(regex=paloaltonetworksngfwmgmt_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=paloaltonetworksngfwmgmt_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer( + regex=paloaltonetworksngfwmgmt_client_secret, value="00000000-0000-0000-0000-000000000000" + ) + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_certificate_object_global_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_certificate_object_global_rulestack_operations.py new file mode 100644 index 000000000000..3317dd6b3b60 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_certificate_object_global_rulestack_operations.py @@ -0,0 +1,85 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtCertificateObjectGlobalRulestackOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_certificate_object_global_rulestack_list(self, resource_group): + response = self.client.certificate_object_global_rulestack.list( + global_rulestack_name="str", + api_version="2025-10-08", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_certificate_object_global_rulestack_get(self, resource_group): + response = self.client.certificate_object_global_rulestack.get( + global_rulestack_name="str", + name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_certificate_object_global_rulestack_begin_create_or_update(self, resource_group): + response = self.client.certificate_object_global_rulestack.begin_create_or_update( + global_rulestack_name="str", + name="str", + resource={ + "certificateSelfSigned": "str", + "auditComment": "str", + "certificateSignerResourceId": "str", + "description": "str", + "etag": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-10-08", + ).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_certificate_object_global_rulestack_begin_delete(self, resource_group): + response = self.client.certificate_object_global_rulestack.begin_delete( + global_rulestack_name="str", + name="str", + api_version="2025-10-08", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_certificate_object_global_rulestack_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_certificate_object_global_rulestack_operations_async.py new file mode 100644 index 000000000000..fcdd69f26cf7 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_certificate_object_global_rulestack_operations_async.py @@ -0,0 +1,90 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtCertificateObjectGlobalRulestackOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_certificate_object_global_rulestack_list(self, resource_group): + response = self.client.certificate_object_global_rulestack.list( + global_rulestack_name="str", + api_version="2025-10-08", + ) + 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_certificate_object_global_rulestack_get(self, resource_group): + response = await self.client.certificate_object_global_rulestack.get( + global_rulestack_name="str", + name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_certificate_object_global_rulestack_begin_create_or_update(self, resource_group): + response = await ( + await self.client.certificate_object_global_rulestack.begin_create_or_update( + global_rulestack_name="str", + name="str", + resource={ + "certificateSelfSigned": "str", + "auditComment": "str", + "certificateSignerResourceId": "str", + "description": "str", + "etag": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-10-08", + ) + ).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_certificate_object_global_rulestack_begin_delete(self, resource_group): + response = await ( + await self.client.certificate_object_global_rulestack.begin_delete( + global_rulestack_name="str", + name="str", + api_version="2025-10-08", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_certificate_object_local_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_certificate_object_local_rulestack_operations.py new file mode 100644 index 000000000000..b05b587e1b64 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_certificate_object_local_rulestack_operations.py @@ -0,0 +1,89 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtCertificateObjectLocalRulestackOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_certificate_object_local_rulestack_list_by_local_rulestacks(self, resource_group): + response = self.client.certificate_object_local_rulestack.list_by_local_rulestacks( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-10-08", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_certificate_object_local_rulestack_get(self, resource_group): + response = self.client.certificate_object_local_rulestack.get( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_certificate_object_local_rulestack_begin_create_or_update(self, resource_group): + response = self.client.certificate_object_local_rulestack.begin_create_or_update( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + resource={ + "certificateSelfSigned": "str", + "auditComment": "str", + "certificateSignerResourceId": "str", + "description": "str", + "etag": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-10-08", + ).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_certificate_object_local_rulestack_begin_delete(self, resource_group): + response = self.client.certificate_object_local_rulestack.begin_delete( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + api_version="2025-10-08", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_certificate_object_local_rulestack_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_certificate_object_local_rulestack_operations_async.py new file mode 100644 index 000000000000..0a6253d767f9 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_certificate_object_local_rulestack_operations_async.py @@ -0,0 +1,94 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtCertificateObjectLocalRulestackOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_certificate_object_local_rulestack_list_by_local_rulestacks(self, resource_group): + response = self.client.certificate_object_local_rulestack.list_by_local_rulestacks( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-10-08", + ) + 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_certificate_object_local_rulestack_get(self, resource_group): + response = await self.client.certificate_object_local_rulestack.get( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_certificate_object_local_rulestack_begin_create_or_update(self, resource_group): + response = await ( + await self.client.certificate_object_local_rulestack.begin_create_or_update( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + resource={ + "certificateSelfSigned": "str", + "auditComment": "str", + "certificateSignerResourceId": "str", + "description": "str", + "etag": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-10-08", + ) + ).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_certificate_object_local_rulestack_begin_delete(self, resource_group): + response = await ( + await self.client.certificate_object_local_rulestack.begin_delete( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + api_version="2025-10-08", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_firewall_status_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_firewall_status_operations.py new file mode 100644 index 000000000000..344d8f2c8cad --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_firewall_status_operations.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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtFirewallStatusOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_firewall_status_list_by_firewalls(self, resource_group): + response = self.client.firewall_status.list_by_firewalls( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-10-08", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_firewall_status_get(self, resource_group): + response = self.client.firewall_status.get( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_firewall_status_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_firewall_status_operations_async.py new file mode 100644 index 000000000000..b675838bfeca --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_firewall_status_operations_async.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtFirewallStatusOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_firewall_status_list_by_firewalls(self, resource_group): + response = self.client.firewall_status.list_by_firewalls( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-10-08", + ) + 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_firewall_status_get(self, resource_group): + response = await self.client.firewall_status.get( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_firewalls_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_firewalls_operations.py new file mode 100644 index 000000000000..474a91b15955 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_firewalls_operations.py @@ -0,0 +1,294 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtFirewallsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_firewalls_list_by_subscription(self, resource_group): + response = self.client.firewalls.list_by_subscription( + api_version="2025-10-08", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_firewalls_list_by_resource_group(self, resource_group): + response = self.client.firewalls.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-10-08", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_firewalls_get(self, resource_group): + response = self.client.firewalls.get( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_firewalls_begin_create_or_update(self, resource_group): + response = self.client.firewalls.begin_create_or_update( + resource_group_name=resource_group.name, + firewall_name="str", + resource={ + "dnsSettings": { + "dnsServers": [{"address": "str", "resourceId": "str"}], + "enableDnsProxy": "str", + "enabledDnsType": "str", + }, + "location": "str", + "marketplaceDetails": { + "offerId": "str", + "publisherId": "str", + "marketplaceSubscriptionId": "str", + "marketplaceSubscriptionStatus": "str", + }, + "networkProfile": { + "enableEgressNat": "str", + "networkType": "str", + "publicIps": [{"address": "str", "resourceId": "str"}], + "egressNatIp": [{"address": "str", "resourceId": "str"}], + "privateSourceNatRulesDestination": ["str"], + "trustedRanges": ["str"], + "vnetConfiguration": { + "trustSubnet": {"addressSpace": "str", "resourceId": "str"}, + "unTrustSubnet": {"addressSpace": "str", "resourceId": "str"}, + "vnet": {"addressSpace": "str", "resourceId": "str"}, + "ipOfTrustSubnetForUdr": {"address": "str", "resourceId": "str"}, + }, + "vwanConfiguration": { + "vHub": {"addressSpace": "str", "resourceId": "str"}, + "ipOfTrustSubnetForUdr": {"address": "str", "resourceId": "str"}, + "networkVirtualApplianceId": "str", + "trustSubnet": {"addressSpace": "str", "resourceId": "str"}, + "unTrustSubnet": {"addressSpace": "str", "resourceId": "str"}, + }, + }, + "planData": { + "billingCycle": "str", + "planId": "str", + "effectiveDate": "2020-02-20 00:00:00", + "usageType": "str", + }, + "associatedRulestack": {"location": "str", "resourceId": "str", "rulestackId": "str"}, + "frontEndSettings": [ + { + "backendConfiguration": {"address": {"address": "str", "resourceId": "str"}, "port": "str"}, + "frontendConfiguration": {"address": {"address": "str", "resourceId": "str"}, "port": "str"}, + "name": "str", + "protocol": "str", + } + ], + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "isPanoramaManaged": "str", + "isStrataCloudManaged": "str", + "name": "str", + "panEtag": "str", + "panoramaConfig": { + "configString": "str", + "cgName": "str", + "dgName": "str", + "hostName": "str", + "panoramaServer": "str", + "panoramaServer2": "str", + "tplName": "str", + "vmAuthKey": "str", + }, + "provisioningState": "str", + "strataCloudManagerConfig": {"cloudManagerName": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2025-10-08", + ).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_firewalls_update(self, resource_group): + response = self.client.firewalls.update( + resource_group_name=resource_group.name, + firewall_name="str", + properties={ + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "properties": { + "associatedRulestack": {"location": "str", "resourceId": "str", "rulestackId": "str"}, + "dnsSettings": { + "dnsServers": [{"address": "str", "resourceId": "str"}], + "enableDnsProxy": "str", + "enabledDnsType": "str", + }, + "frontEndSettings": [ + { + "backendConfiguration": {"address": {"address": "str", "resourceId": "str"}, "port": "str"}, + "frontendConfiguration": { + "address": {"address": "str", "resourceId": "str"}, + "port": "str", + }, + "name": "str", + "protocol": "str", + } + ], + "isPanoramaManaged": "str", + "isStrataCloudManaged": "str", + "marketplaceDetails": { + "offerId": "str", + "publisherId": "str", + "marketplaceSubscriptionId": "str", + "marketplaceSubscriptionStatus": "str", + }, + "networkProfile": { + "enableEgressNat": "str", + "networkType": "str", + "publicIps": [{"address": "str", "resourceId": "str"}], + "egressNatIp": [{"address": "str", "resourceId": "str"}], + "privateSourceNatRulesDestination": ["str"], + "trustedRanges": ["str"], + "vnetConfiguration": { + "trustSubnet": {"addressSpace": "str", "resourceId": "str"}, + "unTrustSubnet": {"addressSpace": "str", "resourceId": "str"}, + "vnet": {"addressSpace": "str", "resourceId": "str"}, + "ipOfTrustSubnetForUdr": {"address": "str", "resourceId": "str"}, + }, + "vwanConfiguration": { + "vHub": {"addressSpace": "str", "resourceId": "str"}, + "ipOfTrustSubnetForUdr": {"address": "str", "resourceId": "str"}, + "networkVirtualApplianceId": "str", + "trustSubnet": {"addressSpace": "str", "resourceId": "str"}, + "unTrustSubnet": {"addressSpace": "str", "resourceId": "str"}, + }, + }, + "panEtag": "str", + "panoramaConfig": { + "configString": "str", + "cgName": "str", + "dgName": "str", + "hostName": "str", + "panoramaServer": "str", + "panoramaServer2": "str", + "tplName": "str", + "vmAuthKey": "str", + }, + "planData": { + "billingCycle": "str", + "planId": "str", + "effectiveDate": "2020-02-20 00:00:00", + "usageType": "str", + }, + "strataCloudManagerConfig": {"cloudManagerName": "str"}, + }, + "tags": {"str": "str"}, + }, + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_firewalls_begin_delete(self, resource_group): + response = self.client.firewalls.begin_delete( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-10-08", + ).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_firewalls_get_global_rulestack(self, resource_group): + response = self.client.firewalls.get_global_rulestack( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_firewalls_get_log_profile(self, resource_group): + response = self.client.firewalls.get_log_profile( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_firewalls_get_support_info(self, resource_group): + response = self.client.firewalls.get_support_info( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_firewalls_save_log_profile(self, resource_group): + response = self.client.firewalls.save_log_profile( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_firewalls_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_firewalls_operations_async.py new file mode 100644 index 000000000000..302783c3c888 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_firewalls_operations_async.py @@ -0,0 +1,302 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtFirewallsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_firewalls_list_by_subscription(self, resource_group): + response = self.client.firewalls.list_by_subscription( + api_version="2025-10-08", + ) + 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_firewalls_list_by_resource_group(self, resource_group): + response = self.client.firewalls.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-10-08", + ) + 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_firewalls_get(self, resource_group): + response = await self.client.firewalls.get( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_firewalls_begin_create_or_update(self, resource_group): + response = await ( + await self.client.firewalls.begin_create_or_update( + resource_group_name=resource_group.name, + firewall_name="str", + resource={ + "dnsSettings": { + "dnsServers": [{"address": "str", "resourceId": "str"}], + "enableDnsProxy": "str", + "enabledDnsType": "str", + }, + "location": "str", + "marketplaceDetails": { + "offerId": "str", + "publisherId": "str", + "marketplaceSubscriptionId": "str", + "marketplaceSubscriptionStatus": "str", + }, + "networkProfile": { + "enableEgressNat": "str", + "networkType": "str", + "publicIps": [{"address": "str", "resourceId": "str"}], + "egressNatIp": [{"address": "str", "resourceId": "str"}], + "privateSourceNatRulesDestination": ["str"], + "trustedRanges": ["str"], + "vnetConfiguration": { + "trustSubnet": {"addressSpace": "str", "resourceId": "str"}, + "unTrustSubnet": {"addressSpace": "str", "resourceId": "str"}, + "vnet": {"addressSpace": "str", "resourceId": "str"}, + "ipOfTrustSubnetForUdr": {"address": "str", "resourceId": "str"}, + }, + "vwanConfiguration": { + "vHub": {"addressSpace": "str", "resourceId": "str"}, + "ipOfTrustSubnetForUdr": {"address": "str", "resourceId": "str"}, + "networkVirtualApplianceId": "str", + "trustSubnet": {"addressSpace": "str", "resourceId": "str"}, + "unTrustSubnet": {"addressSpace": "str", "resourceId": "str"}, + }, + }, + "planData": { + "billingCycle": "str", + "planId": "str", + "effectiveDate": "2020-02-20 00:00:00", + "usageType": "str", + }, + "associatedRulestack": {"location": "str", "resourceId": "str", "rulestackId": "str"}, + "frontEndSettings": [ + { + "backendConfiguration": {"address": {"address": "str", "resourceId": "str"}, "port": "str"}, + "frontendConfiguration": { + "address": {"address": "str", "resourceId": "str"}, + "port": "str", + }, + "name": "str", + "protocol": "str", + } + ], + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "isPanoramaManaged": "str", + "isStrataCloudManaged": "str", + "name": "str", + "panEtag": "str", + "panoramaConfig": { + "configString": "str", + "cgName": "str", + "dgName": "str", + "hostName": "str", + "panoramaServer": "str", + "panoramaServer2": "str", + "tplName": "str", + "vmAuthKey": "str", + }, + "provisioningState": "str", + "strataCloudManagerConfig": {"cloudManagerName": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2025-10-08", + ) + ).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_firewalls_update(self, resource_group): + response = await self.client.firewalls.update( + resource_group_name=resource_group.name, + firewall_name="str", + properties={ + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "properties": { + "associatedRulestack": {"location": "str", "resourceId": "str", "rulestackId": "str"}, + "dnsSettings": { + "dnsServers": [{"address": "str", "resourceId": "str"}], + "enableDnsProxy": "str", + "enabledDnsType": "str", + }, + "frontEndSettings": [ + { + "backendConfiguration": {"address": {"address": "str", "resourceId": "str"}, "port": "str"}, + "frontendConfiguration": { + "address": {"address": "str", "resourceId": "str"}, + "port": "str", + }, + "name": "str", + "protocol": "str", + } + ], + "isPanoramaManaged": "str", + "isStrataCloudManaged": "str", + "marketplaceDetails": { + "offerId": "str", + "publisherId": "str", + "marketplaceSubscriptionId": "str", + "marketplaceSubscriptionStatus": "str", + }, + "networkProfile": { + "enableEgressNat": "str", + "networkType": "str", + "publicIps": [{"address": "str", "resourceId": "str"}], + "egressNatIp": [{"address": "str", "resourceId": "str"}], + "privateSourceNatRulesDestination": ["str"], + "trustedRanges": ["str"], + "vnetConfiguration": { + "trustSubnet": {"addressSpace": "str", "resourceId": "str"}, + "unTrustSubnet": {"addressSpace": "str", "resourceId": "str"}, + "vnet": {"addressSpace": "str", "resourceId": "str"}, + "ipOfTrustSubnetForUdr": {"address": "str", "resourceId": "str"}, + }, + "vwanConfiguration": { + "vHub": {"addressSpace": "str", "resourceId": "str"}, + "ipOfTrustSubnetForUdr": {"address": "str", "resourceId": "str"}, + "networkVirtualApplianceId": "str", + "trustSubnet": {"addressSpace": "str", "resourceId": "str"}, + "unTrustSubnet": {"addressSpace": "str", "resourceId": "str"}, + }, + }, + "panEtag": "str", + "panoramaConfig": { + "configString": "str", + "cgName": "str", + "dgName": "str", + "hostName": "str", + "panoramaServer": "str", + "panoramaServer2": "str", + "tplName": "str", + "vmAuthKey": "str", + }, + "planData": { + "billingCycle": "str", + "planId": "str", + "effectiveDate": "2020-02-20 00:00:00", + "usageType": "str", + }, + "strataCloudManagerConfig": {"cloudManagerName": "str"}, + }, + "tags": {"str": "str"}, + }, + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_firewalls_begin_delete(self, resource_group): + response = await ( + await self.client.firewalls.begin_delete( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-10-08", + ) + ).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_firewalls_get_global_rulestack(self, resource_group): + response = await self.client.firewalls.get_global_rulestack( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_firewalls_get_log_profile(self, resource_group): + response = await self.client.firewalls.get_log_profile( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_firewalls_get_support_info(self, resource_group): + response = await self.client.firewalls.get_support_info( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_firewalls_save_log_profile(self, resource_group): + response = await self.client.firewalls.save_log_profile( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_fqdn_list_global_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_fqdn_list_global_rulestack_operations.py new file mode 100644 index 000000000000..0a08543e2cd2 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_fqdn_list_global_rulestack_operations.py @@ -0,0 +1,84 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtFqdnListGlobalRulestackOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_fqdn_list_global_rulestack_list(self, resource_group): + response = self.client.fqdn_list_global_rulestack.list( + global_rulestack_name="str", + api_version="2025-10-08", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_fqdn_list_global_rulestack_get(self, resource_group): + response = self.client.fqdn_list_global_rulestack.get( + global_rulestack_name="str", + name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_fqdn_list_global_rulestack_begin_create_or_update(self, resource_group): + response = self.client.fqdn_list_global_rulestack.begin_create_or_update( + global_rulestack_name="str", + name="str", + resource={ + "fqdnList": ["str"], + "auditComment": "str", + "description": "str", + "etag": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-10-08", + ).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_fqdn_list_global_rulestack_begin_delete(self, resource_group): + response = self.client.fqdn_list_global_rulestack.begin_delete( + global_rulestack_name="str", + name="str", + api_version="2025-10-08", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_fqdn_list_global_rulestack_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_fqdn_list_global_rulestack_operations_async.py new file mode 100644 index 000000000000..f68173369eaf --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_fqdn_list_global_rulestack_operations_async.py @@ -0,0 +1,89 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtFqdnListGlobalRulestackOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_fqdn_list_global_rulestack_list(self, resource_group): + response = self.client.fqdn_list_global_rulestack.list( + global_rulestack_name="str", + api_version="2025-10-08", + ) + 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_fqdn_list_global_rulestack_get(self, resource_group): + response = await self.client.fqdn_list_global_rulestack.get( + global_rulestack_name="str", + name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_fqdn_list_global_rulestack_begin_create_or_update(self, resource_group): + response = await ( + await self.client.fqdn_list_global_rulestack.begin_create_or_update( + global_rulestack_name="str", + name="str", + resource={ + "fqdnList": ["str"], + "auditComment": "str", + "description": "str", + "etag": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-10-08", + ) + ).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_fqdn_list_global_rulestack_begin_delete(self, resource_group): + response = await ( + await self.client.fqdn_list_global_rulestack.begin_delete( + global_rulestack_name="str", + name="str", + api_version="2025-10-08", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_fqdn_list_local_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_fqdn_list_local_rulestack_operations.py new file mode 100644 index 000000000000..2f847bfc6af3 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_fqdn_list_local_rulestack_operations.py @@ -0,0 +1,88 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtFqdnListLocalRulestackOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_fqdn_list_local_rulestack_list_by_local_rulestacks(self, resource_group): + response = self.client.fqdn_list_local_rulestack.list_by_local_rulestacks( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-10-08", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_fqdn_list_local_rulestack_get(self, resource_group): + response = self.client.fqdn_list_local_rulestack.get( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_fqdn_list_local_rulestack_begin_create_or_update(self, resource_group): + response = self.client.fqdn_list_local_rulestack.begin_create_or_update( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + resource={ + "fqdnList": ["str"], + "auditComment": "str", + "description": "str", + "etag": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-10-08", + ).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_fqdn_list_local_rulestack_begin_delete(self, resource_group): + response = self.client.fqdn_list_local_rulestack.begin_delete( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + api_version="2025-10-08", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_fqdn_list_local_rulestack_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_fqdn_list_local_rulestack_operations_async.py new file mode 100644 index 000000000000..bbbd3e464286 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_fqdn_list_local_rulestack_operations_async.py @@ -0,0 +1,93 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtFqdnListLocalRulestackOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_fqdn_list_local_rulestack_list_by_local_rulestacks(self, resource_group): + response = self.client.fqdn_list_local_rulestack.list_by_local_rulestacks( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-10-08", + ) + 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_fqdn_list_local_rulestack_get(self, resource_group): + response = await self.client.fqdn_list_local_rulestack.get( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_fqdn_list_local_rulestack_begin_create_or_update(self, resource_group): + response = await ( + await self.client.fqdn_list_local_rulestack.begin_create_or_update( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + resource={ + "fqdnList": ["str"], + "auditComment": "str", + "description": "str", + "etag": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-10-08", + ) + ).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_fqdn_list_local_rulestack_begin_delete(self, resource_group): + response = await ( + await self.client.fqdn_list_local_rulestack.begin_delete( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + api_version="2025-10-08", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_global_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_global_rulestack_operations.py new file mode 100644 index 000000000000..f4c606293a3f --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_global_rulestack_operations.py @@ -0,0 +1,240 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtGlobalRulestackOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_global_rulestack_list(self, resource_group): + response = self.client.global_rulestack.list( + api_version="2025-10-08", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_global_rulestack_get(self, resource_group): + response = self.client.global_rulestack.get( + global_rulestack_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_global_rulestack_begin_create_or_update(self, resource_group): + response = self.client.global_rulestack.begin_create_or_update( + global_rulestack_name="str", + resource={ + "location": "str", + "associatedSubscriptions": ["str"], + "defaultMode": "str", + "description": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "minAppIdVersion": "str", + "name": "str", + "panEtag": "str", + "panLocation": "str", + "provisioningState": "str", + "scope": "str", + "securityServices": { + "antiSpywareProfile": "str", + "antiVirusProfile": "str", + "dnsSubscription": "str", + "fileBlockingProfile": "str", + "outboundTrustCertificate": "str", + "outboundUnTrustCertificate": "str", + "urlFilteringProfile": "str", + "vulnerabilityProfile": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-10-08", + ).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_global_rulestack_update(self, resource_group): + response = self.client.global_rulestack.update( + global_rulestack_name="str", + properties={ + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "properties": { + "associatedSubscriptions": ["str"], + "defaultMode": "str", + "description": "str", + "minAppIdVersion": "str", + "panEtag": "str", + "panLocation": "str", + "scope": "str", + "securityServices": { + "antiSpywareProfile": "str", + "antiVirusProfile": "str", + "dnsSubscription": "str", + "fileBlockingProfile": "str", + "outboundTrustCertificate": "str", + "outboundUnTrustCertificate": "str", + "urlFilteringProfile": "str", + "vulnerabilityProfile": "str", + }, + }, + }, + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_global_rulestack_begin_delete(self, resource_group): + response = self.client.global_rulestack.begin_delete( + global_rulestack_name="str", + api_version="2025-10-08", + ).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_global_rulestack_begin_commit(self, resource_group): + response = self.client.global_rulestack.begin_commit( + global_rulestack_name="str", + api_version="2025-10-08", + ).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_global_rulestack_get_change_log(self, resource_group): + response = self.client.global_rulestack.get_change_log( + global_rulestack_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_global_rulestack_list_advanced_security_objects(self, resource_group): + response = self.client.global_rulestack.list_advanced_security_objects( + global_rulestack_name="str", + type="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_global_rulestack_list_app_ids(self, resource_group): + response = self.client.global_rulestack.list_app_ids( + global_rulestack_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_global_rulestack_list_countries(self, resource_group): + response = self.client.global_rulestack.list_countries( + global_rulestack_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_global_rulestack_list_firewalls(self, resource_group): + response = self.client.global_rulestack.list_firewalls( + global_rulestack_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_global_rulestack_list_predefined_url_categories(self, resource_group): + response = self.client.global_rulestack.list_predefined_url_categories( + global_rulestack_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_global_rulestack_list_security_services(self, resource_group): + response = self.client.global_rulestack.list_security_services( + global_rulestack_name="str", + type="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_global_rulestack_revert(self, resource_group): + response = self.client.global_rulestack.revert( + global_rulestack_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_global_rulestack_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_global_rulestack_operations_async.py new file mode 100644 index 000000000000..7be4880cf02e --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_global_rulestack_operations_async.py @@ -0,0 +1,247 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtGlobalRulestackOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_global_rulestack_list(self, resource_group): + response = self.client.global_rulestack.list( + api_version="2025-10-08", + ) + 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_global_rulestack_get(self, resource_group): + response = await self.client.global_rulestack.get( + global_rulestack_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_global_rulestack_begin_create_or_update(self, resource_group): + response = await ( + await self.client.global_rulestack.begin_create_or_update( + global_rulestack_name="str", + resource={ + "location": "str", + "associatedSubscriptions": ["str"], + "defaultMode": "str", + "description": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "minAppIdVersion": "str", + "name": "str", + "panEtag": "str", + "panLocation": "str", + "provisioningState": "str", + "scope": "str", + "securityServices": { + "antiSpywareProfile": "str", + "antiVirusProfile": "str", + "dnsSubscription": "str", + "fileBlockingProfile": "str", + "outboundTrustCertificate": "str", + "outboundUnTrustCertificate": "str", + "urlFilteringProfile": "str", + "vulnerabilityProfile": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-10-08", + ) + ).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_global_rulestack_update(self, resource_group): + response = await self.client.global_rulestack.update( + global_rulestack_name="str", + properties={ + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "properties": { + "associatedSubscriptions": ["str"], + "defaultMode": "str", + "description": "str", + "minAppIdVersion": "str", + "panEtag": "str", + "panLocation": "str", + "scope": "str", + "securityServices": { + "antiSpywareProfile": "str", + "antiVirusProfile": "str", + "dnsSubscription": "str", + "fileBlockingProfile": "str", + "outboundTrustCertificate": "str", + "outboundUnTrustCertificate": "str", + "urlFilteringProfile": "str", + "vulnerabilityProfile": "str", + }, + }, + }, + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_global_rulestack_begin_delete(self, resource_group): + response = await ( + await self.client.global_rulestack.begin_delete( + global_rulestack_name="str", + api_version="2025-10-08", + ) + ).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_global_rulestack_begin_commit(self, resource_group): + response = await ( + await self.client.global_rulestack.begin_commit( + global_rulestack_name="str", + api_version="2025-10-08", + ) + ).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_global_rulestack_get_change_log(self, resource_group): + response = await self.client.global_rulestack.get_change_log( + global_rulestack_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_global_rulestack_list_advanced_security_objects(self, resource_group): + response = await self.client.global_rulestack.list_advanced_security_objects( + global_rulestack_name="str", + type="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_global_rulestack_list_app_ids(self, resource_group): + response = await self.client.global_rulestack.list_app_ids( + global_rulestack_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_global_rulestack_list_countries(self, resource_group): + response = await self.client.global_rulestack.list_countries( + global_rulestack_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_global_rulestack_list_firewalls(self, resource_group): + response = await self.client.global_rulestack.list_firewalls( + global_rulestack_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_global_rulestack_list_predefined_url_categories(self, resource_group): + response = await self.client.global_rulestack.list_predefined_url_categories( + global_rulestack_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_global_rulestack_list_security_services(self, resource_group): + response = await self.client.global_rulestack.list_security_services( + global_rulestack_name="str", + type="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_global_rulestack_revert(self, resource_group): + response = await self.client.global_rulestack.revert( + global_rulestack_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_local_rules_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_local_rules_operations.py new file mode 100644 index 000000000000..a55487a949f2 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_local_rules_operations.py @@ -0,0 +1,148 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtLocalRulesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rules_list_by_local_rulestacks(self, resource_group): + response = self.client.local_rules.list_by_local_rulestacks( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-10-08", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rules_get(self, resource_group): + response = self.client.local_rules.get( + resource_group_name=resource_group.name, + local_rulestack_name="str", + priority="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rules_begin_create_or_update(self, resource_group): + response = self.client.local_rules.begin_create_or_update( + resource_group_name=resource_group.name, + local_rulestack_name="str", + priority="str", + resource={ + "ruleName": "str", + "actionType": "str", + "applications": ["str"], + "auditComment": "str", + "category": {"feeds": ["str"], "urlCustom": ["str"]}, + "decryptionRuleType": "str", + "description": "str", + "destination": { + "cidrs": ["str"], + "countries": ["str"], + "feeds": ["str"], + "fqdnLists": ["str"], + "prefixLists": ["str"], + }, + "enableLogging": "str", + "etag": "str", + "id": "str", + "inboundInspectionCertificate": "str", + "name": "str", + "negateDestination": "str", + "negateSource": "str", + "priority": 0, + "protocol": "application-default", + "protocolPortList": ["str"], + "provisioningState": "str", + "ruleState": "str", + "source": {"cidrs": ["str"], "countries": ["str"], "feeds": ["str"], "prefixLists": ["str"]}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": [{"key": "str", "value": "str"}], + "type": "str", + }, + api_version="2025-10-08", + ).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_local_rules_begin_delete(self, resource_group): + response = self.client.local_rules.begin_delete( + resource_group_name=resource_group.name, + local_rulestack_name="str", + priority="str", + api_version="2025-10-08", + ).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_local_rules_get_counters(self, resource_group): + response = self.client.local_rules.get_counters( + resource_group_name=resource_group.name, + local_rulestack_name="str", + priority="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rules_refresh_counters(self, resource_group): + response = self.client.local_rules.refresh_counters( + resource_group_name=resource_group.name, + local_rulestack_name="str", + priority="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rules_reset_counters(self, resource_group): + response = self.client.local_rules.reset_counters( + resource_group_name=resource_group.name, + local_rulestack_name="str", + priority="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_local_rules_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_local_rules_operations_async.py new file mode 100644 index 000000000000..38eafda77b9a --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_local_rules_operations_async.py @@ -0,0 +1,153 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtLocalRulesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rules_list_by_local_rulestacks(self, resource_group): + response = self.client.local_rules.list_by_local_rulestacks( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-10-08", + ) + 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_local_rules_get(self, resource_group): + response = await self.client.local_rules.get( + resource_group_name=resource_group.name, + local_rulestack_name="str", + priority="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rules_begin_create_or_update(self, resource_group): + response = await ( + await self.client.local_rules.begin_create_or_update( + resource_group_name=resource_group.name, + local_rulestack_name="str", + priority="str", + resource={ + "ruleName": "str", + "actionType": "str", + "applications": ["str"], + "auditComment": "str", + "category": {"feeds": ["str"], "urlCustom": ["str"]}, + "decryptionRuleType": "str", + "description": "str", + "destination": { + "cidrs": ["str"], + "countries": ["str"], + "feeds": ["str"], + "fqdnLists": ["str"], + "prefixLists": ["str"], + }, + "enableLogging": "str", + "etag": "str", + "id": "str", + "inboundInspectionCertificate": "str", + "name": "str", + "negateDestination": "str", + "negateSource": "str", + "priority": 0, + "protocol": "application-default", + "protocolPortList": ["str"], + "provisioningState": "str", + "ruleState": "str", + "source": {"cidrs": ["str"], "countries": ["str"], "feeds": ["str"], "prefixLists": ["str"]}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": [{"key": "str", "value": "str"}], + "type": "str", + }, + api_version="2025-10-08", + ) + ).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_local_rules_begin_delete(self, resource_group): + response = await ( + await self.client.local_rules.begin_delete( + resource_group_name=resource_group.name, + local_rulestack_name="str", + priority="str", + api_version="2025-10-08", + ) + ).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_local_rules_get_counters(self, resource_group): + response = await self.client.local_rules.get_counters( + resource_group_name=resource_group.name, + local_rulestack_name="str", + priority="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rules_refresh_counters(self, resource_group): + response = await self.client.local_rules.refresh_counters( + resource_group_name=resource_group.name, + local_rulestack_name="str", + priority="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rules_reset_counters(self, resource_group): + response = await self.client.local_rules.reset_counters( + resource_group_name=resource_group.name, + local_rulestack_name="str", + priority="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_local_rulestacks_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_local_rulestacks_operations.py new file mode 100644 index 000000000000..0a4df28b955b --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_local_rulestacks_operations.py @@ -0,0 +1,277 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtLocalRulestacksOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rulestacks_list_by_subscription(self, resource_group): + response = self.client.local_rulestacks.list_by_subscription( + api_version="2025-10-08", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rulestacks_list_by_resource_group(self, resource_group): + response = self.client.local_rulestacks.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-10-08", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rulestacks_get(self, resource_group): + response = self.client.local_rulestacks.get( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rulestacks_begin_create_or_update(self, resource_group): + response = self.client.local_rulestacks.begin_create_or_update( + resource_group_name=resource_group.name, + local_rulestack_name="str", + resource={ + "location": "str", + "associatedSubscriptions": ["str"], + "defaultMode": "str", + "description": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "minAppIdVersion": "str", + "name": "str", + "panEtag": "str", + "panLocation": "str", + "provisioningState": "str", + "scope": "str", + "securityServices": { + "antiSpywareProfile": "str", + "antiVirusProfile": "str", + "dnsSubscription": "str", + "fileBlockingProfile": "str", + "outboundTrustCertificate": "str", + "outboundUnTrustCertificate": "str", + "urlFilteringProfile": "str", + "vulnerabilityProfile": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2025-10-08", + ).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_local_rulestacks_update(self, resource_group): + response = self.client.local_rulestacks.update( + resource_group_name=resource_group.name, + local_rulestack_name="str", + properties={ + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "properties": { + "associatedSubscriptions": ["str"], + "defaultMode": "str", + "description": "str", + "minAppIdVersion": "str", + "panEtag": "str", + "panLocation": "str", + "scope": "str", + "securityServices": { + "antiSpywareProfile": "str", + "antiVirusProfile": "str", + "dnsSubscription": "str", + "fileBlockingProfile": "str", + "outboundTrustCertificate": "str", + "outboundUnTrustCertificate": "str", + "urlFilteringProfile": "str", + "vulnerabilityProfile": "str", + }, + }, + "tags": {"str": "str"}, + }, + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rulestacks_begin_delete(self, resource_group): + response = self.client.local_rulestacks.begin_delete( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-10-08", + ).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_local_rulestacks_begin_commit(self, resource_group): + response = self.client.local_rulestacks.begin_commit( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-10-08", + ).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_local_rulestacks_get_change_log(self, resource_group): + response = self.client.local_rulestacks.get_change_log( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rulestacks_get_support_info(self, resource_group): + response = self.client.local_rulestacks.get_support_info( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rulestacks_list_advanced_security_objects(self, resource_group): + response = self.client.local_rulestacks.list_advanced_security_objects( + resource_group_name=resource_group.name, + local_rulestack_name="str", + type="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rulestacks_list_app_ids(self, resource_group): + response = self.client.local_rulestacks.list_app_ids( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-10-08", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rulestacks_list_countries(self, resource_group): + response = self.client.local_rulestacks.list_countries( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-10-08", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rulestacks_list_firewalls(self, resource_group): + response = self.client.local_rulestacks.list_firewalls( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rulestacks_list_predefined_url_categories(self, resource_group): + response = self.client.local_rulestacks.list_predefined_url_categories( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-10-08", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rulestacks_list_security_services(self, resource_group): + response = self.client.local_rulestacks.list_security_services( + resource_group_name=resource_group.name, + local_rulestack_name="str", + type="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rulestacks_revert(self, resource_group): + response = self.client.local_rulestacks.revert( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_local_rulestacks_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_local_rulestacks_operations_async.py new file mode 100644 index 000000000000..0ac06a085f45 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_local_rulestacks_operations_async.py @@ -0,0 +1,284 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtLocalRulestacksOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rulestacks_list_by_subscription(self, resource_group): + response = self.client.local_rulestacks.list_by_subscription( + api_version="2025-10-08", + ) + 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_local_rulestacks_list_by_resource_group(self, resource_group): + response = self.client.local_rulestacks.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-10-08", + ) + 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_local_rulestacks_get(self, resource_group): + response = await self.client.local_rulestacks.get( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rulestacks_begin_create_or_update(self, resource_group): + response = await ( + await self.client.local_rulestacks.begin_create_or_update( + resource_group_name=resource_group.name, + local_rulestack_name="str", + resource={ + "location": "str", + "associatedSubscriptions": ["str"], + "defaultMode": "str", + "description": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "minAppIdVersion": "str", + "name": "str", + "panEtag": "str", + "panLocation": "str", + "provisioningState": "str", + "scope": "str", + "securityServices": { + "antiSpywareProfile": "str", + "antiVirusProfile": "str", + "dnsSubscription": "str", + "fileBlockingProfile": "str", + "outboundTrustCertificate": "str", + "outboundUnTrustCertificate": "str", + "urlFilteringProfile": "str", + "vulnerabilityProfile": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2025-10-08", + ) + ).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_local_rulestacks_update(self, resource_group): + response = await self.client.local_rulestacks.update( + resource_group_name=resource_group.name, + local_rulestack_name="str", + properties={ + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "properties": { + "associatedSubscriptions": ["str"], + "defaultMode": "str", + "description": "str", + "minAppIdVersion": "str", + "panEtag": "str", + "panLocation": "str", + "scope": "str", + "securityServices": { + "antiSpywareProfile": "str", + "antiVirusProfile": "str", + "dnsSubscription": "str", + "fileBlockingProfile": "str", + "outboundTrustCertificate": "str", + "outboundUnTrustCertificate": "str", + "urlFilteringProfile": "str", + "vulnerabilityProfile": "str", + }, + }, + "tags": {"str": "str"}, + }, + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rulestacks_begin_delete(self, resource_group): + response = await ( + await self.client.local_rulestacks.begin_delete( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-10-08", + ) + ).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_local_rulestacks_begin_commit(self, resource_group): + response = await ( + await self.client.local_rulestacks.begin_commit( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-10-08", + ) + ).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_local_rulestacks_get_change_log(self, resource_group): + response = await self.client.local_rulestacks.get_change_log( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rulestacks_get_support_info(self, resource_group): + response = await self.client.local_rulestacks.get_support_info( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rulestacks_list_advanced_security_objects(self, resource_group): + response = await self.client.local_rulestacks.list_advanced_security_objects( + resource_group_name=resource_group.name, + local_rulestack_name="str", + type="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rulestacks_list_app_ids(self, resource_group): + response = self.client.local_rulestacks.list_app_ids( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-10-08", + ) + 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_local_rulestacks_list_countries(self, resource_group): + response = self.client.local_rulestacks.list_countries( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-10-08", + ) + 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_local_rulestacks_list_firewalls(self, resource_group): + response = await self.client.local_rulestacks.list_firewalls( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rulestacks_list_predefined_url_categories(self, resource_group): + response = self.client.local_rulestacks.list_predefined_url_categories( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-10-08", + ) + 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_local_rulestacks_list_security_services(self, resource_group): + response = await self.client.local_rulestacks.list_security_services( + resource_group_name=resource_group.name, + local_rulestack_name="str", + type="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rulestacks_revert(self, resource_group): + response = await self.client.local_rulestacks.revert( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_metrics_object_firewall_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_metrics_object_firewall_operations.py new file mode 100644 index 000000000000..a888945b5489 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_metrics_object_firewall_operations.py @@ -0,0 +1,84 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtMetricsObjectFirewallOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_metrics_object_firewall_list_by_firewalls(self, resource_group): + response = self.client.metrics_object_firewall.list_by_firewalls( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-10-08", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_metrics_object_firewall_get(self, resource_group): + response = self.client.metrics_object_firewall.get( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_metrics_object_firewall_begin_create_or_update(self, resource_group): + response = self.client.metrics_object_firewall.begin_create_or_update( + resource_group_name=resource_group.name, + firewall_name="str", + resource={ + "applicationInsightsConnectionString": "str", + "applicationInsightsResourceId": "str", + "id": "str", + "name": "str", + "panEtag": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-10-08", + ).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_metrics_object_firewall_begin_delete(self, resource_group): + response = self.client.metrics_object_firewall.begin_delete( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-10-08", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_metrics_object_firewall_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_metrics_object_firewall_operations_async.py new file mode 100644 index 000000000000..00f742d99c87 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_metrics_object_firewall_operations_async.py @@ -0,0 +1,89 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtMetricsObjectFirewallOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_metrics_object_firewall_list_by_firewalls(self, resource_group): + response = self.client.metrics_object_firewall.list_by_firewalls( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-10-08", + ) + 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_metrics_object_firewall_get(self, resource_group): + response = await self.client.metrics_object_firewall.get( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_metrics_object_firewall_begin_create_or_update(self, resource_group): + response = await ( + await self.client.metrics_object_firewall.begin_create_or_update( + resource_group_name=resource_group.name, + firewall_name="str", + resource={ + "applicationInsightsConnectionString": "str", + "applicationInsightsResourceId": "str", + "id": "str", + "name": "str", + "panEtag": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-10-08", + ) + ).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_metrics_object_firewall_begin_delete(self, resource_group): + response = await ( + await self.client.metrics_object_firewall.begin_delete( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-10-08", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_operations.py new file mode 100644 index 000000000000..916a97f009c7 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_operations.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_operations_list(self, resource_group): + response = self.client.operations.list( + api_version="2025-10-08", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_operations_async.py new file mode 100644 index 000000000000..c1fb8709fc02 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_operations_async.py @@ -0,0 +1,30 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_operations_list(self, resource_group): + response = self.client.operations.list( + api_version="2025-10-08", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_palo_alto_networks_cloudngfw_operations_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_palo_alto_networks_cloudngfw_operations_operations.py new file mode 100644 index 000000000000..954ee5a17dd7 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_palo_alto_networks_cloudngfw_operations_operations.py @@ -0,0 +1,59 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtPaloAltoNetworksCloudngfwOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_palo_alto_networks_cloudngfw_operations_create_product_serial_number(self, resource_group): + response = self.client.palo_alto_networks_cloudngfw_operations.create_product_serial_number( + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_palo_alto_networks_cloudngfw_operations_list_cloud_manager_tenants(self, resource_group): + response = self.client.palo_alto_networks_cloudngfw_operations.list_cloud_manager_tenants( + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_palo_alto_networks_cloudngfw_operations_list_product_serial_number_status(self, resource_group): + response = self.client.palo_alto_networks_cloudngfw_operations.list_product_serial_number_status( + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_palo_alto_networks_cloudngfw_operations_list_support_info(self, resource_group): + response = self.client.palo_alto_networks_cloudngfw_operations.list_support_info( + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_palo_alto_networks_cloudngfw_operations_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_palo_alto_networks_cloudngfw_operations_operations_async.py new file mode 100644 index 000000000000..daf02f8ea489 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_palo_alto_networks_cloudngfw_operations_operations_async.py @@ -0,0 +1,60 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtPaloAltoNetworksCloudngfwOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_palo_alto_networks_cloudngfw_operations_create_product_serial_number(self, resource_group): + response = await self.client.palo_alto_networks_cloudngfw_operations.create_product_serial_number( + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_palo_alto_networks_cloudngfw_operations_list_cloud_manager_tenants(self, resource_group): + response = await self.client.palo_alto_networks_cloudngfw_operations.list_cloud_manager_tenants( + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_palo_alto_networks_cloudngfw_operations_list_product_serial_number_status(self, resource_group): + response = await self.client.palo_alto_networks_cloudngfw_operations.list_product_serial_number_status( + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_palo_alto_networks_cloudngfw_operations_list_support_info(self, resource_group): + response = await self.client.palo_alto_networks_cloudngfw_operations.list_support_info( + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_post_rules_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_post_rules_operations.py new file mode 100644 index 000000000000..fde4ad15e9d1 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_post_rules_operations.py @@ -0,0 +1,141 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtPostRulesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_post_rules_list(self, resource_group): + response = self.client.post_rules.list( + global_rulestack_name="str", + api_version="2025-10-08", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_post_rules_get(self, resource_group): + response = self.client.post_rules.get( + global_rulestack_name="str", + priority="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_post_rules_begin_create_or_update(self, resource_group): + response = self.client.post_rules.begin_create_or_update( + global_rulestack_name="str", + priority="str", + resource={ + "ruleName": "str", + "actionType": "str", + "applications": ["str"], + "auditComment": "str", + "category": {"feeds": ["str"], "urlCustom": ["str"]}, + "decryptionRuleType": "str", + "description": "str", + "destination": { + "cidrs": ["str"], + "countries": ["str"], + "feeds": ["str"], + "fqdnLists": ["str"], + "prefixLists": ["str"], + }, + "enableLogging": "str", + "etag": "str", + "id": "str", + "inboundInspectionCertificate": "str", + "name": "str", + "negateDestination": "str", + "negateSource": "str", + "priority": 0, + "protocol": "application-default", + "protocolPortList": ["str"], + "provisioningState": "str", + "ruleState": "str", + "source": {"cidrs": ["str"], "countries": ["str"], "feeds": ["str"], "prefixLists": ["str"]}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": [{"key": "str", "value": "str"}], + "type": "str", + }, + api_version="2025-10-08", + ).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_post_rules_begin_delete(self, resource_group): + response = self.client.post_rules.begin_delete( + global_rulestack_name="str", + priority="str", + api_version="2025-10-08", + ).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_post_rules_get_counters(self, resource_group): + response = self.client.post_rules.get_counters( + global_rulestack_name="str", + priority="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_post_rules_refresh_counters(self, resource_group): + response = self.client.post_rules.refresh_counters( + global_rulestack_name="str", + priority="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_post_rules_reset_counters(self, resource_group): + response = self.client.post_rules.reset_counters( + global_rulestack_name="str", + priority="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_post_rules_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_post_rules_operations_async.py new file mode 100644 index 000000000000..80a7a5c59c7f --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_post_rules_operations_async.py @@ -0,0 +1,146 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtPostRulesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_post_rules_list(self, resource_group): + response = self.client.post_rules.list( + global_rulestack_name="str", + api_version="2025-10-08", + ) + 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_post_rules_get(self, resource_group): + response = await self.client.post_rules.get( + global_rulestack_name="str", + priority="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_post_rules_begin_create_or_update(self, resource_group): + response = await ( + await self.client.post_rules.begin_create_or_update( + global_rulestack_name="str", + priority="str", + resource={ + "ruleName": "str", + "actionType": "str", + "applications": ["str"], + "auditComment": "str", + "category": {"feeds": ["str"], "urlCustom": ["str"]}, + "decryptionRuleType": "str", + "description": "str", + "destination": { + "cidrs": ["str"], + "countries": ["str"], + "feeds": ["str"], + "fqdnLists": ["str"], + "prefixLists": ["str"], + }, + "enableLogging": "str", + "etag": "str", + "id": "str", + "inboundInspectionCertificate": "str", + "name": "str", + "negateDestination": "str", + "negateSource": "str", + "priority": 0, + "protocol": "application-default", + "protocolPortList": ["str"], + "provisioningState": "str", + "ruleState": "str", + "source": {"cidrs": ["str"], "countries": ["str"], "feeds": ["str"], "prefixLists": ["str"]}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": [{"key": "str", "value": "str"}], + "type": "str", + }, + api_version="2025-10-08", + ) + ).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_post_rules_begin_delete(self, resource_group): + response = await ( + await self.client.post_rules.begin_delete( + global_rulestack_name="str", + priority="str", + api_version="2025-10-08", + ) + ).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_post_rules_get_counters(self, resource_group): + response = await self.client.post_rules.get_counters( + global_rulestack_name="str", + priority="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_post_rules_refresh_counters(self, resource_group): + response = await self.client.post_rules.refresh_counters( + global_rulestack_name="str", + priority="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_post_rules_reset_counters(self, resource_group): + response = await self.client.post_rules.reset_counters( + global_rulestack_name="str", + priority="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_pre_rules_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_pre_rules_operations.py new file mode 100644 index 000000000000..6e48248d438c --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_pre_rules_operations.py @@ -0,0 +1,141 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtPreRulesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_pre_rules_list(self, resource_group): + response = self.client.pre_rules.list( + global_rulestack_name="str", + api_version="2025-10-08", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_pre_rules_get(self, resource_group): + response = self.client.pre_rules.get( + global_rulestack_name="str", + priority="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_pre_rules_begin_create_or_update(self, resource_group): + response = self.client.pre_rules.begin_create_or_update( + global_rulestack_name="str", + priority="str", + resource={ + "ruleName": "str", + "actionType": "str", + "applications": ["str"], + "auditComment": "str", + "category": {"feeds": ["str"], "urlCustom": ["str"]}, + "decryptionRuleType": "str", + "description": "str", + "destination": { + "cidrs": ["str"], + "countries": ["str"], + "feeds": ["str"], + "fqdnLists": ["str"], + "prefixLists": ["str"], + }, + "enableLogging": "str", + "etag": "str", + "id": "str", + "inboundInspectionCertificate": "str", + "name": "str", + "negateDestination": "str", + "negateSource": "str", + "priority": 0, + "protocol": "application-default", + "protocolPortList": ["str"], + "provisioningState": "str", + "ruleState": "str", + "source": {"cidrs": ["str"], "countries": ["str"], "feeds": ["str"], "prefixLists": ["str"]}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": [{"key": "str", "value": "str"}], + "type": "str", + }, + api_version="2025-10-08", + ).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_pre_rules_begin_delete(self, resource_group): + response = self.client.pre_rules.begin_delete( + global_rulestack_name="str", + priority="str", + api_version="2025-10-08", + ).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_pre_rules_get_counters(self, resource_group): + response = self.client.pre_rules.get_counters( + global_rulestack_name="str", + priority="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_pre_rules_refresh_counters(self, resource_group): + response = self.client.pre_rules.refresh_counters( + global_rulestack_name="str", + priority="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_pre_rules_reset_counters(self, resource_group): + response = self.client.pre_rules.reset_counters( + global_rulestack_name="str", + priority="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_pre_rules_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_pre_rules_operations_async.py new file mode 100644 index 000000000000..9141b66f8502 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_pre_rules_operations_async.py @@ -0,0 +1,146 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtPreRulesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_pre_rules_list(self, resource_group): + response = self.client.pre_rules.list( + global_rulestack_name="str", + api_version="2025-10-08", + ) + 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_pre_rules_get(self, resource_group): + response = await self.client.pre_rules.get( + global_rulestack_name="str", + priority="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_pre_rules_begin_create_or_update(self, resource_group): + response = await ( + await self.client.pre_rules.begin_create_or_update( + global_rulestack_name="str", + priority="str", + resource={ + "ruleName": "str", + "actionType": "str", + "applications": ["str"], + "auditComment": "str", + "category": {"feeds": ["str"], "urlCustom": ["str"]}, + "decryptionRuleType": "str", + "description": "str", + "destination": { + "cidrs": ["str"], + "countries": ["str"], + "feeds": ["str"], + "fqdnLists": ["str"], + "prefixLists": ["str"], + }, + "enableLogging": "str", + "etag": "str", + "id": "str", + "inboundInspectionCertificate": "str", + "name": "str", + "negateDestination": "str", + "negateSource": "str", + "priority": 0, + "protocol": "application-default", + "protocolPortList": ["str"], + "provisioningState": "str", + "ruleState": "str", + "source": {"cidrs": ["str"], "countries": ["str"], "feeds": ["str"], "prefixLists": ["str"]}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": [{"key": "str", "value": "str"}], + "type": "str", + }, + api_version="2025-10-08", + ) + ).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_pre_rules_begin_delete(self, resource_group): + response = await ( + await self.client.pre_rules.begin_delete( + global_rulestack_name="str", + priority="str", + api_version="2025-10-08", + ) + ).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_pre_rules_get_counters(self, resource_group): + response = await self.client.pre_rules.get_counters( + global_rulestack_name="str", + priority="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_pre_rules_refresh_counters(self, resource_group): + response = await self.client.pre_rules.refresh_counters( + global_rulestack_name="str", + priority="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_pre_rules_reset_counters(self, resource_group): + response = await self.client.pre_rules.reset_counters( + global_rulestack_name="str", + priority="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_prefix_list_global_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_prefix_list_global_rulestack_operations.py new file mode 100644 index 000000000000..e5f307cacf62 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_prefix_list_global_rulestack_operations.py @@ -0,0 +1,84 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtPrefixListGlobalRulestackOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_prefix_list_global_rulestack_list(self, resource_group): + response = self.client.prefix_list_global_rulestack.list( + global_rulestack_name="str", + api_version="2025-10-08", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_prefix_list_global_rulestack_get(self, resource_group): + response = self.client.prefix_list_global_rulestack.get( + global_rulestack_name="str", + name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_prefix_list_global_rulestack_begin_create_or_update(self, resource_group): + response = self.client.prefix_list_global_rulestack.begin_create_or_update( + global_rulestack_name="str", + name="str", + resource={ + "prefixList": ["str"], + "auditComment": "str", + "description": "str", + "etag": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-10-08", + ).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_prefix_list_global_rulestack_begin_delete(self, resource_group): + response = self.client.prefix_list_global_rulestack.begin_delete( + global_rulestack_name="str", + name="str", + api_version="2025-10-08", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_prefix_list_global_rulestack_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_prefix_list_global_rulestack_operations_async.py new file mode 100644 index 000000000000..a280d2b018bd --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_prefix_list_global_rulestack_operations_async.py @@ -0,0 +1,89 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtPrefixListGlobalRulestackOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_prefix_list_global_rulestack_list(self, resource_group): + response = self.client.prefix_list_global_rulestack.list( + global_rulestack_name="str", + api_version="2025-10-08", + ) + 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_prefix_list_global_rulestack_get(self, resource_group): + response = await self.client.prefix_list_global_rulestack.get( + global_rulestack_name="str", + name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_prefix_list_global_rulestack_begin_create_or_update(self, resource_group): + response = await ( + await self.client.prefix_list_global_rulestack.begin_create_or_update( + global_rulestack_name="str", + name="str", + resource={ + "prefixList": ["str"], + "auditComment": "str", + "description": "str", + "etag": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-10-08", + ) + ).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_prefix_list_global_rulestack_begin_delete(self, resource_group): + response = await ( + await self.client.prefix_list_global_rulestack.begin_delete( + global_rulestack_name="str", + name="str", + api_version="2025-10-08", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_prefix_list_local_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_prefix_list_local_rulestack_operations.py new file mode 100644 index 000000000000..a3175f7eb292 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_prefix_list_local_rulestack_operations.py @@ -0,0 +1,88 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtPrefixListLocalRulestackOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_prefix_list_local_rulestack_list_by_local_rulestacks(self, resource_group): + response = self.client.prefix_list_local_rulestack.list_by_local_rulestacks( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-10-08", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_prefix_list_local_rulestack_get(self, resource_group): + response = self.client.prefix_list_local_rulestack.get( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_prefix_list_local_rulestack_begin_create_or_update(self, resource_group): + response = self.client.prefix_list_local_rulestack.begin_create_or_update( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + resource={ + "prefixList": ["str"], + "auditComment": "str", + "description": "str", + "etag": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-10-08", + ).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_prefix_list_local_rulestack_begin_delete(self, resource_group): + response = self.client.prefix_list_local_rulestack.begin_delete( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + api_version="2025-10-08", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_prefix_list_local_rulestack_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_prefix_list_local_rulestack_operations_async.py new file mode 100644 index 000000000000..103911c8f35c --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_prefix_list_local_rulestack_operations_async.py @@ -0,0 +1,93 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +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 TestPaloAltoNetworksNgfwMgmtPrefixListLocalRulestackOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_prefix_list_local_rulestack_list_by_local_rulestacks(self, resource_group): + response = self.client.prefix_list_local_rulestack.list_by_local_rulestacks( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-10-08", + ) + 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_prefix_list_local_rulestack_get(self, resource_group): + response = await self.client.prefix_list_local_rulestack.get( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + api_version="2025-10-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_prefix_list_local_rulestack_begin_create_or_update(self, resource_group): + response = await ( + await self.client.prefix_list_local_rulestack.begin_create_or_update( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + resource={ + "prefixList": ["str"], + "auditComment": "str", + "description": "str", + "etag": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-10-08", + ) + ).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_prefix_list_local_rulestack_begin_delete(self, resource_group): + response = await ( + await self.client.prefix_list_local_rulestack.begin_delete( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + api_version="2025-10-08", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/pyproject.toml b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/pyproject.toml index 540da07d41af..c591a040e69c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/pyproject.toml +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/pyproject.toml @@ -1,6 +1,88 @@ +[build-system] +requires = [ + "setuptools>=77.0.3", + "wheel", +] +build-backend = "setuptools.build_meta" + +[project] +name = "azure-mgmt-paloaltonetworksngfw" +authors = [ + { name = "Microsoft Corporation", email = "azpysdkhelp@microsoft.com" }, +] +description = "Microsoft Azure Paloaltonetworksngfw Management Client Library for Python" +license = "MIT" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", +] +requires-python = ">=3.9" +keywords = [ + "azure", + "azure sdk", +] +dependencies = [ + "msrest>=0.7.1", + "azure-mgmt-core>=1.6.0", + "typing-extensions>=4.6.0", +] +dynamic = [ + "version", + "readme", +] + +[project.urls] +repository = "https://github.com/Azure/azure-sdk-for-python" + +[tool.setuptools.dynamic.version] +attr = "azure.mgmt.paloaltonetworksngfw._version.VERSION" + +[tool.setuptools.dynamic.readme] +file = [ + "README.md", + "CHANGELOG.md", +] +content-type = "text/markdown" + +[tool.setuptools.packages.find] +exclude = [ + "tests*", + "generated_tests*", + "samples*", + "generated_samples*", + "doc*", + "azure", + "azure.mgmt", +] + +[tool.setuptools.package-data] +pytyped = [ + "py.typed", +] + [tool.azure-sdk-build] breaking = false mypy = false pyright = false type_check_samples = false verifytypes = false + +[packaging] +package_name = "azure-mgmt-paloaltonetworksngfw" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "Paloaltonetworksngfw Management" +package_doc_id = "" +is_stable = true +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true +sample_link = "" +title = "PaloAltoNetworksNgfwMgmtClient" +exclude_folders = "" diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/sdk_packaging.toml b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/sdk_packaging.toml deleted file mode 100644 index c5436f74297e..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/sdk_packaging.toml +++ /dev/null @@ -1,11 +0,0 @@ -[packaging] -package_name = "azure-mgmt-paloaltonetworksngfw" -package_nspkg = "azure-mgmt-nspkg" -package_pprint_name = "Paloaltonetworksngfw Management" -package_doc_id = "" -is_stable = true -is_arm = true -need_msrestazure = false -need_azuremgmtcore = true -sample_link = "" -title = "PaloAltoNetworksNgfwMgmtClient" diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/setup.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/setup.py deleted file mode 100644 index 11c58a5e8888..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/setup.py +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/env python - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -import re -import os.path -from io import open -from setuptools import find_packages, setup - -# Change the PACKAGE_NAME only to change folder and different name -PACKAGE_NAME = "azure-mgmt-paloaltonetworksngfw" -PACKAGE_PPRINT_NAME = "Paloaltonetworksngfw Management" - -# a-b-c => a/b/c -package_folder_path = PACKAGE_NAME.replace("-", "/") -# a-b-c => a.b.c -namespace_name = PACKAGE_NAME.replace("-", ".") - -# Version extraction inspired from 'requests' -with open( - os.path.join(package_folder_path, "version.py") - if os.path.exists(os.path.join(package_folder_path, "version.py")) - else os.path.join(package_folder_path, "_version.py"), - "r", -) as fd: - version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) - -if not version: - raise RuntimeError("Cannot find version information") - -with open("README.md", encoding="utf-8") as f: - readme = f.read() -with open("CHANGELOG.md", encoding="utf-8") as f: - changelog = f.read() - -setup( - name=PACKAGE_NAME, - version=version, - description="Microsoft Azure {} Client Library for Python".format(PACKAGE_PPRINT_NAME), - long_description=readme + "\n\n" + changelog, - long_description_content_type="text/markdown", - license="MIT License", - author="Microsoft Corporation", - author_email="azpysdkhelp@microsoft.com", - url="https://github.com/Azure/azure-sdk-for-python", - keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Programming Language :: Python", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "License :: OSI Approved :: MIT License", - ], - zip_safe=False, - packages=find_packages( - exclude=[ - "tests", - # Exclude packages that will be covered by PEP420 or nspkg - "azure", - "azure.mgmt", - ] - ), - include_package_data=True, - package_data={ - "pytyped": ["py.typed"], - }, - install_requires=[ - "isodate<1.0.0,>=0.6.1", - "azure-common~=1.1", - "azure-mgmt-core>=1.3.2,<2.0.0", - "typing-extensions>=4.3.0; python_version<'3.8.0'", - ], - python_requires=">=3.7", -) diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/conftest.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/conftest.py index 95873fd30c68..78a6c7a6af66 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/conftest.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/conftest.py @@ -1,50 +1,43 @@ +# coding=utf-8 # -------------------------------------------------------------------------- -# # Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import os -import platform import pytest -import sys - from dotenv import load_dotenv - -from devtools_testutils import test_proxy, add_general_regex_sanitizer -from devtools_testutils import add_header_regex_sanitizer, add_body_key_sanitizer +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) load_dotenv() + +# For security, please avoid record sensitive identity information in recordings @pytest.fixture(scope="session", autouse=True) def add_sanitizers(test_proxy): - subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") - client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") - client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=subscription_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=tenant_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=client_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=client_secret, value="00000000-0000-0000-0000-000000000000") + paloaltonetworksngfwmgmt_subscription_id = os.environ.get( + "AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" + ) + paloaltonetworksngfwmgmt_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + paloaltonetworksngfwmgmt_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + paloaltonetworksngfwmgmt_client_secret = os.environ.get( + "AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=paloaltonetworksngfwmgmt_subscription_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer(regex=paloaltonetworksngfwmgmt_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=paloaltonetworksngfwmgmt_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer( + regex=paloaltonetworksngfwmgmt_client_secret, value="00000000-0000-0000-0000-000000000000" + ) + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") add_header_regex_sanitizer(key="Cookie", value="cookie;") add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/test_cli_mgmt_paloaltonetworksngfw.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/test_cli_mgmt_paloaltonetworksngfw_test.py similarity index 65% rename from sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/test_cli_mgmt_paloaltonetworksngfw.py rename to sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/test_cli_mgmt_paloaltonetworksngfw_test.py index c52cc4b28fef..7f00ad43482e 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/test_cli_mgmt_paloaltonetworksngfw.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/test_cli_mgmt_paloaltonetworksngfw_test.py @@ -1,10 +1,10 @@ # 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. -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- import unittest import pytest @@ -12,15 +12,15 @@ import azure.mgmt.paloaltonetworksngfw from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy -AZURE_LOCATION = 'eastus' +AZURE_LOCATION = "eastus" + +@pytest.mark.live_test_only class TestMgmtPaloaltonetworksngfw(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.mgmt_client = self.create_mgmt_client( - azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient - ) - + self.mgmt_client = self.create_mgmt_client(azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_paloaltonetworksngfw(self, resource_group): @@ -29,6 +29,7 @@ def test_paloaltonetworksngfw(self, resource_group): assert list(self.mgmt_client.operations.list()) -#------------------------------------------------------------------------------ -if __name__ == '__main__': + +# ------------------------------------------------------------------------------ +if __name__ == "__main__": unittest.main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/test_palo_alto_networks_ngfw_mgmt_firewalls_operations_async_test.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/test_palo_alto_networks_ngfw_mgmt_firewalls_operations_async_test.py new file mode 100644 index 000000000000..acbb6e502189 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/test_palo_alto_networks_ngfw_mgmt_firewalls_operations_async_test.py @@ -0,0 +1,36 @@ +# 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.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestPaloAltoNetworksNgfwMgmtFirewallsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_firewalls_list_by_resource_group(self, resource_group): + response = self.client.firewalls.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + assert result == [] + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_firewalls_list_by_subscription(self, resource_group): + response = self.client.firewalls.list_by_subscription() + result = [r async for r in response] + assert response diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/test_palo_alto_networks_ngfw_mgmt_firewalls_operations_test.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/test_palo_alto_networks_ngfw_mgmt_firewalls_operations_test.py new file mode 100644 index 000000000000..83d401cfa05a --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/test_palo_alto_networks_ngfw_mgmt_firewalls_operations_test.py @@ -0,0 +1,35 @@ +# 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.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestPaloAltoNetworksNgfwMgmtFirewallsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_firewalls_list_by_resource_group(self, resource_group): + response = self.client.firewalls.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + assert result == [] + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_firewalls_list_by_subscription(self, resource_group): + response = self.client.firewalls.list_by_subscription() + result = [r for r in response] + assert response diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/test_palo_alto_networks_ngfw_mgmt_local_rulestacks_operations_async_test.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/test_palo_alto_networks_ngfw_mgmt_local_rulestacks_operations_async_test.py new file mode 100644 index 000000000000..423ba9c26726 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/test_palo_alto_networks_ngfw_mgmt_local_rulestacks_operations_async_test.py @@ -0,0 +1,36 @@ +# 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.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestPaloAltoNetworksNgfwMgmtLocalRulestacksOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rulestacks_list_by_resource_group(self, resource_group): + response = self.client.local_rulestacks.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + assert result == [] + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rulestacks_list_by_subscription(self, resource_group): + response = self.client.local_rulestacks.list_by_subscription() + result = [r async for r in response] + assert response diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/test_palo_alto_networks_ngfw_mgmt_local_rulestacks_operations_test.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/test_palo_alto_networks_ngfw_mgmt_local_rulestacks_operations_test.py new file mode 100644 index 000000000000..de6b6466b65e --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/test_palo_alto_networks_ngfw_mgmt_local_rulestacks_operations_test.py @@ -0,0 +1,35 @@ +# 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.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestPaloAltoNetworksNgfwMgmtLocalRulestacksOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rulestacks_list_by_resource_group(self, resource_group): + response = self.client.local_rulestacks.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + assert result == [] + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rulestacks_list_by_subscription(self, resource_group): + response = self.client.local_rulestacks.list_by_subscription() + result = [r for r in response] + assert response diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/test_palo_alto_networks_ngfw_mgmt_operations_async_test.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/test_palo_alto_networks_ngfw_mgmt_operations_async_test.py new file mode 100644 index 000000000000..b12d8d36c48e --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/test_palo_alto_networks_ngfw_mgmt_operations_async_test.py @@ -0,0 +1,27 @@ +# 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.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestPaloAltoNetworksNgfwMgmtOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_operations_list(self, resource_group): + response = self.client.operations.list() + result = [r async for r in response] + assert result diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/test_palo_alto_networks_ngfw_mgmt_operations_test.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/test_palo_alto_networks_ngfw_mgmt_operations_test.py new file mode 100644 index 000000000000..b79c4de9c360 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/test_palo_alto_networks_ngfw_mgmt_operations_test.py @@ -0,0 +1,26 @@ +# 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.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestPaloAltoNetworksNgfwMgmtOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_operations_list(self, resource_group): + response = self.client.operations.list() + result = [r for r in response] + assert result