diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/CHANGELOG.md b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/CHANGELOG.md index 71eda08204a9..5df5248f03b7 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/CHANGELOG.md +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/CHANGELOG.md @@ -1,5 +1,201 @@ # Release History +## 2.0.0 (2025-10-29) + +### Features Added + + - Model `PaloAltoNetworksNgfwMgmtClient` added parameter `cloud_setting` in method `__init__` + - Client `PaloAltoNetworksNgfwMgmtClient` added method `send_request` + - Client `PaloAltoNetworksNgfwMgmtClient` added operation group `metrics_object_firewall` + - Client `PaloAltoNetworksNgfwMgmtClient` added operation group `palo_alto_networks_cloudngfw_operations` + - Model `CertificateObjectGlobalRulestackResource` added property `properties` + - Model `CertificateObjectLocalRulestackResource` added property `properties` + - Model `FirewallResource` added property `properties` + - Model `FirewallResourceUpdateProperties` added property `is_strata_cloud_managed` + - Model `FirewallResourceUpdateProperties` added property `strata_cloud_manager_config` + - Model `FirewallStatusResource` added property `properties` + - Model `FqdnListGlobalRulestackResource` added property `properties` + - Model `FqdnListLocalRulestackResource` added property `properties` + - Model `GlobalRulestackResource` added property `properties` + - Model `LocalRulesResource` added property `properties` + - Model `LocalRulestackResource` added property `properties` + - Model `NetworkProfile` added property `trusted_ranges` + - Model `NetworkProfile` added property `private_source_nat_rules_destination` + - Model `PostRulesResource` added property `properties` + - Model `PreRulesResource` added property `properties` + - Model `PrefixListGlobalRulestackResource` added property `properties` + - Model `PrefixListResource` added property `properties` + - Added model `CertificateObject` + - Added model `CloudManagerTenantList` + - Added enum `EnableStatus` + - Added model `FirewallDeploymentProperties` + - Added model `FirewallStatusProperty` + - Added model `FqdnObject` + - Added model `MetricsObject` + - Added model `MetricsObjectFirewallResource` + - Added model `PrefixObject` + - Added model `ProductSerialNumberRequestStatus` + - Added model `ProductSerialNumberStatus` + - Added enum `ProductSerialStatusValues` + - Added enum `RegistrationStatus` + - Added model `RuleEntry` + - Added model `RulestackProperties` + - Added model `StrataCloudManagerConfig` + - Added model `StrataCloudManagerInfo` + - Added model `SupportInfoModel` + - Added model `MetricsObjectFirewallOperations` + - Added model `PaloAltoNetworksCloudngfwOperationsOperations` + +### Breaking Changes + + - Method `LocalRulestacksOperations.list_app_ids` changed from `asynchronous` to `synchronous` + - Method `LocalRulestacksOperations.list_countries` changed from `asynchronous` to `synchronous` + - Method `LocalRulestacksOperations.list_predefined_url_categories` changed from `asynchronous` to `synchronous` + - Model `CertificateObjectGlobalRulestackResource` deleted or renamed its instance variable `certificate_signer_resource_id` + - Model `CertificateObjectGlobalRulestackResource` deleted or renamed its instance variable `certificate_self_signed` + - Model `CertificateObjectGlobalRulestackResource` deleted or renamed its instance variable `audit_comment` + - Model `CertificateObjectGlobalRulestackResource` deleted or renamed its instance variable `description` + - Model `CertificateObjectGlobalRulestackResource` deleted or renamed its instance variable `etag` + - Model `CertificateObjectGlobalRulestackResource` deleted or renamed its instance variable `provisioning_state` + - Model `CertificateObjectLocalRulestackResource` deleted or renamed its instance variable `certificate_signer_resource_id` + - Model `CertificateObjectLocalRulestackResource` deleted or renamed its instance variable `certificate_self_signed` + - Model `CertificateObjectLocalRulestackResource` deleted or renamed its instance variable `audit_comment` + - Model `CertificateObjectLocalRulestackResource` deleted or renamed its instance variable `description` + - Model `CertificateObjectLocalRulestackResource` deleted or renamed its instance variable `etag` + - Model `CertificateObjectLocalRulestackResource` deleted or renamed its instance variable `provisioning_state` + - Model `FirewallResource` deleted or renamed its instance variable `pan_etag` + - Model `FirewallResource` deleted or renamed its instance variable `network_profile` + - Model `FirewallResource` deleted or renamed its instance variable `is_panorama_managed` + - Model `FirewallResource` deleted or renamed its instance variable `panorama_config` + - Model `FirewallResource` deleted or renamed its instance variable `associated_rulestack` + - Model `FirewallResource` deleted or renamed its instance variable `dns_settings` + - Model `FirewallResource` deleted or renamed its instance variable `front_end_settings` + - Model `FirewallResource` deleted or renamed its instance variable `provisioning_state` + - Model `FirewallResource` deleted or renamed its instance variable `plan_data` + - Model `FirewallResource` deleted or renamed its instance variable `marketplace_details` + - Model `FirewallStatusResource` deleted or renamed its instance variable `is_panorama_managed` + - Model `FirewallStatusResource` deleted or renamed its instance variable `health_status` + - Model `FirewallStatusResource` deleted or renamed its instance variable `health_reason` + - Model `FirewallStatusResource` deleted or renamed its instance variable `panorama_status` + - Model `FirewallStatusResource` deleted or renamed its instance variable `provisioning_state` + - Model `FqdnListGlobalRulestackResource` deleted or renamed its instance variable `description` + - Model `FqdnListGlobalRulestackResource` deleted or renamed its instance variable `fqdn_list` + - Model `FqdnListGlobalRulestackResource` deleted or renamed its instance variable `etag` + - Model `FqdnListGlobalRulestackResource` deleted or renamed its instance variable `audit_comment` + - Model `FqdnListGlobalRulestackResource` deleted or renamed its instance variable `provisioning_state` + - Model `FqdnListLocalRulestackResource` deleted or renamed its instance variable `description` + - Model `FqdnListLocalRulestackResource` deleted or renamed its instance variable `fqdn_list` + - Model `FqdnListLocalRulestackResource` deleted or renamed its instance variable `etag` + - Model `FqdnListLocalRulestackResource` deleted or renamed its instance variable `audit_comment` + - Model `FqdnListLocalRulestackResource` deleted or renamed its instance variable `provisioning_state` + - Model `GlobalRulestackResource` deleted or renamed its instance variable `pan_etag` + - Model `GlobalRulestackResource` deleted or renamed its instance variable `pan_location` + - Model `GlobalRulestackResource` deleted or renamed its instance variable `scope` + - Model `GlobalRulestackResource` deleted or renamed its instance variable `associated_subscriptions` + - Model `GlobalRulestackResource` deleted or renamed its instance variable `description` + - Model `GlobalRulestackResource` deleted or renamed its instance variable `default_mode` + - Model `GlobalRulestackResource` deleted or renamed its instance variable `min_app_id_version` + - Model `GlobalRulestackResource` deleted or renamed its instance variable `provisioning_state` + - Model `GlobalRulestackResource` deleted or renamed its instance variable `security_services` + - Model `LocalRulesResource` deleted or renamed its instance variable `etag` + - Model `LocalRulesResource` deleted or renamed its instance variable `rule_name` + - Model `LocalRulesResource` deleted or renamed its instance variable `priority` + - Model `LocalRulesResource` deleted or renamed its instance variable `description` + - Model `LocalRulesResource` deleted or renamed its instance variable `rule_state` + - Model `LocalRulesResource` deleted or renamed its instance variable `source` + - Model `LocalRulesResource` deleted or renamed its instance variable `negate_source` + - Model `LocalRulesResource` deleted or renamed its instance variable `destination` + - Model `LocalRulesResource` deleted or renamed its instance variable `negate_destination` + - Model `LocalRulesResource` deleted or renamed its instance variable `applications` + - Model `LocalRulesResource` deleted or renamed its instance variable `category` + - Model `LocalRulesResource` deleted or renamed its instance variable `protocol` + - Model `LocalRulesResource` deleted or renamed its instance variable `protocol_port_list` + - Model `LocalRulesResource` deleted or renamed its instance variable `inbound_inspection_certificate` + - Model `LocalRulesResource` deleted or renamed its instance variable `audit_comment` + - Model `LocalRulesResource` deleted or renamed its instance variable `action_type` + - Model `LocalRulesResource` deleted or renamed its instance variable `enable_logging` + - Model `LocalRulesResource` deleted or renamed its instance variable `decryption_rule_type` + - Model `LocalRulesResource` deleted or renamed its instance variable `tags` + - Model `LocalRulesResource` deleted or renamed its instance variable `provisioning_state` + - Model `LocalRulestackResource` deleted or renamed its instance variable `pan_etag` + - Model `LocalRulestackResource` deleted or renamed its instance variable `pan_location` + - Model `LocalRulestackResource` deleted or renamed its instance variable `scope` + - Model `LocalRulestackResource` deleted or renamed its instance variable `associated_subscriptions` + - Model `LocalRulestackResource` deleted or renamed its instance variable `description` + - Model `LocalRulestackResource` deleted or renamed its instance variable `default_mode` + - Model `LocalRulestackResource` deleted or renamed its instance variable `min_app_id_version` + - Model `LocalRulestackResource` deleted or renamed its instance variable `provisioning_state` + - Model `LocalRulestackResource` deleted or renamed its instance variable `security_services` + - Model `PostRulesResource` deleted or renamed its instance variable `etag` + - Model `PostRulesResource` deleted or renamed its instance variable `rule_name` + - Model `PostRulesResource` deleted or renamed its instance variable `priority` + - Model `PostRulesResource` deleted or renamed its instance variable `description` + - Model `PostRulesResource` deleted or renamed its instance variable `rule_state` + - Model `PostRulesResource` deleted or renamed its instance variable `source` + - Model `PostRulesResource` deleted or renamed its instance variable `negate_source` + - Model `PostRulesResource` deleted or renamed its instance variable `destination` + - Model `PostRulesResource` deleted or renamed its instance variable `negate_destination` + - Model `PostRulesResource` deleted or renamed its instance variable `applications` + - Model `PostRulesResource` deleted or renamed its instance variable `category` + - Model `PostRulesResource` deleted or renamed its instance variable `protocol` + - Model `PostRulesResource` deleted or renamed its instance variable `protocol_port_list` + - Model `PostRulesResource` deleted or renamed its instance variable `inbound_inspection_certificate` + - Model `PostRulesResource` deleted or renamed its instance variable `audit_comment` + - Model `PostRulesResource` deleted or renamed its instance variable `action_type` + - Model `PostRulesResource` deleted or renamed its instance variable `enable_logging` + - Model `PostRulesResource` deleted or renamed its instance variable `decryption_rule_type` + - Model `PostRulesResource` deleted or renamed its instance variable `tags` + - Model `PostRulesResource` deleted or renamed its instance variable `provisioning_state` + - Model `PreRulesResource` deleted or renamed its instance variable `etag` + - Model `PreRulesResource` deleted or renamed its instance variable `rule_name` + - Model `PreRulesResource` deleted or renamed its instance variable `priority` + - Model `PreRulesResource` deleted or renamed its instance variable `description` + - Model `PreRulesResource` deleted or renamed its instance variable `rule_state` + - Model `PreRulesResource` deleted or renamed its instance variable `source` + - Model `PreRulesResource` deleted or renamed its instance variable `negate_source` + - Model `PreRulesResource` deleted or renamed its instance variable `destination` + - Model `PreRulesResource` deleted or renamed its instance variable `negate_destination` + - Model `PreRulesResource` deleted or renamed its instance variable `applications` + - Model `PreRulesResource` deleted or renamed its instance variable `category` + - Model `PreRulesResource` deleted or renamed its instance variable `protocol` + - Model `PreRulesResource` deleted or renamed its instance variable `protocol_port_list` + - Model `PreRulesResource` deleted or renamed its instance variable `inbound_inspection_certificate` + - Model `PreRulesResource` deleted or renamed its instance variable `audit_comment` + - Model `PreRulesResource` deleted or renamed its instance variable `action_type` + - Model `PreRulesResource` deleted or renamed its instance variable `enable_logging` + - Model `PreRulesResource` deleted or renamed its instance variable `decryption_rule_type` + - Model `PreRulesResource` deleted or renamed its instance variable `tags` + - Model `PreRulesResource` deleted or renamed its instance variable `provisioning_state` + - Model `PrefixListGlobalRulestackResource` deleted or renamed its instance variable `description` + - Model `PrefixListGlobalRulestackResource` deleted or renamed its instance variable `prefix_list` + - Model `PrefixListGlobalRulestackResource` deleted or renamed its instance variable `etag` + - Model `PrefixListGlobalRulestackResource` deleted or renamed its instance variable `audit_comment` + - Model `PrefixListGlobalRulestackResource` deleted or renamed its instance variable `provisioning_state` + - Model `PrefixListResource` deleted or renamed its instance variable `description` + - Model `PrefixListResource` deleted or renamed its instance variable `prefix_list` + - Model `PrefixListResource` deleted or renamed its instance variable `etag` + - Model `PrefixListResource` deleted or renamed its instance variable `audit_comment` + - Model `PrefixListResource` deleted or renamed its instance variable `provisioning_state` + - Method `FirewallsOperations.get_support_info` changed its parameter `email` from `positional_or_keyword` to `keyword_only` + - Method `GlobalRulestackOperations.list_advanced_security_objects` changed its parameter `type` from `positional_or_keyword` to `keyword_only` + - Method `GlobalRulestackOperations.list_app_ids` changed its parameter `app_id_version` from `positional_or_keyword` to `keyword_only` + - Method `GlobalRulestackOperations.list_app_ids` changed its parameter `app_prefix` from `positional_or_keyword` to `keyword_only` + - Method `GlobalRulestackOperations.list_security_services` changed its parameter `type` from `positional_or_keyword` to `keyword_only` + - Method `LocalRulesOperations.get_counters` changed its parameter `firewall_name` from `positional_or_keyword` to `keyword_only` + - Method `LocalRulesOperations.refresh_counters` changed its parameter `firewall_name` from `positional_or_keyword` to `keyword_only` + - Method `LocalRulesOperations.reset_counters` changed its parameter `firewall_name` from `positional_or_keyword` to `keyword_only` + - Method `LocalRulestacksOperations.get_support_info` changed its parameter `email` from `positional_or_keyword` to `keyword_only` + - Method `LocalRulestacksOperations.list_advanced_security_objects` changed its parameter `type` from `positional_or_keyword` to `keyword_only` + - Method `LocalRulestacksOperations.list_app_ids` changed its parameter `app_id_version` from `positional_or_keyword` to `keyword_only` + - Method `LocalRulestacksOperations.list_app_ids` changed its parameter `app_prefix` from `positional_or_keyword` to `keyword_only` + - Method `LocalRulestacksOperations.list_security_services` changed its parameter `type` from `positional_or_keyword` to `keyword_only` + - Method `PostRulesOperations.get_counters` changed its parameter `firewall_name` from `positional_or_keyword` to `keyword_only` + - Method `PostRulesOperations.refresh_counters` changed its parameter `firewall_name` from `positional_or_keyword` to `keyword_only` + - Method `PostRulesOperations.reset_counters` changed its parameter `firewall_name` from `positional_or_keyword` to `keyword_only` + - Method `PreRulesOperations.get_counters` changed its parameter `firewall_name` from `positional_or_keyword` to `keyword_only` + - Method `PreRulesOperations.refresh_counters` changed its parameter `firewall_name` from `positional_or_keyword` to `keyword_only` + - Method `PreRulesOperations.reset_counters` changed its parameter `firewall_name` from `positional_or_keyword` to `keyword_only` + ## 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..4ace3fc7567b --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/_metadata.json @@ -0,0 +1,7 @@ +{ + "apiVersion": "2025-10-08", + "commit": "bef8b5a67ca1bd7320fd44d0f8e95dc4bae3f6ae", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "typespec_src": "specification/paloaltonetworks/PaloAltoNetworks.Management", + "emitterVersion": "0.52.2" +} \ 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..286d87358da9 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/apiview-properties.json @@ -0,0 +1,313 @@ +{ + "CrossLanguagePackageId": "PaloAltoNetworks.Cloudngfw", + "CrossLanguageDefinitionId": { + "azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectListResponse": "PaloAltoNetworks.Cloudngfw.AdvSecurityObjectListResponse", + "azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectModel": "PaloAltoNetworks.Cloudngfw.AdvSecurityObjectModel", + "azure.mgmt.paloaltonetworksngfw.models.ApplicationInsights": "PaloAltoNetworks.Cloudngfw.ApplicationInsights", + "azure.mgmt.paloaltonetworksngfw.models.AppSeenData": "PaloAltoNetworks.Cloudngfw.AppSeenData", + "azure.mgmt.paloaltonetworksngfw.models.AppSeenInfo": "PaloAltoNetworks.Cloudngfw.AppSeenInfo", + "azure.mgmt.paloaltonetworksngfw.models.AzureResourceManagerManagedIdentityProperties": "PaloAltoNetworks.Cloudngfw.AzureResourceManagerManagedIdentityProperties", + "azure.mgmt.paloaltonetworksngfw.models.AzureResourceManagerUserAssignedIdentity": "PaloAltoNetworks.Cloudngfw.AzureResourceManagerUserAssignedIdentity", + "azure.mgmt.paloaltonetworksngfw.models.Category": "PaloAltoNetworks.Cloudngfw.Category", + "azure.mgmt.paloaltonetworksngfw.models.CertificateObject": "PaloAltoNetworks.Cloudngfw.CertificateObject", + "azure.mgmt.paloaltonetworksngfw.models.Resource": "Azure.ResourceManager.CommonTypes.Resource", + "azure.mgmt.paloaltonetworksngfw.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource", + "azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource": "PaloAltoNetworks.Cloudngfw.CertificateObjectGlobalRulestackResource", + "azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource": "PaloAltoNetworks.Cloudngfw.CertificateObjectLocalRulestackResource", + "azure.mgmt.paloaltonetworksngfw.models.Changelog": "PaloAltoNetworks.Cloudngfw.Changelog", + "azure.mgmt.paloaltonetworksngfw.models.CloudManagerTenantList": "PaloAltoNetworks.Cloudngfw.CloudManagerTenantList", + "azure.mgmt.paloaltonetworksngfw.models.CountriesResponse": "PaloAltoNetworks.Cloudngfw.CountriesResponse", + "azure.mgmt.paloaltonetworksngfw.models.Country": "PaloAltoNetworks.Cloudngfw.Country", + "azure.mgmt.paloaltonetworksngfw.models.DestinationAddr": "PaloAltoNetworks.Cloudngfw.DestinationAddr", + "azure.mgmt.paloaltonetworksngfw.models.DNSSettings": "PaloAltoNetworks.Cloudngfw.DNSSettings", + "azure.mgmt.paloaltonetworksngfw.models.EndpointConfiguration": "PaloAltoNetworks.Cloudngfw.EndpointConfiguration", + "azure.mgmt.paloaltonetworksngfw.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "azure.mgmt.paloaltonetworksngfw.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "azure.mgmt.paloaltonetworksngfw.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "azure.mgmt.paloaltonetworksngfw.models.EventHub": "PaloAltoNetworks.Cloudngfw.EventHub", + "azure.mgmt.paloaltonetworksngfw.models.FirewallDeploymentProperties": "PaloAltoNetworks.Cloudngfw.FirewallDeploymentProperties", + "azure.mgmt.paloaltonetworksngfw.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource", + "azure.mgmt.paloaltonetworksngfw.models.FirewallResource": "PaloAltoNetworks.Cloudngfw.FirewallResource", + "azure.mgmt.paloaltonetworksngfw.models.FirewallResourceUpdate": "PaloAltoNetworks.Cloudngfw.FirewallResourceUpdate", + "azure.mgmt.paloaltonetworksngfw.models.FirewallResourceUpdateProperties": "PaloAltoNetworks.Cloudngfw.FirewallResourceUpdateProperties", + "azure.mgmt.paloaltonetworksngfw.models.FirewallStatusProperty": "PaloAltoNetworks.Cloudngfw.FirewallStatusProperty", + "azure.mgmt.paloaltonetworksngfw.models.FirewallStatusResource": "PaloAltoNetworks.Cloudngfw.FirewallStatusResource", + "azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource": "PaloAltoNetworks.Cloudngfw.FqdnListGlobalRulestackResource", + "azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource": "PaloAltoNetworks.Cloudngfw.FqdnListLocalRulestackResource", + "azure.mgmt.paloaltonetworksngfw.models.FqdnObject": "PaloAltoNetworks.Cloudngfw.FqdnObject", + "azure.mgmt.paloaltonetworksngfw.models.FrontendSetting": "PaloAltoNetworks.Cloudngfw.FrontendSetting", + "azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackInfo": "PaloAltoNetworks.Cloudngfw.GlobalRulestackInfo", + "azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResource", + "azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResourceUpdate": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResourceUpdate", + "azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResourceUpdateProperties": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResourceUpdateProperties", + "azure.mgmt.paloaltonetworksngfw.models.IPAddress": "PaloAltoNetworks.Cloudngfw.IPAddress", + "azure.mgmt.paloaltonetworksngfw.models.IPAddressSpace": "PaloAltoNetworks.Cloudngfw.IPAddressSpace", + "azure.mgmt.paloaltonetworksngfw.models.ListAppIdResponse": "PaloAltoNetworks.Cloudngfw.ListAppIdResponse", + "azure.mgmt.paloaltonetworksngfw.models.ListFirewallsResponse": "PaloAltoNetworks.Cloudngfw.ListFirewallsResponse", + "azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource": "PaloAltoNetworks.Cloudngfw.LocalRulesResource", + "azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource": "PaloAltoNetworks.Cloudngfw.LocalRulestackResource", + "azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResourceUpdate": "PaloAltoNetworks.Cloudngfw.LocalRulestackResourceUpdate", + "azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResourceUpdateProperties": "PaloAltoNetworks.Cloudngfw.LocalRulestackResourceUpdateProperties", + "azure.mgmt.paloaltonetworksngfw.models.LogDestination": "PaloAltoNetworks.Cloudngfw.LogDestination", + "azure.mgmt.paloaltonetworksngfw.models.LogSettings": "PaloAltoNetworks.Cloudngfw.LogSettings", + "azure.mgmt.paloaltonetworksngfw.models.MarketplaceDetails": "PaloAltoNetworks.Cloudngfw.MarketplaceDetails", + "azure.mgmt.paloaltonetworksngfw.models.MetricsObject": "PaloAltoNetworks.Cloudngfw.MetricsObject", + "azure.mgmt.paloaltonetworksngfw.models.MetricsObjectFirewallResource": "PaloAltoNetworks.Cloudngfw.MetricsObjectFirewallResource", + "azure.mgmt.paloaltonetworksngfw.models.MonitorLog": "PaloAltoNetworks.Cloudngfw.MonitorLog", + "azure.mgmt.paloaltonetworksngfw.models.NameDescriptionObject": "PaloAltoNetworks.Cloudngfw.NameDescriptionObject", + "azure.mgmt.paloaltonetworksngfw.models.NetworkProfile": "PaloAltoNetworks.Cloudngfw.NetworkProfile", + "azure.mgmt.paloaltonetworksngfw.models.Operation": "Azure.ResourceManager.CommonTypes.Operation", + "azure.mgmt.paloaltonetworksngfw.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "azure.mgmt.paloaltonetworksngfw.models.PanoramaConfig": "PaloAltoNetworks.Cloudngfw.PanoramaConfig", + "azure.mgmt.paloaltonetworksngfw.models.PanoramaStatus": "PaloAltoNetworks.Cloudngfw.PanoramaStatus", + "azure.mgmt.paloaltonetworksngfw.models.PlanData": "PaloAltoNetworks.Cloudngfw.PlanData", + "azure.mgmt.paloaltonetworksngfw.models.PostRulesResource": "PaloAltoNetworks.Cloudngfw.PostRulesResource", + "azure.mgmt.paloaltonetworksngfw.models.PredefinedUrlCategoriesResponse": "PaloAltoNetworks.Cloudngfw.PredefinedUrlCategoriesResponse", + "azure.mgmt.paloaltonetworksngfw.models.PredefinedUrlCategory": "PaloAltoNetworks.Cloudngfw.PredefinedUrlCategory", + "azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource": "PaloAltoNetworks.Cloudngfw.PrefixListGlobalRulestackResource", + "azure.mgmt.paloaltonetworksngfw.models.PrefixListResource": "PaloAltoNetworks.Cloudngfw.PrefixListResource", + "azure.mgmt.paloaltonetworksngfw.models.PrefixObject": "PaloAltoNetworks.Cloudngfw.PrefixObject", + "azure.mgmt.paloaltonetworksngfw.models.PreRulesResource": "PaloAltoNetworks.Cloudngfw.PreRulesResource", + "azure.mgmt.paloaltonetworksngfw.models.ProductSerialNumberRequestStatus": "PaloAltoNetworks.Cloudngfw.ProductSerialNumberRequestStatus", + "azure.mgmt.paloaltonetworksngfw.models.ProductSerialNumberStatus": "PaloAltoNetworks.Cloudngfw.ProductSerialNumberStatus", + "azure.mgmt.paloaltonetworksngfw.models.RuleCounter": "PaloAltoNetworks.Cloudngfw.RuleCounter", + "azure.mgmt.paloaltonetworksngfw.models.RuleCounterReset": "PaloAltoNetworks.Cloudngfw.RuleCounterReset", + "azure.mgmt.paloaltonetworksngfw.models.RuleEntry": "PaloAltoNetworks.Cloudngfw.RuleEntry", + "azure.mgmt.paloaltonetworksngfw.models.RulestackDetails": "PaloAltoNetworks.Cloudngfw.RulestackDetails", + "azure.mgmt.paloaltonetworksngfw.models.RulestackProperties": "PaloAltoNetworks.Cloudngfw.RulestackProperties", + "azure.mgmt.paloaltonetworksngfw.models.SecurityServices": "PaloAltoNetworks.Cloudngfw.SecurityServices", + "azure.mgmt.paloaltonetworksngfw.models.SecurityServicesResponse": "PaloAltoNetworks.Cloudngfw.SecurityServicesResponse", + "azure.mgmt.paloaltonetworksngfw.models.SecurityServicesTypeList": "PaloAltoNetworks.Cloudngfw.SecurityServicesTypeList", + "azure.mgmt.paloaltonetworksngfw.models.SourceAddr": "PaloAltoNetworks.Cloudngfw.SourceAddr", + "azure.mgmt.paloaltonetworksngfw.models.StorageAccount": "PaloAltoNetworks.Cloudngfw.StorageAccount", + "azure.mgmt.paloaltonetworksngfw.models.StrataCloudManagerConfig": "PaloAltoNetworks.Cloudngfw.StrataCloudManagerConfig", + "azure.mgmt.paloaltonetworksngfw.models.StrataCloudManagerInfo": "PaloAltoNetworks.Cloudngfw.StrataCloudManagerInfo", + "azure.mgmt.paloaltonetworksngfw.models.SupportInfo": "PaloAltoNetworks.Cloudngfw.SupportInfo", + "azure.mgmt.paloaltonetworksngfw.models.SupportInfoModel": "PaloAltoNetworks.Cloudngfw.SupportInfoModel", + "azure.mgmt.paloaltonetworksngfw.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData", + "azure.mgmt.paloaltonetworksngfw.models.TagInfo": "PaloAltoNetworks.Cloudngfw.TagInfo", + "azure.mgmt.paloaltonetworksngfw.models.VnetConfiguration": "PaloAltoNetworks.Cloudngfw.VnetConfiguration", + "azure.mgmt.paloaltonetworksngfw.models.VwanConfiguration": "PaloAltoNetworks.Cloudngfw.VwanConfiguration", + "azure.mgmt.paloaltonetworksngfw.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", + "azure.mgmt.paloaltonetworksngfw.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", + "azure.mgmt.paloaltonetworksngfw.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", + "azure.mgmt.paloaltonetworksngfw.models.ScopeType": "PaloAltoNetworks.Cloudngfw.ScopeType", + "azure.mgmt.paloaltonetworksngfw.models.DefaultMode": "PaloAltoNetworks.Cloudngfw.DefaultMode", + "azure.mgmt.paloaltonetworksngfw.models.ProvisioningState": "PaloAltoNetworks.Cloudngfw.ProvisioningState", + "azure.mgmt.paloaltonetworksngfw.models.ManagedIdentityType": "PaloAltoNetworks.Cloudngfw.ManagedIdentityType", + "azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectTypeEnum": "PaloAltoNetworks.Cloudngfw.AdvSecurityObjectTypeEnum", + "azure.mgmt.paloaltonetworksngfw.models.SecurityServicesTypeEnum": "PaloAltoNetworks.Cloudngfw.SecurityServicesTypeEnum", + "azure.mgmt.paloaltonetworksngfw.models.BooleanEnum": "PaloAltoNetworks.Cloudngfw.BooleanEnum", + "azure.mgmt.paloaltonetworksngfw.models.StateEnum": "PaloAltoNetworks.Cloudngfw.StateEnum", + "azure.mgmt.paloaltonetworksngfw.models.ActionEnum": "PaloAltoNetworks.Cloudngfw.ActionEnum", + "azure.mgmt.paloaltonetworksngfw.models.DecryptionRuleTypeEnum": "PaloAltoNetworks.Cloudngfw.DecryptionRuleTypeEnum", + "azure.mgmt.paloaltonetworksngfw.models.NetworkType": "PaloAltoNetworks.Cloudngfw.NetworkType", + "azure.mgmt.paloaltonetworksngfw.models.EgressNat": "PaloAltoNetworks.Cloudngfw.EgressNat", + "azure.mgmt.paloaltonetworksngfw.models.DNSProxy": "PaloAltoNetworks.Cloudngfw.DNSProxy", + "azure.mgmt.paloaltonetworksngfw.models.EnabledDNSType": "PaloAltoNetworks.Cloudngfw.EnabledDNSType", + "azure.mgmt.paloaltonetworksngfw.models.ProtocolType": "PaloAltoNetworks.Cloudngfw.ProtocolType", + "azure.mgmt.paloaltonetworksngfw.models.UsageType": "PaloAltoNetworks.Cloudngfw.UsageType", + "azure.mgmt.paloaltonetworksngfw.models.BillingCycle": "PaloAltoNetworks.Cloudngfw.BillingCycle", + "azure.mgmt.paloaltonetworksngfw.models.MarketplaceSubscriptionStatus": "PaloAltoNetworks.Cloudngfw.MarketplaceSubscriptionStatus", + "azure.mgmt.paloaltonetworksngfw.models.LogType": "PaloAltoNetworks.Cloudngfw.LogType", + "azure.mgmt.paloaltonetworksngfw.models.LogOption": "PaloAltoNetworks.Cloudngfw.LogOption", + "azure.mgmt.paloaltonetworksngfw.models.HealthStatus": "PaloAltoNetworks.Cloudngfw.HealthStatus", + "azure.mgmt.paloaltonetworksngfw.models.ServerStatus": "PaloAltoNetworks.Cloudngfw.ServerStatus", + "azure.mgmt.paloaltonetworksngfw.models.ReadOnlyProvisioningState": "PaloAltoNetworks.Cloudngfw.ReadOnlyProvisioningState", + "azure.mgmt.paloaltonetworksngfw.models.ProductSerialStatusValues": "PaloAltoNetworks.Cloudngfw.ProductSerialStatusValues", + "azure.mgmt.paloaltonetworksngfw.models.RegistrationStatus": "PaloAltoNetworks.Cloudngfw.RegistrationStatus", + "azure.mgmt.paloaltonetworksngfw.models.EnableStatus": "PaloAltoNetworks.Cloudngfw.EnableStatus", + "azure.mgmt.paloaltonetworksngfw.operations.Operations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.paloaltonetworksngfw.aio.operations.Operations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.paloaltonetworksngfw.operations.GlobalRulestackOperations.get": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResources.get", + "azure.mgmt.paloaltonetworksngfw.aio.operations.GlobalRulestackOperations.get": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResources.get", + "azure.mgmt.paloaltonetworksngfw.operations.GlobalRulestackOperations.begin_create_or_update": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResources.createOrUpdate", + "azure.mgmt.paloaltonetworksngfw.aio.operations.GlobalRulestackOperations.begin_create_or_update": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResources.createOrUpdate", + "azure.mgmt.paloaltonetworksngfw.operations.GlobalRulestackOperations.update": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResources.update", + "azure.mgmt.paloaltonetworksngfw.aio.operations.GlobalRulestackOperations.update": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResources.update", + "azure.mgmt.paloaltonetworksngfw.operations.GlobalRulestackOperations.begin_delete": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResources.delete", + "azure.mgmt.paloaltonetworksngfw.aio.operations.GlobalRulestackOperations.begin_delete": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResources.delete", + "azure.mgmt.paloaltonetworksngfw.operations.GlobalRulestackOperations.list": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResources.list", + "azure.mgmt.paloaltonetworksngfw.aio.operations.GlobalRulestackOperations.list": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResources.list", + "azure.mgmt.paloaltonetworksngfw.operations.GlobalRulestackOperations.begin_commit": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResources.commit", + "azure.mgmt.paloaltonetworksngfw.aio.operations.GlobalRulestackOperations.begin_commit": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResources.commit", + "azure.mgmt.paloaltonetworksngfw.operations.GlobalRulestackOperations.get_change_log": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResources.getChangeLog", + "azure.mgmt.paloaltonetworksngfw.aio.operations.GlobalRulestackOperations.get_change_log": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResources.getChangeLog", + "azure.mgmt.paloaltonetworksngfw.operations.GlobalRulestackOperations.list_advanced_security_objects": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResources.listAdvancedSecurityObjects", + "azure.mgmt.paloaltonetworksngfw.aio.operations.GlobalRulestackOperations.list_advanced_security_objects": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResources.listAdvancedSecurityObjects", + "azure.mgmt.paloaltonetworksngfw.operations.GlobalRulestackOperations.list_app_ids": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResources.listAppIds", + "azure.mgmt.paloaltonetworksngfw.aio.operations.GlobalRulestackOperations.list_app_ids": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResources.listAppIds", + "azure.mgmt.paloaltonetworksngfw.operations.GlobalRulestackOperations.list_countries": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResources.listCountries", + "azure.mgmt.paloaltonetworksngfw.aio.operations.GlobalRulestackOperations.list_countries": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResources.listCountries", + "azure.mgmt.paloaltonetworksngfw.operations.GlobalRulestackOperations.list_firewalls": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResources.listFirewalls", + "azure.mgmt.paloaltonetworksngfw.aio.operations.GlobalRulestackOperations.list_firewalls": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResources.listFirewalls", + "azure.mgmt.paloaltonetworksngfw.operations.GlobalRulestackOperations.list_predefined_url_categories": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResources.listPredefinedUrlCategories", + "azure.mgmt.paloaltonetworksngfw.aio.operations.GlobalRulestackOperations.list_predefined_url_categories": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResources.listPredefinedUrlCategories", + "azure.mgmt.paloaltonetworksngfw.operations.GlobalRulestackOperations.list_security_services": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResources.listSecurityServices", + "azure.mgmt.paloaltonetworksngfw.aio.operations.GlobalRulestackOperations.list_security_services": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResources.listSecurityServices", + "azure.mgmt.paloaltonetworksngfw.operations.GlobalRulestackOperations.revert": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResources.revert", + "azure.mgmt.paloaltonetworksngfw.aio.operations.GlobalRulestackOperations.revert": "PaloAltoNetworks.Cloudngfw.GlobalRulestackResources.revert", + "azure.mgmt.paloaltonetworksngfw.operations.CertificateObjectGlobalRulestackOperations.get": "PaloAltoNetworks.Cloudngfw.CertificateObjectGlobalRulestackResources.get", + "azure.mgmt.paloaltonetworksngfw.aio.operations.CertificateObjectGlobalRulestackOperations.get": "PaloAltoNetworks.Cloudngfw.CertificateObjectGlobalRulestackResources.get", + "azure.mgmt.paloaltonetworksngfw.operations.CertificateObjectGlobalRulestackOperations.begin_create_or_update": "PaloAltoNetworks.Cloudngfw.CertificateObjectGlobalRulestackResources.createOrUpdate", + "azure.mgmt.paloaltonetworksngfw.aio.operations.CertificateObjectGlobalRulestackOperations.begin_create_or_update": "PaloAltoNetworks.Cloudngfw.CertificateObjectGlobalRulestackResources.createOrUpdate", + "azure.mgmt.paloaltonetworksngfw.operations.CertificateObjectGlobalRulestackOperations.begin_delete": "PaloAltoNetworks.Cloudngfw.CertificateObjectGlobalRulestackResources.delete", + "azure.mgmt.paloaltonetworksngfw.aio.operations.CertificateObjectGlobalRulestackOperations.begin_delete": "PaloAltoNetworks.Cloudngfw.CertificateObjectGlobalRulestackResources.delete", + "azure.mgmt.paloaltonetworksngfw.operations.CertificateObjectGlobalRulestackOperations.list": "PaloAltoNetworks.Cloudngfw.CertificateObjectGlobalRulestackResources.list", + "azure.mgmt.paloaltonetworksngfw.aio.operations.CertificateObjectGlobalRulestackOperations.list": "PaloAltoNetworks.Cloudngfw.CertificateObjectGlobalRulestackResources.list", + "azure.mgmt.paloaltonetworksngfw.operations.FqdnListGlobalRulestackOperations.get": "PaloAltoNetworks.Cloudngfw.FqdnListGlobalRulestackResources.get", + "azure.mgmt.paloaltonetworksngfw.aio.operations.FqdnListGlobalRulestackOperations.get": "PaloAltoNetworks.Cloudngfw.FqdnListGlobalRulestackResources.get", + "azure.mgmt.paloaltonetworksngfw.operations.FqdnListGlobalRulestackOperations.begin_create_or_update": "PaloAltoNetworks.Cloudngfw.FqdnListGlobalRulestackResources.createOrUpdate", + "azure.mgmt.paloaltonetworksngfw.aio.operations.FqdnListGlobalRulestackOperations.begin_create_or_update": "PaloAltoNetworks.Cloudngfw.FqdnListGlobalRulestackResources.createOrUpdate", + "azure.mgmt.paloaltonetworksngfw.operations.FqdnListGlobalRulestackOperations.begin_delete": "PaloAltoNetworks.Cloudngfw.FqdnListGlobalRulestackResources.delete", + "azure.mgmt.paloaltonetworksngfw.aio.operations.FqdnListGlobalRulestackOperations.begin_delete": "PaloAltoNetworks.Cloudngfw.FqdnListGlobalRulestackResources.delete", + "azure.mgmt.paloaltonetworksngfw.operations.FqdnListGlobalRulestackOperations.list": "PaloAltoNetworks.Cloudngfw.FqdnListGlobalRulestackResources.list", + "azure.mgmt.paloaltonetworksngfw.aio.operations.FqdnListGlobalRulestackOperations.list": "PaloAltoNetworks.Cloudngfw.FqdnListGlobalRulestackResources.list", + "azure.mgmt.paloaltonetworksngfw.operations.PostRulesOperations.get": "PaloAltoNetworks.Cloudngfw.PostRulesResources.get", + "azure.mgmt.paloaltonetworksngfw.aio.operations.PostRulesOperations.get": "PaloAltoNetworks.Cloudngfw.PostRulesResources.get", + "azure.mgmt.paloaltonetworksngfw.operations.PostRulesOperations.begin_create_or_update": "PaloAltoNetworks.Cloudngfw.PostRulesResources.createOrUpdate", + "azure.mgmt.paloaltonetworksngfw.aio.operations.PostRulesOperations.begin_create_or_update": "PaloAltoNetworks.Cloudngfw.PostRulesResources.createOrUpdate", + "azure.mgmt.paloaltonetworksngfw.operations.PostRulesOperations.begin_delete": "PaloAltoNetworks.Cloudngfw.PostRulesResources.delete", + "azure.mgmt.paloaltonetworksngfw.aio.operations.PostRulesOperations.begin_delete": "PaloAltoNetworks.Cloudngfw.PostRulesResources.delete", + "azure.mgmt.paloaltonetworksngfw.operations.PostRulesOperations.list": "PaloAltoNetworks.Cloudngfw.PostRulesResources.list", + "azure.mgmt.paloaltonetworksngfw.aio.operations.PostRulesOperations.list": "PaloAltoNetworks.Cloudngfw.PostRulesResources.list", + "azure.mgmt.paloaltonetworksngfw.operations.PostRulesOperations.get_counters": "PaloAltoNetworks.Cloudngfw.PostRulesResources.getCounters", + "azure.mgmt.paloaltonetworksngfw.aio.operations.PostRulesOperations.get_counters": "PaloAltoNetworks.Cloudngfw.PostRulesResources.getCounters", + "azure.mgmt.paloaltonetworksngfw.operations.PostRulesOperations.refresh_counters": "PaloAltoNetworks.Cloudngfw.PostRulesResources.refreshCounters", + "azure.mgmt.paloaltonetworksngfw.aio.operations.PostRulesOperations.refresh_counters": "PaloAltoNetworks.Cloudngfw.PostRulesResources.refreshCounters", + "azure.mgmt.paloaltonetworksngfw.operations.PostRulesOperations.reset_counters": "PaloAltoNetworks.Cloudngfw.PostRulesResources.resetCounters", + "azure.mgmt.paloaltonetworksngfw.aio.operations.PostRulesOperations.reset_counters": "PaloAltoNetworks.Cloudngfw.PostRulesResources.resetCounters", + "azure.mgmt.paloaltonetworksngfw.operations.PrefixListGlobalRulestackOperations.get": "PaloAltoNetworks.Cloudngfw.PrefixListGlobalRulestackResources.get", + "azure.mgmt.paloaltonetworksngfw.aio.operations.PrefixListGlobalRulestackOperations.get": "PaloAltoNetworks.Cloudngfw.PrefixListGlobalRulestackResources.get", + "azure.mgmt.paloaltonetworksngfw.operations.PrefixListGlobalRulestackOperations.begin_create_or_update": "PaloAltoNetworks.Cloudngfw.PrefixListGlobalRulestackResources.createOrUpdate", + "azure.mgmt.paloaltonetworksngfw.aio.operations.PrefixListGlobalRulestackOperations.begin_create_or_update": "PaloAltoNetworks.Cloudngfw.PrefixListGlobalRulestackResources.createOrUpdate", + "azure.mgmt.paloaltonetworksngfw.operations.PrefixListGlobalRulestackOperations.begin_delete": "PaloAltoNetworks.Cloudngfw.PrefixListGlobalRulestackResources.delete", + "azure.mgmt.paloaltonetworksngfw.aio.operations.PrefixListGlobalRulestackOperations.begin_delete": "PaloAltoNetworks.Cloudngfw.PrefixListGlobalRulestackResources.delete", + "azure.mgmt.paloaltonetworksngfw.operations.PrefixListGlobalRulestackOperations.list": "PaloAltoNetworks.Cloudngfw.PrefixListGlobalRulestackResources.list", + "azure.mgmt.paloaltonetworksngfw.aio.operations.PrefixListGlobalRulestackOperations.list": "PaloAltoNetworks.Cloudngfw.PrefixListGlobalRulestackResources.list", + "azure.mgmt.paloaltonetworksngfw.operations.PreRulesOperations.get": "PaloAltoNetworks.Cloudngfw.PreRulesResources.get", + "azure.mgmt.paloaltonetworksngfw.aio.operations.PreRulesOperations.get": "PaloAltoNetworks.Cloudngfw.PreRulesResources.get", + "azure.mgmt.paloaltonetworksngfw.operations.PreRulesOperations.begin_create_or_update": "PaloAltoNetworks.Cloudngfw.PreRulesResources.createOrUpdate", + "azure.mgmt.paloaltonetworksngfw.aio.operations.PreRulesOperations.begin_create_or_update": "PaloAltoNetworks.Cloudngfw.PreRulesResources.createOrUpdate", + "azure.mgmt.paloaltonetworksngfw.operations.PreRulesOperations.begin_delete": "PaloAltoNetworks.Cloudngfw.PreRulesResources.delete", + "azure.mgmt.paloaltonetworksngfw.aio.operations.PreRulesOperations.begin_delete": "PaloAltoNetworks.Cloudngfw.PreRulesResources.delete", + "azure.mgmt.paloaltonetworksngfw.operations.PreRulesOperations.list": "PaloAltoNetworks.Cloudngfw.PreRulesResources.list", + "azure.mgmt.paloaltonetworksngfw.aio.operations.PreRulesOperations.list": "PaloAltoNetworks.Cloudngfw.PreRulesResources.list", + "azure.mgmt.paloaltonetworksngfw.operations.PreRulesOperations.get_counters": "PaloAltoNetworks.Cloudngfw.PreRulesResources.getCounters", + "azure.mgmt.paloaltonetworksngfw.aio.operations.PreRulesOperations.get_counters": "PaloAltoNetworks.Cloudngfw.PreRulesResources.getCounters", + "azure.mgmt.paloaltonetworksngfw.operations.PreRulesOperations.refresh_counters": "PaloAltoNetworks.Cloudngfw.PreRulesResources.refreshCounters", + "azure.mgmt.paloaltonetworksngfw.aio.operations.PreRulesOperations.refresh_counters": "PaloAltoNetworks.Cloudngfw.PreRulesResources.refreshCounters", + "azure.mgmt.paloaltonetworksngfw.operations.PreRulesOperations.reset_counters": "PaloAltoNetworks.Cloudngfw.PreRulesResources.resetCounters", + "azure.mgmt.paloaltonetworksngfw.aio.operations.PreRulesOperations.reset_counters": "PaloAltoNetworks.Cloudngfw.PreRulesResources.resetCounters", + "azure.mgmt.paloaltonetworksngfw.operations.FirewallsOperations.get": "PaloAltoNetworks.Cloudngfw.FirewallResources.get", + "azure.mgmt.paloaltonetworksngfw.aio.operations.FirewallsOperations.get": "PaloAltoNetworks.Cloudngfw.FirewallResources.get", + "azure.mgmt.paloaltonetworksngfw.operations.FirewallsOperations.begin_create_or_update": "PaloAltoNetworks.Cloudngfw.FirewallResources.createOrUpdate", + "azure.mgmt.paloaltonetworksngfw.aio.operations.FirewallsOperations.begin_create_or_update": "PaloAltoNetworks.Cloudngfw.FirewallResources.createOrUpdate", + "azure.mgmt.paloaltonetworksngfw.operations.FirewallsOperations.update": "PaloAltoNetworks.Cloudngfw.FirewallResources.update", + "azure.mgmt.paloaltonetworksngfw.aio.operations.FirewallsOperations.update": "PaloAltoNetworks.Cloudngfw.FirewallResources.update", + "azure.mgmt.paloaltonetworksngfw.operations.FirewallsOperations.begin_delete": "PaloAltoNetworks.Cloudngfw.FirewallResources.delete", + "azure.mgmt.paloaltonetworksngfw.aio.operations.FirewallsOperations.begin_delete": "PaloAltoNetworks.Cloudngfw.FirewallResources.delete", + "azure.mgmt.paloaltonetworksngfw.operations.FirewallsOperations.list_by_resource_group": "PaloAltoNetworks.Cloudngfw.FirewallResources.listByResourceGroup", + "azure.mgmt.paloaltonetworksngfw.aio.operations.FirewallsOperations.list_by_resource_group": "PaloAltoNetworks.Cloudngfw.FirewallResources.listByResourceGroup", + "azure.mgmt.paloaltonetworksngfw.operations.FirewallsOperations.list_by_subscription": "PaloAltoNetworks.Cloudngfw.FirewallResources.listBySubscription", + "azure.mgmt.paloaltonetworksngfw.aio.operations.FirewallsOperations.list_by_subscription": "PaloAltoNetworks.Cloudngfw.FirewallResources.listBySubscription", + "azure.mgmt.paloaltonetworksngfw.operations.FirewallsOperations.get_global_rulestack": "PaloAltoNetworks.Cloudngfw.FirewallResources.getGlobalRulestack", + "azure.mgmt.paloaltonetworksngfw.aio.operations.FirewallsOperations.get_global_rulestack": "PaloAltoNetworks.Cloudngfw.FirewallResources.getGlobalRulestack", + "azure.mgmt.paloaltonetworksngfw.operations.FirewallsOperations.get_log_profile": "PaloAltoNetworks.Cloudngfw.FirewallResources.getLogProfile", + "azure.mgmt.paloaltonetworksngfw.aio.operations.FirewallsOperations.get_log_profile": "PaloAltoNetworks.Cloudngfw.FirewallResources.getLogProfile", + "azure.mgmt.paloaltonetworksngfw.operations.FirewallsOperations.get_support_info": "PaloAltoNetworks.Cloudngfw.FirewallResources.getSupportInfo", + "azure.mgmt.paloaltonetworksngfw.aio.operations.FirewallsOperations.get_support_info": "PaloAltoNetworks.Cloudngfw.FirewallResources.getSupportInfo", + "azure.mgmt.paloaltonetworksngfw.operations.FirewallsOperations.save_log_profile": "PaloAltoNetworks.Cloudngfw.FirewallResources.saveLogProfile", + "azure.mgmt.paloaltonetworksngfw.aio.operations.FirewallsOperations.save_log_profile": "PaloAltoNetworks.Cloudngfw.FirewallResources.saveLogProfile", + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.get": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.get", + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.get": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.get", + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.begin_create_or_update": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.createOrUpdate", + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.begin_create_or_update": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.createOrUpdate", + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.update": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.update", + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.update": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.update", + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.begin_delete": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.delete", + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.begin_delete": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.delete", + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.list_by_resource_group": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.listByResourceGroup", + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.list_by_resource_group": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.listByResourceGroup", + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.list_by_subscription": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.listBySubscription", + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.list_by_subscription": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.listBySubscription", + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.begin_commit": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.commit", + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.begin_commit": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.commit", + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.get_change_log": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.getChangeLog", + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.get_change_log": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.getChangeLog", + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.get_support_info": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.getSupportInfo", + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.get_support_info": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.getSupportInfo", + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.list_advanced_security_objects": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.listAdvancedSecurityObjects", + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.list_advanced_security_objects": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.listAdvancedSecurityObjects", + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.list_app_ids": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.listAppIds", + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.list_app_ids": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.listAppIds", + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.list_countries": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.listCountries", + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.list_countries": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.listCountries", + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.list_firewalls": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.listFirewalls", + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.list_firewalls": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.listFirewalls", + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.list_predefined_url_categories": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.listPredefinedUrlCategories", + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.list_predefined_url_categories": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.listPredefinedUrlCategories", + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.list_security_services": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.listSecurityServices", + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.list_security_services": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.listSecurityServices", + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulestacksOperations.revert": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.revert", + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulestacksOperations.revert": "PaloAltoNetworks.Cloudngfw.LocalRulestackResources.revert", + "azure.mgmt.paloaltonetworksngfw.operations.MetricsObjectFirewallOperations.get": "PaloAltoNetworks.Cloudngfw.MetricsObjectFirewallResources.get", + "azure.mgmt.paloaltonetworksngfw.aio.operations.MetricsObjectFirewallOperations.get": "PaloAltoNetworks.Cloudngfw.MetricsObjectFirewallResources.get", + "azure.mgmt.paloaltonetworksngfw.operations.MetricsObjectFirewallOperations.begin_create_or_update": "PaloAltoNetworks.Cloudngfw.MetricsObjectFirewallResources.createOrUpdate", + "azure.mgmt.paloaltonetworksngfw.aio.operations.MetricsObjectFirewallOperations.begin_create_or_update": "PaloAltoNetworks.Cloudngfw.MetricsObjectFirewallResources.createOrUpdate", + "azure.mgmt.paloaltonetworksngfw.operations.MetricsObjectFirewallOperations.begin_delete": "PaloAltoNetworks.Cloudngfw.MetricsObjectFirewallResources.delete", + "azure.mgmt.paloaltonetworksngfw.aio.operations.MetricsObjectFirewallOperations.begin_delete": "PaloAltoNetworks.Cloudngfw.MetricsObjectFirewallResources.delete", + "azure.mgmt.paloaltonetworksngfw.operations.MetricsObjectFirewallOperations.list_by_firewalls": "PaloAltoNetworks.Cloudngfw.MetricsObjectFirewallResources.listByFirewalls", + "azure.mgmt.paloaltonetworksngfw.aio.operations.MetricsObjectFirewallOperations.list_by_firewalls": "PaloAltoNetworks.Cloudngfw.MetricsObjectFirewallResources.listByFirewalls", + "azure.mgmt.paloaltonetworksngfw.operations.FirewallStatusOperations.get": "PaloAltoNetworks.Cloudngfw.FirewallStatusResources.get", + "azure.mgmt.paloaltonetworksngfw.aio.operations.FirewallStatusOperations.get": "PaloAltoNetworks.Cloudngfw.FirewallStatusResources.get", + "azure.mgmt.paloaltonetworksngfw.operations.FirewallStatusOperations.list_by_firewalls": "PaloAltoNetworks.Cloudngfw.FirewallStatusResources.listByFirewalls", + "azure.mgmt.paloaltonetworksngfw.aio.operations.FirewallStatusOperations.list_by_firewalls": "PaloAltoNetworks.Cloudngfw.FirewallStatusResources.listByFirewalls", + "azure.mgmt.paloaltonetworksngfw.operations.CertificateObjectLocalRulestackOperations.get": "PaloAltoNetworks.Cloudngfw.CertificateObjectLocalRulestackResources.get", + "azure.mgmt.paloaltonetworksngfw.aio.operations.CertificateObjectLocalRulestackOperations.get": "PaloAltoNetworks.Cloudngfw.CertificateObjectLocalRulestackResources.get", + "azure.mgmt.paloaltonetworksngfw.operations.CertificateObjectLocalRulestackOperations.begin_create_or_update": "PaloAltoNetworks.Cloudngfw.CertificateObjectLocalRulestackResources.createOrUpdate", + "azure.mgmt.paloaltonetworksngfw.aio.operations.CertificateObjectLocalRulestackOperations.begin_create_or_update": "PaloAltoNetworks.Cloudngfw.CertificateObjectLocalRulestackResources.createOrUpdate", + "azure.mgmt.paloaltonetworksngfw.operations.CertificateObjectLocalRulestackOperations.begin_delete": "PaloAltoNetworks.Cloudngfw.CertificateObjectLocalRulestackResources.delete", + "azure.mgmt.paloaltonetworksngfw.aio.operations.CertificateObjectLocalRulestackOperations.begin_delete": "PaloAltoNetworks.Cloudngfw.CertificateObjectLocalRulestackResources.delete", + "azure.mgmt.paloaltonetworksngfw.operations.CertificateObjectLocalRulestackOperations.list_by_local_rulestacks": "PaloAltoNetworks.Cloudngfw.CertificateObjectLocalRulestackResources.listByLocalRulestacks", + "azure.mgmt.paloaltonetworksngfw.aio.operations.CertificateObjectLocalRulestackOperations.list_by_local_rulestacks": "PaloAltoNetworks.Cloudngfw.CertificateObjectLocalRulestackResources.listByLocalRulestacks", + "azure.mgmt.paloaltonetworksngfw.operations.FqdnListLocalRulestackOperations.get": "PaloAltoNetworks.Cloudngfw.FqdnListLocalRulestackResources.get", + "azure.mgmt.paloaltonetworksngfw.aio.operations.FqdnListLocalRulestackOperations.get": "PaloAltoNetworks.Cloudngfw.FqdnListLocalRulestackResources.get", + "azure.mgmt.paloaltonetworksngfw.operations.FqdnListLocalRulestackOperations.begin_create_or_update": "PaloAltoNetworks.Cloudngfw.FqdnListLocalRulestackResources.createOrUpdate", + "azure.mgmt.paloaltonetworksngfw.aio.operations.FqdnListLocalRulestackOperations.begin_create_or_update": "PaloAltoNetworks.Cloudngfw.FqdnListLocalRulestackResources.createOrUpdate", + "azure.mgmt.paloaltonetworksngfw.operations.FqdnListLocalRulestackOperations.begin_delete": "PaloAltoNetworks.Cloudngfw.FqdnListLocalRulestackResources.delete", + "azure.mgmt.paloaltonetworksngfw.aio.operations.FqdnListLocalRulestackOperations.begin_delete": "PaloAltoNetworks.Cloudngfw.FqdnListLocalRulestackResources.delete", + "azure.mgmt.paloaltonetworksngfw.operations.FqdnListLocalRulestackOperations.list_by_local_rulestacks": "PaloAltoNetworks.Cloudngfw.FqdnListLocalRulestackResources.listByLocalRulestacks", + "azure.mgmt.paloaltonetworksngfw.aio.operations.FqdnListLocalRulestackOperations.list_by_local_rulestacks": "PaloAltoNetworks.Cloudngfw.FqdnListLocalRulestackResources.listByLocalRulestacks", + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulesOperations.get": "PaloAltoNetworks.Cloudngfw.LocalRulesResources.get", + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulesOperations.get": "PaloAltoNetworks.Cloudngfw.LocalRulesResources.get", + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulesOperations.begin_create_or_update": "PaloAltoNetworks.Cloudngfw.LocalRulesResources.createOrUpdate", + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulesOperations.begin_create_or_update": "PaloAltoNetworks.Cloudngfw.LocalRulesResources.createOrUpdate", + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulesOperations.begin_delete": "PaloAltoNetworks.Cloudngfw.LocalRulesResources.delete", + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulesOperations.begin_delete": "PaloAltoNetworks.Cloudngfw.LocalRulesResources.delete", + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulesOperations.list_by_local_rulestacks": "PaloAltoNetworks.Cloudngfw.LocalRulesResources.listByLocalRulestacks", + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulesOperations.list_by_local_rulestacks": "PaloAltoNetworks.Cloudngfw.LocalRulesResources.listByLocalRulestacks", + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulesOperations.get_counters": "PaloAltoNetworks.Cloudngfw.LocalRulesResources.getCounters", + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulesOperations.get_counters": "PaloAltoNetworks.Cloudngfw.LocalRulesResources.getCounters", + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulesOperations.refresh_counters": "PaloAltoNetworks.Cloudngfw.LocalRulesResources.refreshCounters", + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulesOperations.refresh_counters": "PaloAltoNetworks.Cloudngfw.LocalRulesResources.refreshCounters", + "azure.mgmt.paloaltonetworksngfw.operations.LocalRulesOperations.reset_counters": "PaloAltoNetworks.Cloudngfw.LocalRulesResources.resetCounters", + "azure.mgmt.paloaltonetworksngfw.aio.operations.LocalRulesOperations.reset_counters": "PaloAltoNetworks.Cloudngfw.LocalRulesResources.resetCounters", + "azure.mgmt.paloaltonetworksngfw.operations.PrefixListLocalRulestackOperations.get": "PaloAltoNetworks.Cloudngfw.PrefixListResources.get", + "azure.mgmt.paloaltonetworksngfw.aio.operations.PrefixListLocalRulestackOperations.get": "PaloAltoNetworks.Cloudngfw.PrefixListResources.get", + "azure.mgmt.paloaltonetworksngfw.operations.PrefixListLocalRulestackOperations.begin_create_or_update": "PaloAltoNetworks.Cloudngfw.PrefixListResources.createOrUpdate", + "azure.mgmt.paloaltonetworksngfw.aio.operations.PrefixListLocalRulestackOperations.begin_create_or_update": "PaloAltoNetworks.Cloudngfw.PrefixListResources.createOrUpdate", + "azure.mgmt.paloaltonetworksngfw.operations.PrefixListLocalRulestackOperations.begin_delete": "PaloAltoNetworks.Cloudngfw.PrefixListResources.delete", + "azure.mgmt.paloaltonetworksngfw.aio.operations.PrefixListLocalRulestackOperations.begin_delete": "PaloAltoNetworks.Cloudngfw.PrefixListResources.delete", + "azure.mgmt.paloaltonetworksngfw.operations.PrefixListLocalRulestackOperations.list_by_local_rulestacks": "PaloAltoNetworks.Cloudngfw.PrefixListResources.listByLocalRulestacks", + "azure.mgmt.paloaltonetworksngfw.aio.operations.PrefixListLocalRulestackOperations.list_by_local_rulestacks": "PaloAltoNetworks.Cloudngfw.PrefixListResources.listByLocalRulestacks", + "azure.mgmt.paloaltonetworksngfw.operations.PaloAltoNetworksCloudngfwOperationsOperations.create_product_serial_number": "PaloAltoNetworks.Cloudngfw.PaloAltoNetworksCloudngfwOperationsOperationGroup.createProductSerialNumber", + "azure.mgmt.paloaltonetworksngfw.aio.operations.PaloAltoNetworksCloudngfwOperationsOperations.create_product_serial_number": "PaloAltoNetworks.Cloudngfw.PaloAltoNetworksCloudngfwOperationsOperationGroup.createProductSerialNumber", + "azure.mgmt.paloaltonetworksngfw.operations.PaloAltoNetworksCloudngfwOperationsOperations.list_cloud_manager_tenants": "PaloAltoNetworks.Cloudngfw.PaloAltoNetworksCloudngfwOperationsOperationGroup.listCloudManagerTenants", + "azure.mgmt.paloaltonetworksngfw.aio.operations.PaloAltoNetworksCloudngfwOperationsOperations.list_cloud_manager_tenants": "PaloAltoNetworks.Cloudngfw.PaloAltoNetworksCloudngfwOperationsOperationGroup.listCloudManagerTenants", + "azure.mgmt.paloaltonetworksngfw.operations.PaloAltoNetworksCloudngfwOperationsOperations.list_product_serial_number_status": "PaloAltoNetworks.Cloudngfw.PaloAltoNetworksCloudngfwOperationsOperationGroup.listProductSerialNumberStatus", + "azure.mgmt.paloaltonetworksngfw.aio.operations.PaloAltoNetworksCloudngfwOperationsOperations.list_product_serial_number_status": "PaloAltoNetworks.Cloudngfw.PaloAltoNetworksCloudngfwOperationsOperationGroup.listProductSerialNumberStatus", + "azure.mgmt.paloaltonetworksngfw.operations.PaloAltoNetworksCloudngfwOperationsOperations.list_support_info": "PaloAltoNetworks.Cloudngfw.PaloAltoNetworksCloudngfwOperationsOperationGroup.listSupportInfo", + "azure.mgmt.paloaltonetworksngfw.aio.operations.PaloAltoNetworksCloudngfwOperationsOperations.list_support_info": "PaloAltoNetworks.Cloudngfw.PaloAltoNetworksCloudngfwOperationsOperationGroup.listSupportInfo" + } +} \ 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..f632324d9b67 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/__init__.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/__init__.py @@ -2,18 +2,24 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -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 ._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/_palo_alto_networks_ngfw_mgmt_client.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_client.py similarity index 63% rename from sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_palo_alto_networks_ngfw_mgmt_client.py rename to sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_client.py index aae495a25e03..c65fd5571242 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/_client.py @@ -2,19 +2,23 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from 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 +29,9 @@ GlobalRulestackOperations, LocalRulesOperations, LocalRulestacksOperations, + MetricsObjectFirewallOperations, Operations, + PaloAltoNetworksCloudngfwOperationsOperations, PostRulesOperations, PreRulesOperations, PrefixListGlobalRulestackOperations, @@ -33,13 +39,15 @@ ) 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 operations: Operations operations + :vartype operations: azure.mgmt.paloaltonetworksngfw.operations.Operations :ivar global_rulestack: GlobalRulestackOperations operations :vartype global_rulestack: azure.mgmt.paloaltonetworksngfw.operations.GlobalRulestackOperations :ivar certificate_object_global_rulestack: CertificateObjectGlobalRulestackOperations @@ -56,12 +64,13 @@ class PaloAltoNetworksNgfwMgmtClient: # pylint: disable=client-accepts-api-vers 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 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 @@ -75,14 +84,21 @@ class PaloAltoNetworksNgfwMgmtClient: # pylint: disable=client-accepts-api-vers :ivar prefix_list_local_rulestack: PrefixListLocalRulestackOperations operations :vartype prefix_list_local_rulestack: azure.mgmt.paloaltonetworksngfw.operations.PrefixListLocalRulestackOperations - :param credential: Credential needed for the client to connect to Azure. Required. + :ivar palo_alto_networks_cloudngfw_operations: PaloAltoNetworksCloudngfwOperationsOperations + operations + :vartype palo_alto_networks_cloudngfw_operations: + azure.mgmt.paloaltonetworksngfw.operations.PaloAltoNetworksCloudngfwOperationsOperations + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service host. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2023-09-01". Note that overriding this - default value may result in unsupported behavior. + :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: The API version to use for this operation. 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 Retry-After header is present. @@ -92,18 +108,50 @@ 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: + _endpoint = "{endpoint}" + _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, + base_url=cast(str, base_url), + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs ) - self._client: ARMPipelineClient = ARMPipelineClient(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) - self._deserialize = Deserializer(client_models) + _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, _endpoint), policies=_policies, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.global_rulestack = GlobalRulestackOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -118,11 +166,13 @@ def __init__( 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.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 @@ -134,14 +184,17 @@ def __init__( self.prefix_list_local_rulestack = PrefixListLocalRulestackOperations( self._client, self._config, self._serialize, self._deserialize ) + self.palo_alto_networks_cloudngfw_operations = PaloAltoNetworksCloudngfwOperationsOperations( + 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 >>> request = HttpRequest("GET", "https://www.example.org/") - >>> response = client._send_request(request) + >>> response = client.send_request(request) For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request @@ -154,13 +207,17 @@ 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) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: 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/_configuration.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_configuration.py index 7e69dd76f260..2d02da66e5eb 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_configuration.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_configuration.py @@ -2,41 +2,51 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from 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 attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-09-01". Note that overriding this - default value may result in unsupported behavior. + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. 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, + base_url: str = "https://management.azure.com", + 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 +55,12 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url + self.cloud_setting = cloud_setting self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) 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 +69,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/_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 50% 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..8026245c2abc 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_vendor.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_utils/__init__.py @@ -1,16 +1,6 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- - -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/_utils/model_base.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_utils/model_base.py new file mode 100644 index 000000000000..12926fa98dcf --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_utils/model_base.py @@ -0,0 +1,1237 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access, broad-except + +import copy +import calendar +import decimal +import functools +import sys +import logging +import base64 +import re +import typing +import enum +import email.utils +from datetime import datetime, date, time, timedelta, timezone +from json import JSONEncoder +import xml.etree.ElementTree as ET +from collections.abc import MutableMapping +from typing_extensions import Self +import isodate +from azure.core.exceptions import DeserializationError +from azure.core import CaseInsensitiveEnumMeta +from azure.core.pipeline import PipelineResponse +from azure.core.serialization import _Null +from azure.core.rest import HttpResponse + +_LOGGER = logging.getLogger(__name__) + +__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] + +TZ_UTC = timezone.utc +_T = typing.TypeVar("_T") + + +def _timedelta_as_isostr(td: timedelta) -> str: + """Converts a datetime.timedelta object into an ISO 8601 formatted string, e.g. 'P4DT12H30M05S' + + Function adapted from the Tin Can Python project: https://github.com/RusticiSoftware/TinCanPython + + :param timedelta td: The timedelta to convert + :rtype: str + :return: ISO8601 version of this timedelta + """ + + # Split seconds to larger units + seconds = td.total_seconds() + minutes, seconds = divmod(seconds, 60) + hours, minutes = divmod(minutes, 60) + days, hours = divmod(hours, 24) + + days, hours, minutes = list(map(int, (days, hours, minutes))) + seconds = round(seconds, 6) + + # Build date + date_str = "" + if days: + date_str = "%sD" % days + + if hours or minutes or seconds: + # Build time + time_str = "T" + + # Hours + bigger_exists = date_str or hours + if bigger_exists: + time_str += "{:02}H".format(hours) + + # Minutes + bigger_exists = bigger_exists or minutes + if bigger_exists: + time_str += "{:02}M".format(minutes) + + # Seconds + try: + if seconds.is_integer(): + seconds_string = "{:02}".format(int(seconds)) + else: + # 9 chars long w/ leading 0, 6 digits after decimal + seconds_string = "%09.6f" % seconds + # Remove trailing zeros + seconds_string = seconds_string.rstrip("0") + except AttributeError: # int.is_integer() raises + seconds_string = "{:02}".format(seconds) + + time_str += "{}S".format(seconds_string) + else: + time_str = "" + + return "P" + date_str + time_str + + +def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: + encoded = base64.b64encode(o).decode() + if format == "base64url": + return encoded.strip("=").replace("+", "-").replace("/", "_") + return encoded + + +def _serialize_datetime(o, format: typing.Optional[str] = None): + if hasattr(o, "year") and hasattr(o, "hour"): + if format == "rfc7231": + return email.utils.format_datetime(o, usegmt=True) + if format == "unix-timestamp": + return int(calendar.timegm(o.utctimetuple())) + + # astimezone() fails for naive times in Python 2.7, so make make sure o is aware (tzinfo is set) + if not o.tzinfo: + iso_formatted = o.replace(tzinfo=TZ_UTC).isoformat() + else: + iso_formatted = o.astimezone(TZ_UTC).isoformat() + # Replace the trailing "+00:00" UTC offset with "Z" (RFC 3339: https://www.ietf.org/rfc/rfc3339.txt) + return iso_formatted.replace("+00:00", "Z") + # Next try datetime.date or datetime.time + return o.isoformat() + + +def _is_readonly(p): + try: + return p._visibility == ["read"] + except AttributeError: + return False + + +class SdkJSONEncoder(JSONEncoder): + """A JSON encoder that's capable of serializing datetime objects and bytes.""" + + def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): + super().__init__(*args, **kwargs) + self.exclude_readonly = exclude_readonly + self.format = format + + def default(self, o): # pylint: disable=too-many-return-statements + if _is_model(o): + if self.exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + return {k: v for k, v in o.items() if k not in readonly_props} + return dict(o.items()) + try: + return super(SdkJSONEncoder, self).default(o) + except TypeError: + if isinstance(o, _Null): + return None + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, self.format) + try: + # First try datetime.datetime + return _serialize_datetime(o, self.format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return super(SdkJSONEncoder, self).default(o) + + +_VALID_DATE = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" + r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") +_VALID_RFC7231 = re.compile( + r"(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s" + r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" +) + + +def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + attr = attr.upper() + match = _VALID_DATE.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + return date_obj + + +def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize RFC7231 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + match = _VALID_RFC7231.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + return email.utils.parsedate_to_datetime(attr) + + +def _deserialize_datetime_unix_timestamp(attr: typing.Union[float, datetime]) -> datetime: + """Deserialize unix timestamp into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + return datetime.fromtimestamp(attr, TZ_UTC) + + +def _deserialize_date(attr: typing.Union[str, date]) -> date: + """Deserialize ISO-8601 formatted string into Date object. + :param str attr: response string to be deserialized. + :rtype: date + :returns: The date object from that input + """ + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + if isinstance(attr, date): + return attr + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) # type: ignore + + +def _deserialize_time(attr: typing.Union[str, time]) -> time: + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :returns: The time object from that input + """ + if isinstance(attr, time): + return attr + return isodate.parse_time(attr) + + +def _deserialize_bytes(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + return bytes(base64.b64decode(attr)) + + +def _deserialize_bytes_base64(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return bytes(base64.b64decode(encoded)) + + +def _deserialize_duration(attr): + if isinstance(attr, timedelta): + return attr + return isodate.parse_duration(attr) + + +def _deserialize_decimal(attr): + if isinstance(attr, decimal.Decimal): + return attr + return decimal.Decimal(str(attr)) + + +def _deserialize_int_as_str(attr): + if isinstance(attr, int): + return attr + return int(attr) + + +_DESERIALIZE_MAPPING = { + datetime: _deserialize_datetime, + date: _deserialize_date, + time: _deserialize_time, + bytes: _deserialize_bytes, + bytearray: _deserialize_bytes, + timedelta: _deserialize_duration, + typing.Any: lambda x: x, + decimal.Decimal: _deserialize_decimal, +} + +_DESERIALIZE_MAPPING_WITHFORMAT = { + "rfc3339": _deserialize_datetime, + "rfc7231": _deserialize_datetime_rfc7231, + "unix-timestamp": _deserialize_datetime_unix_timestamp, + "base64": _deserialize_bytes, + "base64url": _deserialize_bytes_base64, +} + + +def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): + if annotation is int and rf and rf._format == "str": + return _deserialize_int_as_str + if rf and rf._format: + return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) + return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore + + +def _get_type_alias_type(module_name: str, alias_name: str): + types = { + k: v + for k, v in sys.modules[module_name].__dict__.items() + if isinstance(v, typing._GenericAlias) # type: ignore + } + if alias_name not in types: + return alias_name + return types[alias_name] + + +def _get_model(module_name: str, model_name: str): + models = {k: v for k, v in sys.modules[module_name].__dict__.items() if isinstance(v, type)} + module_end = module_name.rsplit(".", 1)[0] + models.update({k: v for k, v in sys.modules[module_end].__dict__.items() if isinstance(v, type)}) + if isinstance(model_name, str): + model_name = model_name.split(".")[-1] + if model_name not in models: + return model_name + return models[model_name] + + +_UNSET = object() + + +class _MyMutableMapping(MutableMapping[str, typing.Any]): + def __init__(self, data: dict[str, typing.Any]) -> None: + self._data = data + + def __contains__(self, key: typing.Any) -> bool: + return key in self._data + + def __getitem__(self, key: str) -> typing.Any: + return self._data.__getitem__(key) + + def __setitem__(self, key: str, value: typing.Any) -> None: + self._data.__setitem__(key, value) + + def __delitem__(self, key: str) -> None: + self._data.__delitem__(key) + + def __iter__(self) -> typing.Iterator[typing.Any]: + return self._data.__iter__() + + def __len__(self) -> int: + return self._data.__len__() + + def __ne__(self, other: typing.Any) -> bool: + return not self.__eq__(other) + + def keys(self) -> typing.KeysView[str]: + """ + :returns: a set-like object providing a view on D's keys + :rtype: ~typing.KeysView + """ + return self._data.keys() + + def values(self) -> typing.ValuesView[typing.Any]: + """ + :returns: an object providing a view on D's values + :rtype: ~typing.ValuesView + """ + return self._data.values() + + def items(self) -> typing.ItemsView[str, typing.Any]: + """ + :returns: set-like object providing a view on D's items + :rtype: ~typing.ItemsView + """ + return self._data.items() + + def get(self, key: str, default: typing.Any = None) -> typing.Any: + """ + Get the value for key if key is in the dictionary, else default. + :param str key: The key to look up. + :param any default: The value to return if key is not in the dictionary. Defaults to None + :returns: D[k] if k in D, else d. + :rtype: any + """ + try: + return self[key] + except KeyError: + return default + + @typing.overload + def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ + + @typing.overload + def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs + + @typing.overload + def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Removes specified key and return the corresponding value. + :param str key: The key to pop. + :param any default: The value to return if key is not in the dictionary + :returns: The value corresponding to the key. + :rtype: any + :raises KeyError: If key is not found and default is not given. + """ + if default is _UNSET: + return self._data.pop(key) + return self._data.pop(key, default) + + def popitem(self) -> tuple[str, typing.Any]: + """ + Removes and returns some (key, value) pair + :returns: The (key, value) pair. + :rtype: tuple + :raises KeyError: if D is empty. + """ + return self._data.popitem() + + def clear(self) -> None: + """ + Remove all items from D. + """ + self._data.clear() + + def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ + """ + Updates D from mapping/iterable E and F. + :param any args: Either a mapping object or an iterable of key-value pairs. + """ + self._data.update(*args, **kwargs) + + @typing.overload + def setdefault(self, key: str, default: None = None) -> None: ... + + @typing.overload + def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Same as calling D.get(k, d), and setting D[k]=d if k not found + :param str key: The key to look up. + :param any default: The value to set if key is not in the dictionary + :returns: D[k] if k in D, else d. + :rtype: any + """ + if default is _UNSET: + return self._data.setdefault(key) + return self._data.setdefault(key, default) + + def __eq__(self, other: typing.Any) -> bool: + try: + other_model = self.__class__(other) + except Exception: + return False + return self._data == other_model._data + + def __repr__(self) -> str: + return str(self._data) + + +def _is_model(obj: typing.Any) -> bool: + return getattr(obj, "_is_model", False) + + +def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements + if isinstance(o, list): + return [_serialize(x, format) for x in o] + if isinstance(o, dict): + return {k: _serialize(v, format) for k, v in o.items()} + if isinstance(o, set): + return {_serialize(x, format) for x in o} + if isinstance(o, tuple): + return tuple(_serialize(x, format) for x in o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, format) + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, enum.Enum): + return o.value + if isinstance(o, int): + if format == "str": + return str(o) + return o + try: + # First try datetime.datetime + return _serialize_datetime(o, format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return o + + +def _get_rest_field(attr_to_rest_field: dict[str, "_RestField"], rest_name: str) -> typing.Optional["_RestField"]: + try: + return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) + except StopIteration: + return None + + +def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: + if not rf: + return _serialize(value, None) + if rf._is_multipart_file_input: + return value + if rf._is_model: + return _deserialize(rf._type, value) + if isinstance(value, ET.Element): + value = _deserialize(rf._type, value) + return _serialize(value, rf._format) + + +class Model(_MyMutableMapping): + _is_model = True + # label whether current class's _attr_to_rest_field has been calculated + # could not see _attr_to_rest_field directly because subclass inherits it from parent class + _calculated: set[str] = set() + + def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: + class_name = self.__class__.__name__ + if len(args) > 1: + raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") + dict_to_pass = { + rest_field._rest_name: rest_field._default + for rest_field in self._attr_to_rest_field.values() + if rest_field._default is not _UNSET + } + if args: # pylint: disable=too-many-nested-blocks + if isinstance(args[0], ET.Element): + existed_attr_keys = [] + model_meta = getattr(self, "_xml", {}) + + for rf in self._attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and args[0].get(xml_name) is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + # unwrapped array could either use prop items meta/prop meta + if prop_meta.get("itemsName"): + xml_name = prop_meta.get("itemsName") + xml_ns = prop_meta.get("itemNs") + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = args[0].findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, items) + continue + + # text element is primitive type + if prop_meta.get("text", False): + if args[0].text is not None: + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].text) + continue + + # wrapped element could be normal property or array, it should only have one element + item = args[0].find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, item) + + # rest thing is additional properties + for e in args[0]: + if e.tag not in existed_attr_keys: + dict_to_pass[e.tag] = _convert_element(e) + else: + dict_to_pass.update( + {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} + ) + else: + non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] + if non_attr_kwargs: + # actual type errors only throw the first wrong keyword arg they see, so following that. + raise TypeError(f"{class_name}.__init__() got an unexpected keyword argument '{non_attr_kwargs[0]}'") + dict_to_pass.update( + { + self._attr_to_rest_field[k]._rest_name: _create_value(self._attr_to_rest_field[k], v) + for k, v in kwargs.items() + if v is not None + } + ) + super().__init__(dict_to_pass) + + def copy(self) -> "Model": + return Model(self.__dict__) + + def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: + if f"{cls.__module__}.{cls.__qualname__}" not in cls._calculated: + # we know the last nine classes in mro are going to be 'Model', '_MyMutableMapping', 'MutableMapping', + # 'Mapping', 'Collection', 'Sized', 'Iterable', 'Container' and 'object' + mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order + attr_to_rest_field: dict[str, _RestField] = { # map attribute name to rest_field property + k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") + } + annotations = { + k: v + for mro_class in mros + if hasattr(mro_class, "__annotations__") + for k, v in mro_class.__annotations__.items() + } + for attr, rf in attr_to_rest_field.items(): + rf._module = cls.__module__ + if not rf._type: + rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) + if not rf._rest_name_input: + rf._rest_name_input = attr + cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) + cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") + + return super().__new__(cls) + + def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: + for base in cls.__bases__: + if hasattr(base, "__mapping__"): + base.__mapping__[discriminator or cls.__name__] = cls # type: ignore + + @classmethod + def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: + for v in cls.__dict__.values(): + if isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators: + return v + return None + + @classmethod + def _deserialize(cls, data, exist_discriminators): + if not hasattr(cls, "__mapping__"): + return cls(data) + discriminator = cls._get_discriminator(exist_discriminators) + if discriminator is None: + return cls(data) + exist_discriminators.append(discriminator._rest_name) + if isinstance(data, ET.Element): + model_meta = getattr(cls, "_xml", {}) + prop_meta = getattr(discriminator, "_xml", {}) + xml_name = prop_meta.get("name", discriminator._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + if data.get(xml_name) is not None: + discriminator_value = data.get(xml_name) + else: + discriminator_value = data.find(xml_name).text # pyright: ignore + else: + discriminator_value = data.get(discriminator._rest_name) + mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member + return mapped_cls._deserialize(data, exist_discriminators) + + def as_dict(self, *, exclude_readonly: bool = False) -> dict[str, typing.Any]: + """Return a dict that can be turned into json using json.dump. + + :keyword bool exclude_readonly: Whether to remove the readonly properties. + :returns: A dict JSON compatible object + :rtype: dict + """ + + result = {} + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] + for k, v in self.items(): + if exclude_readonly and k in readonly_props: # pyright: ignore + continue + is_multipart_file_input = False + try: + is_multipart_file_input = next( + rf for rf in self._attr_to_rest_field.values() if rf._rest_name == k + )._is_multipart_file_input + except StopIteration: + pass + result[k] = v if is_multipart_file_input else Model._as_dict_value(v, exclude_readonly=exclude_readonly) + return result + + @staticmethod + def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: + if v is None or isinstance(v, _Null): + return None + if isinstance(v, (list, tuple, set)): + return type(v)(Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v) + if isinstance(v, dict): + return {dk: Model._as_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} + return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v + + +def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): + if _is_model(obj): + return obj + return _deserialize(model_deserializer, obj) + + +def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): + if obj is None: + return obj + return _deserialize_with_callable(if_obj_deserializer, obj) + + +def _deserialize_with_union(deserializers, obj): + for deserializer in deserializers: + try: + return _deserialize(deserializer, obj) + except DeserializationError: + pass + raise DeserializationError() + + +def _deserialize_dict( + value_deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj: dict[typing.Any, typing.Any], +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = {child.tag: child for child in obj} + return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} + + +def _deserialize_multiple_sequence( + entry_deserializers: list[typing.Optional[typing.Callable]], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) + + +def _deserialize_sequence( + deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = list(obj) + return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) + + +def _sorted_annotations(types: list[typing.Any]) -> list[typing.Any]: + return sorted( + types, + key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), + ) + + +def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-statements, too-many-branches + annotation: typing.Any, + module: typing.Optional[str], + rf: typing.Optional["_RestField"] = None, +) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + if not annotation: + return None + + # is it a type alias? + if isinstance(annotation, str): + if module is not None: + annotation = _get_type_alias_type(module, annotation) + + # is it a forward ref / in quotes? + if isinstance(annotation, (str, typing.ForwardRef)): + try: + model_name = annotation.__forward_arg__ # type: ignore + except AttributeError: + model_name = annotation + if module is not None: + annotation = _get_model(module, model_name) # type: ignore + + try: + if module and _is_model(annotation): + if rf: + rf._is_model = True + + return functools.partial(_deserialize_model, annotation) # pyright: ignore + except Exception: + pass + + # is it a literal? + try: + if annotation.__origin__ is typing.Literal: # pyright: ignore + return None + except AttributeError: + pass + + # is it optional? + try: + if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore + if len(annotation.__args__) <= 2: # pyright: ignore + if_obj_deserializer = _get_deserialize_callable_from_annotation( + next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_with_optional, if_obj_deserializer) + # the type is Optional[Union[...]], we need to remove the None type from the Union + annotation_copy = copy.copy(annotation) + annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore + return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) + except AttributeError: + pass + + # is it union? + if getattr(annotation, "__origin__", None) is typing.Union: + # initial ordering is we make `string` the last deserialization option, because it is often them most generic + deserializers = [ + _get_deserialize_callable_from_annotation(arg, module, rf) + for arg in _sorted_annotations(annotation.__args__) # pyright: ignore + ] + + return functools.partial(_deserialize_with_union, deserializers) + + try: + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() == "dict": + value_deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[1], module, rf # pyright: ignore + ) + + return functools.partial( + _deserialize_dict, + value_deserializer, + module, + ) + except (AttributeError, IndexError): + pass + try: + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() in ["list", "set", "tuple", "sequence"]: + if len(annotation.__args__) > 1: # pyright: ignore + entry_deserializers = [ + _get_deserialize_callable_from_annotation(dt, module, rf) + for dt in annotation.__args__ # pyright: ignore + ] + return functools.partial(_deserialize_multiple_sequence, entry_deserializers, module) + deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[0], module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_sequence, deserializer, module) + except (TypeError, IndexError, AttributeError, SyntaxError): + pass + + def _deserialize_default( + deserializer, + obj, + ): + if obj is None: + return obj + try: + return _deserialize_with_callable(deserializer, obj) + except Exception: + pass + return obj + + if get_deserializer(annotation, rf): + return functools.partial(_deserialize_default, get_deserializer(annotation, rf)) + + return functools.partial(_deserialize_default, annotation) + + +def _deserialize_with_callable( + deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], + value: typing.Any, +): # pylint: disable=too-many-return-statements + try: + if value is None or isinstance(value, _Null): + return None + if isinstance(value, ET.Element): + if deserializer is str: + return value.text or "" + if deserializer is int: + return int(value.text) if value.text else None + if deserializer is float: + return float(value.text) if value.text else None + if deserializer is bool: + return value.text == "true" if value.text else None + if deserializer is None: + return value + if deserializer in [int, float, bool]: + return deserializer(value) + if isinstance(deserializer, CaseInsensitiveEnumMeta): + try: + return deserializer(value) + except ValueError: + # for unknown value, return raw value + return value + if isinstance(deserializer, type) and issubclass(deserializer, Model): + return deserializer._deserialize(value, []) + return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) + except Exception as e: + raise DeserializationError() from e + + +def _deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + if isinstance(value, PipelineResponse): + value = value.http_response.json() + if rf is None and format: + rf = _RestField(format=format) + if not isinstance(deserializer, functools.partial): + deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) + return _deserialize_with_callable(deserializer, value) + + +def _failsafe_deserialize( + deserializer: typing.Any, + response: HttpResponse, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + try: + return _deserialize(deserializer, response.json(), module, rf, format) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +def _failsafe_deserialize_xml( + deserializer: typing.Any, + response: HttpResponse, +) -> typing.Any: + try: + return _deserialize_xml(deserializer, response.text()) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +class _RestField: + def __init__( + self, + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + is_discriminator: bool = False, + visibility: typing.Optional[list[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[dict[str, typing.Any]] = None, + ): + self._type = type + self._rest_name_input = name + self._module: typing.Optional[str] = None + self._is_discriminator = is_discriminator + self._visibility = visibility + self._is_model = False + self._default = default + self._format = format + self._is_multipart_file_input = is_multipart_file_input + self._xml = xml if xml is not None else {} + + @property + def _class_type(self) -> typing.Any: + return getattr(self._type, "args", [None])[0] + + @property + def _rest_name(self) -> str: + if self._rest_name_input is None: + raise ValueError("Rest name was never set") + return self._rest_name_input + + def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin + # by this point, type and rest_name will have a value bc we default + # them in __new__ of the Model class + item = obj.get(self._rest_name) + if item is None: + return item + if self._is_model: + return item + return _deserialize(self._type, _serialize(item, self._format), rf=self) + + def __set__(self, obj: Model, value) -> None: + if value is None: + # we want to wipe out entries if users set attr to None + try: + obj.__delitem__(self._rest_name) + except KeyError: + pass + return + if self._is_model: + if not _is_model(value): + value = _deserialize(self._type, value) + obj.__setitem__(self._rest_name, value) + return + obj.__setitem__(self._rest_name, _serialize(value, self._format)) + + def _get_deserialize_callable_from_annotation( + self, annotation: typing.Any + ) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + return _get_deserialize_callable_from_annotation(annotation, self._module, self) + + +def rest_field( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[list[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField( + name=name, + type=type, + visibility=visibility, + default=default, + format=format, + is_multipart_file_input=is_multipart_file_input, + xml=xml, + ) + + +def rest_discriminator( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[list[str]] = None, + xml: typing.Optional[dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) + + +def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: + """Serialize a model to XML. + + :param Model model: The model to serialize. + :param bool exclude_readonly: Whether to exclude readonly properties. + :returns: The XML representation of the model. + :rtype: str + """ + return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore + + +def _get_element( + o: typing.Any, + exclude_readonly: bool = False, + parent_meta: typing.Optional[dict[str, typing.Any]] = None, + wrapped_element: typing.Optional[ET.Element] = None, +) -> typing.Union[ET.Element, list[ET.Element]]: + if _is_model(o): + model_meta = getattr(o, "_xml", {}) + + # if prop is a model, then use the prop element directly, else generate a wrapper of model + if wrapped_element is None: + wrapped_element = _create_xml_element( + model_meta.get("name", o.__class__.__name__), + model_meta.get("prefix"), + model_meta.get("ns"), + ) + + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + + for k, v in o.items(): + # do not serialize readonly properties + if exclude_readonly and k in readonly_props: + continue + + prop_rest_field = _get_rest_field(o._attr_to_rest_field, k) + if prop_rest_field: + prop_meta = getattr(prop_rest_field, "_xml").copy() + # use the wire name as xml name if no specific name is set + if prop_meta.get("name") is None: + prop_meta["name"] = k + else: + # additional properties will not have rest field, use the wire name as xml name + prop_meta = {"name": k} + + # if no ns for prop, use model's + if prop_meta.get("ns") is None and model_meta.get("ns"): + prop_meta["ns"] = model_meta.get("ns") + prop_meta["prefix"] = model_meta.get("prefix") + + if prop_meta.get("unwrapped", False): + # unwrapped could only set on array + wrapped_element.extend(_get_element(v, exclude_readonly, prop_meta)) + elif prop_meta.get("text", False): + # text could only set on primitive type + wrapped_element.text = _get_primitive_type_value(v) + elif prop_meta.get("attribute", False): + xml_name = prop_meta.get("name", k) + if prop_meta.get("ns"): + ET.register_namespace(prop_meta.get("prefix"), prop_meta.get("ns")) # pyright: ignore + xml_name = "{" + prop_meta.get("ns") + "}" + xml_name # pyright: ignore + # attribute should be primitive type + wrapped_element.set(xml_name, _get_primitive_type_value(v)) + else: + # other wrapped prop element + wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) + return wrapped_element + if isinstance(o, list): + return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore + if isinstance(o, dict): + result = [] + for k, v in o.items(): + result.append( + _get_wrapped_element( + v, + exclude_readonly, + { + "name": k, + "ns": parent_meta.get("ns") if parent_meta else None, + "prefix": parent_meta.get("prefix") if parent_meta else None, + }, + ) + ) + return result + + # primitive case need to create element based on parent_meta + if parent_meta: + return _get_wrapped_element( + o, + exclude_readonly, + { + "name": parent_meta.get("itemsName", parent_meta.get("name")), + "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), + "ns": parent_meta.get("itemsNs", parent_meta.get("ns")), + }, + ) + + raise ValueError("Could not serialize value into xml: " + o) + + +def _get_wrapped_element( + v: typing.Any, + exclude_readonly: bool, + meta: typing.Optional[dict[str, typing.Any]], +) -> ET.Element: + wrapped_element = _create_xml_element( + meta.get("name") if meta else None, meta.get("prefix") if meta else None, meta.get("ns") if meta else None + ) + if isinstance(v, (dict, list)): + wrapped_element.extend(_get_element(v, exclude_readonly, meta)) + elif _is_model(v): + _get_element(v, exclude_readonly, meta, wrapped_element) + else: + wrapped_element.text = _get_primitive_type_value(v) + return wrapped_element + + +def _get_primitive_type_value(v) -> str: + if v is True: + return "true" + if v is False: + return "false" + if isinstance(v, _Null): + return "" + return str(v) + + +def _create_xml_element(tag, prefix=None, ns=None): + if prefix and ns: + ET.register_namespace(prefix, ns) + if ns: + return ET.Element("{" + ns + "}" + tag) + return ET.Element(tag) + + +def _deserialize_xml( + deserializer: typing.Any, + value: str, +) -> typing.Any: + element = ET.fromstring(value) # nosec + return _deserialize(deserializer, element) + + +def _convert_element(e: ET.Element): + # dict case + if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: + dict_result: dict[str, typing.Any] = {} + for child in e: + if dict_result.get(child.tag) is not None: + if isinstance(dict_result[child.tag], list): + dict_result[child.tag].append(_convert_element(child)) + else: + dict_result[child.tag] = [dict_result[child.tag], _convert_element(child)] + else: + dict_result[child.tag] = _convert_element(child) + dict_result.update(e.attrib) + return dict_result + # array case + if len(e) > 0: + array_result: list[typing.Any] = [] + for child in e: + array_result.append(_convert_element(child)) + return array_result + # primitive case + return e.text diff --git a/sdk/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..45a3e44e45cb 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) Python 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..8f2350dd3b0c 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 = "2.0.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..9e842b14b68e 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 @@ -2,15 +2,21 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -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 ._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/_palo_alto_networks_ngfw_mgmt_client.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_client.py similarity index 63% rename from sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_palo_alto_networks_ngfw_mgmt_client.py rename to sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_client.py index ce71a100f71f..f11bfd216f9b 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/_client.py @@ -2,18 +2,22 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from 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 +29,9 @@ GlobalRulestackOperations, LocalRulesOperations, LocalRulestacksOperations, + MetricsObjectFirewallOperations, Operations, + PaloAltoNetworksCloudngfwOperationsOperations, PostRulesOperations, PreRulesOperations, PrefixListGlobalRulestackOperations, @@ -33,13 +39,15 @@ ) 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 operations: Operations operations + :vartype operations: azure.mgmt.paloaltonetworksngfw.aio.operations.Operations :ivar global_rulestack: GlobalRulestackOperations operations :vartype global_rulestack: azure.mgmt.paloaltonetworksngfw.aio.operations.GlobalRulestackOperations @@ -57,13 +65,14 @@ class PaloAltoNetworksNgfwMgmtClient: # pylint: disable=client-accepts-api-vers 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 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 @@ -78,14 +87,21 @@ class PaloAltoNetworksNgfwMgmtClient: # pylint: disable=client-accepts-api-vers :ivar prefix_list_local_rulestack: PrefixListLocalRulestackOperations operations :vartype prefix_list_local_rulestack: azure.mgmt.paloaltonetworksngfw.aio.operations.PrefixListLocalRulestackOperations - :param credential: Credential needed for the client to connect to Azure. Required. + :ivar palo_alto_networks_cloudngfw_operations: PaloAltoNetworksCloudngfwOperationsOperations + operations + :vartype palo_alto_networks_cloudngfw_operations: + azure.mgmt.paloaltonetworksngfw.aio.operations.PaloAltoNetworksCloudngfwOperationsOperations + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service host. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2023-09-01". Note that overriding this - default value may result in unsupported behavior. + :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: The API version to use for this operation. 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 Retry-After header is present. @@ -95,18 +111,52 @@ 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: + _endpoint = "{endpoint}" + _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, + base_url=cast(str, base_url), + 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, _endpoint), 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) - self._deserialize = Deserializer(client_models) + self._serialize = Serializer() + self._deserialize = Deserializer() self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.global_rulestack = GlobalRulestackOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -121,11 +171,13 @@ def __init__( 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.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 @@ -137,14 +189,19 @@ def __init__( self.prefix_list_local_rulestack = PrefixListLocalRulestackOperations( self._client, self._config, self._serialize, self._deserialize ) + self.palo_alto_networks_cloudngfw_operations = PaloAltoNetworksCloudngfwOperationsOperations( + 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 >>> request = HttpRequest("GET", "https://www.example.org/") - >>> response = await client._send_request(request) + >>> response = await client.send_request(request) For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request @@ -157,13 +214,17 @@ 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) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: 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/_configuration.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_configuration.py index b436ff93ee90..12be766c7113 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 @@ -2,41 +2,51 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from 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 attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-09-01". Note that overriding this - default value may result in unsupported behavior. + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. 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, + base_url: str = "https://management.azure.com", + 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 +55,12 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url + self.cloud_setting = cloud_setting self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) 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 +69,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/_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..7e2c41f3f85e 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 @@ -2,44 +2,54 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -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 ._operations import Operations # type: ignore +from ._operations import GlobalRulestackOperations # type: ignore +from ._operations import CertificateObjectGlobalRulestackOperations # type: ignore +from ._operations import FqdnListGlobalRulestackOperations # type: ignore +from ._operations import PostRulesOperations # type: ignore +from ._operations import PrefixListGlobalRulestackOperations # type: ignore +from ._operations import PreRulesOperations # type: ignore +from ._operations import FirewallsOperations # type: ignore +from ._operations import LocalRulestacksOperations # type: ignore +from ._operations import MetricsObjectFirewallOperations # type: ignore +from ._operations import FirewallStatusOperations # type: ignore +from ._operations import CertificateObjectLocalRulestackOperations # type: ignore +from ._operations import FqdnListLocalRulestackOperations # type: ignore +from ._operations import LocalRulesOperations # type: ignore +from ._operations import PrefixListLocalRulestackOperations # type: ignore +from ._operations import PaloAltoNetworksCloudngfwOperationsOperations # 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__ = [ + "Operations", "GlobalRulestackOperations", "CertificateObjectGlobalRulestackOperations", "FqdnListGlobalRulestackOperations", "PostRulesOperations", "PrefixListGlobalRulestackOperations", "PreRulesOperations", - "Operations", "FirewallsOperations", "LocalRulestacksOperations", + "MetricsObjectFirewallOperations", "FirewallStatusOperations", "CertificateObjectLocalRulestackOperations", "FqdnListLocalRulestackOperations", "LocalRulesOperations", "PrefixListLocalRulestackOperations", + "PaloAltoNetworksCloudngfwOperationsOperations", ] -__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 deleted file mode 100644 index bc3759376562..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_certificate_object_global_rulestack_operations.py +++ /dev/null @@ -1,555 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import 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 ..._vendor import _convert_request -from ...operations._certificate_object_global_rulestack_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CertificateObjectGlobalRulestackOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.paloaltonetworksngfw.aio.PaloAltoNetworksNgfwMgmtClient`'s - :attr:`certificate_object_global_rulestack` attribute. - """ - - models = _models - - 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") - - @distributed_trace - def list( - self, global_rulestack_name: str, **kwargs: Any - ) -> AsyncIterable["_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: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource] - :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.CertificateObjectGlobalRulestackResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - 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) - - 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 = _convert_request(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) - 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) - - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates"} - - @distributed_trace_async - async def get( - self, global_rulestack_name: str, name: str, **kwargs: Any - ) -> _models.CertificateObjectGlobalRulestackResource: - """Get a CertificateObjectGlobalRulestackResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :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 = { - 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.CertificateObjectGlobalRulestackResource] = kwargs.pop("cls", None) - - 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) - - _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("CertificateObjectGlobalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}" - } - - async def _create_or_update_initial( - self, - global_rulestack_name: str, - name: str, - resource: Union[_models.CertificateObjectGlobalRulestackResource, IO], - **kwargs: Any - ) -> _models.CertificateObjectGlobalRulestackResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateObjectGlobalRulestackResource] = 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, "CertificateObjectGlobalRulestackResource") - - 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) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("CertificateObjectGlobalRulestackResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("CertificateObjectGlobalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # 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, - global_rulestack_name: str, - name: str, - resource: _models.CertificateObjectGlobalRulestackResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CertificateObjectGlobalRulestackResource]: - """Create a CertificateObjectGlobalRulestackResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param name: certificate name. Required. - :type name: str - :param resource: Resource create parameters. Required. - :type resource: - ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource - :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: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - global_rulestack_name: str, - name: str, - resource: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CertificateObjectGlobalRulestackResource]: - """Create a CertificateObjectGlobalRulestackResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param name: certificate name. Required. - :type name: str - :param resource: Resource create parameters. Required. - :type resource: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :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: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - global_rulestack_name: str, - name: str, - resource: Union[_models.CertificateObjectGlobalRulestackResource, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.CertificateObjectGlobalRulestackResource]: - """Create a CertificateObjectGlobalRulestackResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param name: certificate name. Required. - :type name: str - :param resource: Resource create parameters. Is either a - CertificateObjectGlobalRulestackResource type or a IO 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. - :return: An instance of AsyncLROPoller that returns either - CertificateObjectGlobalRulestackResource or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource] - :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.CertificateObjectGlobalRulestackResource] = 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( - global_rulestack_name=global_rulestack_name, - name=name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateObjectGlobalRulestackResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - 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) - - _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, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}" - } - - @distributed_trace_async - async def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Delete a CertificateObjectGlobalRulestackResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :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: - """ - _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( # type: ignore - global_rulestack_name=global_rulestack_name, - name=name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - 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.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}" - } 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 deleted file mode 100644 index 28ea651d9a25..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_certificate_object_local_rulestack_operations.py +++ /dev/null @@ -1,590 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import 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 ..._vendor import _convert_request -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, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CertificateObjectLocalRulestackOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.paloaltonetworksngfw.aio.PaloAltoNetworksNgfwMgmtClient`'s - :attr:`certificate_object_local_rulestack` attribute. - """ - - models = _models - - 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") - - @distributed_trace - def list_by_local_rulestacks( - self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CertificateObjectLocalRulestackResource"]: - """List CertificateObjectLocalRulestackResource resources by LocalRulestacks. - - :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 - :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: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource] - :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.CertificateObjectLocalRulestackResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 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_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) - - 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 = _convert_request(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) - 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) - - 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 - ) -> _models.CertificateObjectLocalRulestackResource: - """Get a CertificateObjectLocalRulestackResource. - - :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 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 = { - 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.CertificateObjectLocalRulestackResource] = kwargs.pop("cls", None) - - 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) - - _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("CertificateObjectLocalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}" - } - - async def _create_or_update_initial( - self, - resource_group_name: str, - local_rulestack_name: str, - name: str, - resource: Union[_models.CertificateObjectLocalRulestackResource, IO], - **kwargs: Any - ) -> _models.CertificateObjectLocalRulestackResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateObjectLocalRulestackResource] = 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, "CertificateObjectLocalRulestackResource") - - request = build_create_or_update_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, - 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) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("CertificateObjectLocalRulestackResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("CertificateObjectLocalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # 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, - resource_group_name: str, - local_rulestack_name: str, - name: str, - resource: _models.CertificateObjectLocalRulestackResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CertificateObjectLocalRulestackResource]: - """Create a CertificateObjectLocalRulestackResource. - - :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 name: certificate name. Required. - :type name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource - :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: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - local_rulestack_name: str, - name: str, - resource: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CertificateObjectLocalRulestackResource]: - """Create a CertificateObjectLocalRulestackResource. - - :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 name: certificate name. Required. - :type name: str - :param resource: Resource create parameters. Required. - :type resource: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :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: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - local_rulestack_name: str, - name: str, - resource: Union[_models.CertificateObjectLocalRulestackResource, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.CertificateObjectLocalRulestackResource]: - """Create a CertificateObjectLocalRulestackResource. - - :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 name: certificate name. Required. - :type name: str - :param resource: Resource create parameters. Is either a - CertificateObjectLocalRulestackResource type or a IO 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. - :return: An instance of AsyncLROPoller that returns either - CertificateObjectLocalRulestackResource or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource] - :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.CertificateObjectLocalRulestackResource] = 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, - local_rulestack_name=local_rulestack_name, - name=name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateObjectLocalRulestackResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - 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) - - _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, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}" - } - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a CertificateObjectLocalRulestackResource. - - :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 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: - """ - _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( # type: ignore - resource_group_name=resource_group_name, - local_rulestack_name=local_rulestack_name, - name=name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - 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.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}" - } 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 deleted file mode 100644 index b7e8edbe4134..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_firewall_status_operations.py +++ /dev/null @@ -1,211 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import 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 ...operations._firewall_status_operations import build_get_request, build_list_by_firewalls_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FirewallStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.paloaltonetworksngfw.aio.PaloAltoNetworksNgfwMgmtClient`'s - :attr:`firewall_status` attribute. - """ - - models = _models - - 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") - - @distributed_trace - def list_by_firewalls( - self, resource_group_name: str, firewall_name: str, **kwargs: Any - ) -> AsyncIterable["_models.FirewallStatusResource"]: - """List FirewallStatusResource 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 - :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: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.FirewallStatusResource] - :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.FirewallStatusResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 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, - template_url=self.list_by_firewalls.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(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) - 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) - - 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. - - :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 - :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 = { - 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.FirewallStatusResource] = 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, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FirewallStatusResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/statuses/default" - } 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 deleted file mode 100644 index 8cc8d9e5ce7f..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_firewalls_operations.py +++ /dev/null @@ -1,1124 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import 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 ..._vendor import _convert_request -from ...operations._firewalls_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_global_rulestack_request, - build_get_log_profile_request, - build_get_request, - build_get_support_info_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_save_log_profile_request, - build_update_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FirewallsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.paloaltonetworksngfw.aio.PaloAltoNetworksNgfwMgmtClient`'s - :attr:`firewalls` attribute. - """ - - models = _models - - 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") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_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] - :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.FirewallResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 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_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) - - 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 = _convert_request(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) - 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) - - 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"]: - """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] - :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.FirewallResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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) - - 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 = _convert_request(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) - 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) - - 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. - - :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 - :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 = { - 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.FirewallResource] = 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, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FirewallResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" - } - - 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 = { - 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[_models.FirewallResource] = 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, "FirewallResource") - - 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, - 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) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("FirewallResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FirewallResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # 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, - resource_group_name: str, - firewall_name: str, - resource: _models.FirewallResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FirewallResource]: - """Create a FirewallResource. - - :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.FirewallResource - :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: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - firewall_name: str, - resource: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FirewallResource]: - """Create a FirewallResource. - - :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 - :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: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] - :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.FirewallResource, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.FirewallResource]: - """Create a FirewallResource. - - :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 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. - :return: An instance of AsyncLROPoller that returns either FirewallResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] - :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.FirewallResource] = 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 - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FirewallResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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}" - } - - @overload - async def update( - self, - resource_group_name: str, - firewall_name: str, - properties: _models.FirewallResourceUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.FirewallResource: - """Update a FirewallResource. - - :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 properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResourceUpdate - :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: - """ - - @overload - async def update( - self, - resource_group_name: str, - firewall_name: str, - properties: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.FirewallResource: - """Update a FirewallResource. - - :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 properties: The resource properties to be updated. Required. - :type properties: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: FirewallResource or the result of cls(response) - :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - firewall_name: str, - properties: Union[_models.FirewallResourceUpdate, IO], - **kwargs: Any - ) -> _models.FirewallResource: - """Update a FirewallResource. - - :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 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 - :return: FirewallResource or the result of cls(response) - :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FirewallResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "FirewallResourceUpdate") - - request = build_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, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FirewallResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, firewall_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - 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) - - _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, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" - } - - @distributed_trace_async - async def begin_delete(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Delete a FirewallResource. - - :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 - :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: - """ - _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( # type: ignore - 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 - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - 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.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}" - } - - @distributed_trace_async - async def get_global_rulestack( - self, resource_group_name: str, firewall_name: str, **kwargs: Any - ) -> _models.GlobalRulestackInfo: - """Get Global Rulestack associated with the Firewall. - - :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 - :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 = { - 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.GlobalRulestackInfo] = kwargs.pop("cls", None) - - 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) - - _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("GlobalRulestackInfo", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_global_rulestack.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/getGlobalRulestack" - } - - @distributed_trace_async - async def get_log_profile(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _models.LogSettings: - """Log Profile for Firewall. - - :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 - :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 = { - 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.LogSettings] = kwargs.pop("cls", None) - - 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) - - _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("LogSettings", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_log_profile.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/getLogProfile" - } - - @distributed_trace_async - async def get_support_info( - self, resource_group_name: str, firewall_name: str, email: Optional[str] = None, **kwargs: Any - ) -> _models.SupportInfo: - """support info for firewall. - - :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 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 = { - 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.SupportInfo] = kwargs.pop("cls", None) - - 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) - - _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("SupportInfo", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_support_info.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/getSupportInfo" - } - - @overload - async def save_log_profile( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - firewall_name: str, - log_settings: Optional[_models.LogSettings] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Log Profile for Firewall. - - :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 log_settings: Default value is None. - :type log_settings: ~azure.mgmt.paloaltonetworksngfw.models.LogSettings - :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 - self, - resource_group_name: str, - firewall_name: str, - log_settings: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Log Profile for Firewall. - - :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 log_settings: Default value is None. - :type log_settings: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: 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 - self, - resource_group_name: str, - firewall_name: str, - log_settings: Optional[Union[_models.LogSettings, IO]] = None, - **kwargs: Any - ) -> None: - """Log Profile for Firewall. - - :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 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 - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(log_settings, (IOBase, bytes)): - _content = log_settings - else: - if log_settings is not None: - _json = self._serialize.body(log_settings, "LogSettings") - else: - _json = None - - request = build_save_log_profile_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, - template_url=self.save_log_profile.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - save_log_profile.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/saveLogProfile" - } 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 deleted file mode 100644 index ccfa6967cf22..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_fqdn_list_global_rulestack_operations.py +++ /dev/null @@ -1,553 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import 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 ..._vendor import _convert_request -from ...operations._fqdn_list_global_rulestack_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FqdnListGlobalRulestackOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.paloaltonetworksngfw.aio.PaloAltoNetworksNgfwMgmtClient`'s - :attr:`fqdn_list_global_rulestack` attribute. - """ - - models = _models - - 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") - - @distributed_trace - def list( - self, global_rulestack_name: str, **kwargs: Any - ) -> AsyncIterable["_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: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource] - :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.FqdnListGlobalRulestackResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - 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) - - 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 = _convert_request(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) - 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) - - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists"} - - @distributed_trace_async - async def get( - self, global_rulestack_name: str, name: str, **kwargs: Any - ) -> _models.FqdnListGlobalRulestackResource: - """Get a FqdnListGlobalRulestackResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :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 = { - 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.FqdnListGlobalRulestackResource] = kwargs.pop("cls", None) - - 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) - - _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("FqdnListGlobalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" - } - - async def _create_or_update_initial( - self, - global_rulestack_name: str, - name: str, - resource: Union[_models.FqdnListGlobalRulestackResource, IO], - **kwargs: Any - ) -> _models.FqdnListGlobalRulestackResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FqdnListGlobalRulestackResource] = 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, "FqdnListGlobalRulestackResource") - - 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) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("FqdnListGlobalRulestackResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FqdnListGlobalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # 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, - global_rulestack_name: str, - name: str, - resource: _models.FqdnListGlobalRulestackResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FqdnListGlobalRulestackResource]: - """Create a FqdnListGlobalRulestackResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param name: fqdn list name. Required. - :type name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource - :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: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - global_rulestack_name: str, - name: str, - resource: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FqdnListGlobalRulestackResource]: - """Create a FqdnListGlobalRulestackResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param name: fqdn list name. Required. - :type name: str - :param resource: Resource create parameters. Required. - :type resource: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :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: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - global_rulestack_name: str, - name: str, - resource: Union[_models.FqdnListGlobalRulestackResource, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.FqdnListGlobalRulestackResource]: - """Create a FqdnListGlobalRulestackResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :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. - :return: An instance of AsyncLROPoller that returns either FqdnListGlobalRulestackResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource] - :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.FqdnListGlobalRulestackResource] = 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( - global_rulestack_name=global_rulestack_name, - name=name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FqdnListGlobalRulestackResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - 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) - - _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, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" - } - - @distributed_trace_async - async def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Delete a FqdnListGlobalRulestackResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :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: - """ - _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( # type: ignore - global_rulestack_name=global_rulestack_name, - name=name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - 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.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}" - } 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 deleted file mode 100644 index 6dd896a27094..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_fqdn_list_local_rulestack_operations.py +++ /dev/null @@ -1,589 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import 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 ..._vendor import _convert_request -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, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FqdnListLocalRulestackOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.paloaltonetworksngfw.aio.PaloAltoNetworksNgfwMgmtClient`'s - :attr:`fqdn_list_local_rulestack` attribute. - """ - - models = _models - - 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") - - @distributed_trace - def list_by_local_rulestacks( - self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> AsyncIterable["_models.FqdnListLocalRulestackResource"]: - """List FqdnListLocalRulestackResource resources by LocalRulestacks. - - :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 - :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: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource] - :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.FqdnListLocalRulestackResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 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_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) - - 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 = _convert_request(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) - 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) - - 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 - ) -> _models.FqdnListLocalRulestackResource: - """Get a FqdnListLocalRulestackResource. - - :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 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 = { - 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.FqdnListLocalRulestackResource] = kwargs.pop("cls", None) - - 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) - - _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("FqdnListLocalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}" - } - - async def _create_or_update_initial( - self, - resource_group_name: str, - local_rulestack_name: str, - name: str, - resource: Union[_models.FqdnListLocalRulestackResource, IO], - **kwargs: Any - ) -> _models.FqdnListLocalRulestackResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FqdnListLocalRulestackResource] = 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, "FqdnListLocalRulestackResource") - - request = build_create_or_update_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, - 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) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("FqdnListLocalRulestackResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FqdnListLocalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # 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, - resource_group_name: str, - local_rulestack_name: str, - name: str, - resource: _models.FqdnListLocalRulestackResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FqdnListLocalRulestackResource]: - """Create a FqdnListLocalRulestackResource. - - :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 name: fqdn list name. Required. - :type name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource - :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: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - local_rulestack_name: str, - name: str, - resource: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FqdnListLocalRulestackResource]: - """Create a FqdnListLocalRulestackResource. - - :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 name: fqdn list name. Required. - :type name: str - :param resource: Resource create parameters. Required. - :type resource: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :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: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - local_rulestack_name: str, - name: str, - resource: Union[_models.FqdnListLocalRulestackResource, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.FqdnListLocalRulestackResource]: - """Create a FqdnListLocalRulestackResource. - - :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 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. - :return: An instance of AsyncLROPoller that returns either FqdnListLocalRulestackResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource] - :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.FqdnListLocalRulestackResource] = 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, - local_rulestack_name=local_rulestack_name, - name=name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FqdnListLocalRulestackResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - 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) - - _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, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}" - } - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a FqdnListLocalRulestackResource. - - :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 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: - """ - _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( # type: ignore - resource_group_name=resource_group_name, - local_rulestack_name=local_rulestack_name, - name=name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - 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.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}" - } 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 deleted file mode 100644 index 33ae27c7c540..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_global_rulestack_operations.py +++ /dev/null @@ -1,1276 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import 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 ..._vendor import _convert_request -from ...operations._global_rulestack_operations import ( - build_commit_request, - build_create_or_update_request, - build_delete_request, - build_get_change_log_request, - build_get_request, - build_list_advanced_security_objects_request, - build_list_app_ids_request, - build_list_countries_request, - build_list_firewalls_request, - build_list_predefined_url_categories_request, - build_list_request, - build_list_security_services_request, - build_revert_request, - build_update_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GlobalRulestackOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.paloaltonetworksngfw.aio.PaloAltoNetworksNgfwMgmtClient`'s - :attr:`global_rulestack` attribute. - """ - - models = _models - - 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") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_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: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource] - :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.GlobalRulestackResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - 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) - - 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 = _convert_request(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) - 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) - - 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 = { - 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.GlobalRulestackResource] = kwargs.pop("cls", None) - - 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) - - _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("GlobalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}"} - - async def _create_or_update_initial( - self, global_rulestack_name: str, resource: Union[_models.GlobalRulestackResource, IO], **kwargs: Any - ) -> _models.GlobalRulestackResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GlobalRulestackResource] = 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, "GlobalRulestackResource") - - 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) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("GlobalRulestackResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("GlobalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # 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, - global_rulestack_name: str, - resource: _models.GlobalRulestackResource, - *, - 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: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource - :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: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, global_rulestack_name: str, resource: IO, *, 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 - :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: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, global_rulestack_name: str, resource: Union[_models.GlobalRulestackResource, IO], **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. - :return: An instance of AsyncLROPoller that returns either GlobalRulestackResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource] - :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.GlobalRulestackResource] = 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( - global_rulestack_name=global_rulestack_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GlobalRulestackResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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}" - } - - @overload - async def update( - self, - global_rulestack_name: str, - properties: _models.GlobalRulestackResourceUpdate, - *, - 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: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResourceUpdate - :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: - """ - - @overload - async def update( - self, global_rulestack_name: str, properties: IO, *, 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 - :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: - """ - - @distributed_trace_async - async def update( - self, global_rulestack_name: str, properties: Union[_models.GlobalRulestackResourceUpdate, IO], **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 - :return: GlobalRulestackResource or the result of cls(response) - :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GlobalRulestackResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "GlobalRulestackResourceUpdate") - - 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) - - _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("GlobalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - update.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}"} - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - 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) - - _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, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}"} - - @distributed_trace_async - async def begin_delete(self, global_rulestack_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Delete 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 - :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: - """ - _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( # type: ignore - global_rulestack_name=global_rulestack_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - 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.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}"} - - async def _commit_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_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) - - _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 [202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _commit_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/commit" - } - - @distributed_trace_async - async def begin_commit(self, global_rulestack_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Commit 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 - :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: - """ - _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._commit_initial( # type: ignore - global_rulestack_name=global_rulestack_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.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" - } - - @distributed_trace_async - async def get_change_log(self, global_rulestack_name: str, **kwargs: Any) -> _models.Changelog: - """Get changelog. - - :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 = { - 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.Changelog] = kwargs.pop("cls", None) - - 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) - - _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("Changelog", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_change_log.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/getChangeLog" - } - - @distributed_trace_async - async def list_advanced_security_objects( - self, - global_rulestack_name: str, - type: Union[str, _models.AdvSecurityObjectTypeEnum], - skip: Optional[str] = None, - top: Optional[int] = None, - **kwargs: Any - ) -> _models.AdvSecurityObjectListResponse: - """Get the list of advanced security objects. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param type: Known values are: "urlCustom" and "feeds". Required. - :type type: str or ~azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectTypeEnum - :param skip: Default value is None. - :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 = { - 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.AdvSecurityObjectListResponse] = kwargs.pop("cls", None) - - 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) - - _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("AdvSecurityObjectListResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_advanced_security_objects.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listAdvancedSecurityObjects" - } - - @distributed_trace_async - async def list_app_ids( - self, - global_rulestack_name: str, - app_id_version: Optional[str] = None, - app_prefix: Optional[str] = None, - skip: Optional[str] = None, - top: Optional[int] = None, - **kwargs: Any - ) -> _models.ListAppIdResponse: - """List of AppIds for GlobalRulestack ApiVersion. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_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 - :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 = { - 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.ListAppIdResponse] = kwargs.pop("cls", None) - - 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) - - _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("ListAppIdResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_app_ids.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listAppIds" - } - - @distributed_trace_async - async def list_countries( - self, global_rulestack_name: str, skip: Optional[str] = None, top: Optional[int] = None, **kwargs: Any - ) -> _models.CountriesResponse: - """List of countries for Rulestack. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param skip: Default value is None. - :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 = { - 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.CountriesResponse] = kwargs.pop("cls", None) - - 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) - - _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("CountriesResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_countries.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listCountries" - } - - @distributed_trace_async - async def list_firewalls(self, global_rulestack_name: str, **kwargs: Any) -> _models.ListFirewallsResponse: - """List of Firewalls associated with Rulestack. - - :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 = { - 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.ListFirewallsResponse] = kwargs.pop("cls", None) - - 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) - - _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("ListFirewallsResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_firewalls.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listFirewalls" - } - - @distributed_trace_async - async def list_predefined_url_categories( - self, global_rulestack_name: str, skip: Optional[str] = None, top: Optional[int] = None, **kwargs: Any - ) -> _models.PredefinedUrlCategoriesResponse: - """List predefined URL categories for rulestack. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param skip: Default value is None. - :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 = { - 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.PredefinedUrlCategoriesResponse] = kwargs.pop("cls", None) - - 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) - - _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("PredefinedUrlCategoriesResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_predefined_url_categories.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listPredefinedUrlCategories" - } - - @distributed_trace_async - async def list_security_services( - self, - global_rulestack_name: str, - type: Union[str, _models.SecurityServicesTypeEnum], - skip: Optional[str] = None, - top: Optional[int] = None, - **kwargs: Any - ) -> _models.SecurityServicesResponse: - """List the security services for rulestack. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param type: Known values are: "antiSpyware", "antiVirus", "ipsVulnerability", "urlFiltering", - "fileBlocking", and "dnsSubscription". Required. - :type type: str or ~azure.mgmt.paloaltonetworksngfw.models.SecurityServicesTypeEnum - :param skip: Default value is None. - :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 = { - 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.SecurityServicesResponse] = kwargs.pop("cls", None) - - 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) - - _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("SecurityServicesResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_security_services.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listSecurityServices" - } - - @distributed_trace_async - async def revert( # pylint: disable=inconsistent-return-statements - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_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) - - _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 [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - revert.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/revert"} 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 deleted file mode 100644 index bc2465ae9396..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_local_rules_operations.py +++ /dev/null @@ -1,815 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import 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 ..._vendor import _convert_request -from ...operations._local_rules_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_counters_request, - build_get_request, - build_list_by_local_rulestacks_request, - build_refresh_counters_request, - build_reset_counters_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class LocalRulesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.paloaltonetworksngfw.aio.PaloAltoNetworksNgfwMgmtClient`'s - :attr:`local_rules` attribute. - """ - - models = _models - - 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") - - @distributed_trace - def list_by_local_rulestacks( - self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> AsyncIterable["_models.LocalRulesResource"]: - """List LocalRulesResource resources by LocalRulestacks. - - :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 - :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] - :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.LocalRulesResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 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_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) - - 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 = _convert_request(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) - 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) - - 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 - ) -> _models.LocalRulesResource: - """Get a LocalRulesResource. - - :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 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 = { - 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.LocalRulesResource] = kwargs.pop("cls", None) - - 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) - - _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("LocalRulesResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}" - } - - async def _create_or_update_initial( - self, - resource_group_name: str, - local_rulestack_name: str, - priority: str, - resource: Union[_models.LocalRulesResource, IO], - **kwargs: Any - ) -> _models.LocalRulesResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LocalRulesResource] = 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, "LocalRulesResource") - - request = build_create_or_update_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, - 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) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("LocalRulesResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("LocalRulesResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # 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, - resource_group_name: str, - local_rulestack_name: str, - priority: str, - resource: _models.LocalRulesResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.LocalRulesResource]: - """Create a LocalRulesResource. - - :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 priority: Local Rule priority. Required. - :type priority: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource - :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: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - local_rulestack_name: str, - priority: str, - resource: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.LocalRulesResource]: - """Create a LocalRulesResource. - - :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 priority: Local Rule priority. Required. - :type priority: str - :param resource: Resource create parameters. Required. - :type resource: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :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: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - local_rulestack_name: str, - priority: str, - resource: Union[_models.LocalRulesResource, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.LocalRulesResource]: - """Create a LocalRulesResource. - - :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 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. - :return: An instance of AsyncLROPoller that returns either LocalRulesResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource] - :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.LocalRulesResource] = 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, - local_rulestack_name=local_rulestack_name, - priority=priority, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("LocalRulesResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, local_rulestack_name: str, priority: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - 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) - - _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, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}" - } - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, local_rulestack_name: str, priority: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a LocalRulesResource. - - :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 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: - """ - _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( # type: ignore - resource_group_name=resource_group_name, - local_rulestack_name=local_rulestack_name, - priority=priority, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - 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.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}" - } - - @distributed_trace_async - async def get_counters( - self, - resource_group_name: str, - local_rulestack_name: str, - priority: str, - firewall_name: Optional[str] = None, - **kwargs: Any - ) -> _models.RuleCounter: - """Get counters. - - :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 priority: Local Rule priority. Required. - :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 = { - 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.RuleCounter] = kwargs.pop("cls", None) - - 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) - - _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("RuleCounter", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_counters.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}/getCounters" - } - - @distributed_trace_async - async def refresh_counters( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - local_rulestack_name: str, - priority: str, - firewall_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """Refresh counters. - - :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 priority: Local Rule priority. Required. - :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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_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) - - _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 [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - refresh_counters.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}/refreshCounters" - } - - @distributed_trace_async - async def reset_counters( - self, - resource_group_name: str, - local_rulestack_name: str, - priority: str, - firewall_name: Optional[str] = None, - **kwargs: Any - ) -> _models.RuleCounterReset: - """Reset counters. - - :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 priority: Local Rule priority. Required. - :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 = { - 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.RuleCounterReset] = kwargs.pop("cls", None) - - 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) - - _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("RuleCounterReset", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - reset_counters.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}/resetCounters" - } 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 deleted file mode 100644 index 92fc81f8b5a5..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_local_rulestacks_operations.py +++ /dev/null @@ -1,1340 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import 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 ..._vendor import _convert_request -from ...operations._local_rulestacks_operations import ( - build_commit_request, - build_create_or_update_request, - build_delete_request, - build_get_change_log_request, - build_get_request, - build_get_support_info_request, - build_list_advanced_security_objects_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_list_firewalls_request, - build_list_security_services_request, - build_revert_request, - build_update_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class LocalRulestacksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.paloaltonetworksngfw.aio.PaloAltoNetworksNgfwMgmtClient`'s - :attr:`local_rulestacks` attribute. - """ - - models = _models - - 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") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_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: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource] - :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.LocalRulestackResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 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_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) - - 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 = _convert_request(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) - 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) - - 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"]: - """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: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource] - :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.LocalRulestackResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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) - - 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 = _convert_request(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) - 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) - - 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 - ) -> _models.LocalRulestackResource: - """Get a LocalRulestackResource. - - :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 - :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 = { - 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.LocalRulestackResource] = kwargs.pop("cls", None) - - 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) - - _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("LocalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" - } - - async def _create_or_update_initial( - self, - resource_group_name: str, - local_rulestack_name: str, - resource: Union[_models.LocalRulestackResource, IO], - **kwargs: Any - ) -> _models.LocalRulestackResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LocalRulestackResource] = 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, "LocalRulestackResource") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - local_rulestack_name=local_rulestack_name, - subscription_id=self._config.subscription_id, - 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) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("LocalRulestackResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("LocalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # 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, - resource_group_name: str, - local_rulestack_name: str, - resource: _models.LocalRulestackResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.LocalRulestackResource]: - """Create a LocalRulestackResource. - - :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 resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource - :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: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - local_rulestack_name: str, - resource: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.LocalRulestackResource]: - """Create a LocalRulestackResource. - - :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 resource: Resource create parameters. Required. - :type resource: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :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: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - local_rulestack_name: str, - resource: Union[_models.LocalRulestackResource, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.LocalRulestackResource]: - """Create a LocalRulestackResource. - - :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 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. - :return: An instance of AsyncLROPoller that returns either LocalRulestackResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource] - :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.LocalRulestackResource] = 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, - local_rulestack_name=local_rulestack_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("LocalRulestackResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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}" - } - - @overload - async def update( - self, - resource_group_name: str, - local_rulestack_name: str, - properties: _models.LocalRulestackResourceUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.LocalRulestackResource: - """Update a LocalRulestackResource. - - :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 properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResourceUpdate - :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: - """ - - @overload - async def update( - self, - resource_group_name: str, - local_rulestack_name: str, - properties: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.LocalRulestackResource: - """Update a LocalRulestackResource. - - :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 properties: The resource properties to be updated. Required. - :type properties: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LocalRulestackResource or the result of cls(response) - :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - local_rulestack_name: str, - properties: Union[_models.LocalRulestackResourceUpdate, IO], - **kwargs: Any - ) -> _models.LocalRulestackResource: - """Update a LocalRulestackResource. - - :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 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 - :return: LocalRulestackResource or the result of cls(response) - :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LocalRulestackResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "LocalRulestackResourceUpdate") - - request = build_update_request( - resource_group_name=resource_group_name, - local_rulestack_name=local_rulestack_name, - subscription_id=self._config.subscription_id, - 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) - - _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("LocalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - 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) - - _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, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" - } - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a LocalRulestackResource. - - :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 - :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: - """ - _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( # type: ignore - resource_group_name=resource_group_name, - local_rulestack_name=local_rulestack_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - 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.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}" - } - - async def _commit_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_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) - - _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 [202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _commit_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/commit" - } - - @distributed_trace_async - async def begin_commit( - self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Commit rulestack configuration. - - :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 - :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: - """ - _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._commit_initial( # type: ignore - resource_group_name=resource_group_name, - local_rulestack_name=local_rulestack_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.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" - } - - @distributed_trace_async - async def get_change_log( - self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> _models.Changelog: - """Get changelog. - - :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 - :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 = { - 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.Changelog] = kwargs.pop("cls", None) - - 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) - - _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("Changelog", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_change_log.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/getChangeLog" - } - - @distributed_trace_async - async def get_support_info( - self, resource_group_name: str, local_rulestack_name: str, email: Optional[str] = None, **kwargs: Any - ) -> _models.SupportInfo: - """support info 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 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 = { - 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.SupportInfo] = kwargs.pop("cls", None) - - 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) - - _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("SupportInfo", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_support_info.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/getSupportInfo" - } - - @distributed_trace_async - async def list_advanced_security_objects( - self, - resource_group_name: str, - local_rulestack_name: str, - type: Union[str, _models.AdvSecurityObjectTypeEnum], - skip: Optional[str] = None, - top: Optional[int] = None, - **kwargs: Any - ) -> _models.AdvSecurityObjectListResponse: - """Get the list of advanced security objects. - - :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 type: Known values are: "urlCustom" and "feeds". Required. - :type type: str or ~azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectTypeEnum - :param skip: Default value is None. - :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 = { - 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.AdvSecurityObjectListResponse] = kwargs.pop("cls", None) - - 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, - 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) - - _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("AdvSecurityObjectListResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_advanced_security_objects.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listAdvancedSecurityObjects" - } - - @distributed_trace_async - async def list_firewalls( - self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> _models.ListFirewallsResponse: - """List of Firewalls associated with 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 - :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 = { - 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.ListFirewallsResponse] = kwargs.pop("cls", None) - - 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) - - _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("ListFirewallsResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_firewalls.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listFirewalls" - } - - @distributed_trace_async - async def list_security_services( - self, - resource_group_name: str, - local_rulestack_name: str, - type: Union[str, _models.SecurityServicesTypeEnum], - skip: Optional[str] = None, - top: Optional[int] = None, - **kwargs: Any - ) -> _models.SecurityServicesResponse: - """List the security services 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 type: Known values are: "antiSpyware", "antiVirus", "ipsVulnerability", "urlFiltering", - "fileBlocking", and "dnsSubscription". Required. - :type type: str or ~azure.mgmt.paloaltonetworksngfw.models.SecurityServicesTypeEnum - :param skip: Default value is None. - :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 = { - 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.SecurityServicesResponse] = kwargs.pop("cls", None) - - request = build_list_security_services_request( - resource_group_name=resource_group_name, - local_rulestack_name=local_rulestack_name, - subscription_id=self._config.subscription_id, - 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) - - _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("SecurityServicesResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_security_services.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listSecurityServices" - } - - @distributed_trace_async - async def revert( # pylint: disable=inconsistent-return-statements - 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. - Required. - :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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_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) - - _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 [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - revert.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/revert" - } 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..1a08d23f4618 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,14 +1,18 @@ -# 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. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from collections.abc import MutableMapping +from io import IOBase +import json +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,21 +20,126 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +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 ..._vendor import _convert_request -from ...operations._operations import build_list_request +from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from ..._utils.serialization import Deserializer, Serializer +from ...operations._operations import ( + build_certificate_object_global_rulestack_create_or_update_request, + build_certificate_object_global_rulestack_delete_request, + build_certificate_object_global_rulestack_get_request, + build_certificate_object_global_rulestack_list_request, + build_certificate_object_local_rulestack_create_or_update_request, + build_certificate_object_local_rulestack_delete_request, + build_certificate_object_local_rulestack_get_request, + build_certificate_object_local_rulestack_list_by_local_rulestacks_request, + build_firewall_status_get_request, + build_firewall_status_list_by_firewalls_request, + build_firewalls_create_or_update_request, + build_firewalls_delete_request, + build_firewalls_get_global_rulestack_request, + build_firewalls_get_log_profile_request, + build_firewalls_get_request, + build_firewalls_get_support_info_request, + build_firewalls_list_by_resource_group_request, + build_firewalls_list_by_subscription_request, + build_firewalls_save_log_profile_request, + build_firewalls_update_request, + build_fqdn_list_global_rulestack_create_or_update_request, + build_fqdn_list_global_rulestack_delete_request, + build_fqdn_list_global_rulestack_get_request, + build_fqdn_list_global_rulestack_list_request, + build_fqdn_list_local_rulestack_create_or_update_request, + build_fqdn_list_local_rulestack_delete_request, + build_fqdn_list_local_rulestack_get_request, + build_fqdn_list_local_rulestack_list_by_local_rulestacks_request, + build_global_rulestack_commit_request, + build_global_rulestack_create_or_update_request, + build_global_rulestack_delete_request, + build_global_rulestack_get_change_log_request, + build_global_rulestack_get_request, + build_global_rulestack_list_advanced_security_objects_request, + build_global_rulestack_list_app_ids_request, + build_global_rulestack_list_countries_request, + build_global_rulestack_list_firewalls_request, + build_global_rulestack_list_predefined_url_categories_request, + build_global_rulestack_list_request, + build_global_rulestack_list_security_services_request, + build_global_rulestack_revert_request, + build_global_rulestack_update_request, + build_local_rules_create_or_update_request, + build_local_rules_delete_request, + build_local_rules_get_counters_request, + build_local_rules_get_request, + build_local_rules_list_by_local_rulestacks_request, + build_local_rules_refresh_counters_request, + build_local_rules_reset_counters_request, + build_local_rulestacks_commit_request, + build_local_rulestacks_create_or_update_request, + build_local_rulestacks_delete_request, + build_local_rulestacks_get_change_log_request, + build_local_rulestacks_get_request, + build_local_rulestacks_get_support_info_request, + build_local_rulestacks_list_advanced_security_objects_request, + build_local_rulestacks_list_app_ids_request, + build_local_rulestacks_list_by_resource_group_request, + build_local_rulestacks_list_by_subscription_request, + build_local_rulestacks_list_countries_request, + build_local_rulestacks_list_firewalls_request, + build_local_rulestacks_list_predefined_url_categories_request, + build_local_rulestacks_list_security_services_request, + build_local_rulestacks_revert_request, + build_local_rulestacks_update_request, + build_metrics_object_firewall_create_or_update_request, + build_metrics_object_firewall_delete_request, + build_metrics_object_firewall_get_request, + build_metrics_object_firewall_list_by_firewalls_request, + build_operations_list_request, + build_palo_alto_networks_cloudngfw_operations_create_product_serial_number_request, + build_palo_alto_networks_cloudngfw_operations_list_cloud_manager_tenants_request, + build_palo_alto_networks_cloudngfw_operations_list_product_serial_number_status_request, + build_palo_alto_networks_cloudngfw_operations_list_support_info_request, + build_post_rules_create_or_update_request, + build_post_rules_delete_request, + build_post_rules_get_counters_request, + build_post_rules_get_request, + build_post_rules_list_request, + build_post_rules_refresh_counters_request, + build_post_rules_reset_counters_request, + build_pre_rules_create_or_update_request, + build_pre_rules_delete_request, + build_pre_rules_get_counters_request, + build_pre_rules_get_request, + build_pre_rules_list_request, + build_pre_rules_refresh_counters_request, + build_pre_rules_reset_counters_request, + build_prefix_list_global_rulestack_create_or_update_request, + build_prefix_list_global_rulestack_delete_request, + build_prefix_list_global_rulestack_get_request, + build_prefix_list_global_rulestack_list_request, + build_prefix_list_local_rulestack_create_or_update_request, + build_prefix_list_local_rulestack_delete_request, + build_prefix_list_local_rulestack_get_request, + build_prefix_list_local_rulestack_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]] +JSON = MutableMapping[str, Any] +List = list class Operations: @@ -43,32 +152,669 @@ class Operations: :attr:`operations` attribute. """ - models = _models - 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) + :return: An iterator like instance of Operation :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Operation], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class GlobalRulestackOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.paloaltonetworksngfw.aio.PaloAltoNetworksNgfwMgmtClient`'s + :attr:`global_rulestack` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: 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 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 + :return: GlobalRulestackResource. The GlobalRulestackResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GlobalRulestackResource] = kwargs.pop("cls", None) + + _request = build_global_rulestack_get_request( + global_rulestack_name=global_rulestack_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.GlobalRulestackResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + global_rulestack_name: str, + resource: Union[_models.GlobalRulestackResource, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_global_rulestack_create_or_update_request( + global_rulestack_name=global_rulestack_name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + global_rulestack_name: str, + resource: _models.GlobalRulestackResource, + *, + 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: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource + :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 GlobalRulestackResource. The + GlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, global_rulestack_name: str, resource: JSON, *, 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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns GlobalRulestackResource. The + GlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + 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[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 GlobalRulestackResource. The + GlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + global_rulestack_name: str, + resource: Union[_models.GlobalRulestackResource, JSON, 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 one of the following types: + GlobalRulestackResource, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns GlobalRulestackResource. The + GlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GlobalRulestackResource] = 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( + global_rulestack_name=global_rulestack_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.GlobalRulestackResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.GlobalRulestackResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.GlobalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def update( + self, + global_rulestack_name: str, + properties: _models.GlobalRulestackResourceUpdate, + *, + 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: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResourceUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: GlobalRulestackResource. The GlobalRulestackResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, global_rulestack_name: str, properties: JSON, *, 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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: GlobalRulestackResource. The GlobalRulestackResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + 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[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: GlobalRulestackResource. The GlobalRulestackResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + global_rulestack_name: str, + properties: Union[_models.GlobalRulestackResourceUpdate, JSON, 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 one of the following types: + GlobalRulestackResourceUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResourceUpdate or JSON + or IO[bytes] + :return: GlobalRulestackResource. The GlobalRulestackResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GlobalRulestackResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_global_rulestack_update_request( + global_rulestack_name=global_rulestack_name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.GlobalRulestackResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial(self, global_rulestack_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_global_rulestack_delete_request( + global_rulestack_name=global_rulestack_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete(self, global_rulestack_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Delete a GlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + global_rulestack_name=global_rulestack_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.GlobalRulestackResource"]: + """List GlobalRulestackResource resources by Tenant. + + :return: An iterator like instance of GlobalRulestackResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.GlobalRulestackResource]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -79,14 +825,17 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata["url"], + _request = build_global_rulestack_list_request( + api_version=self._config.api_version, headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -98,37 +847,10195 @@ 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 + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.GlobalRulestackResource], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _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 = _failsafe_deserialize( + _models.ErrorResponse, + 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"} + async def _commit_initial(self, global_rulestack_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_global_rulestack_commit_request( + global_rulestack_name=global_rulestack_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_commit(self, global_rulestack_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Commit rulestack configuration. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._commit_initial( + global_rulestack_name=global_rulestack_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get_change_log(self, global_rulestack_name: str, **kwargs: Any) -> _models.Changelog: + """Get changelog. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :return: Changelog. The Changelog is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.Changelog + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Changelog] = kwargs.pop("cls", None) + + _request = build_global_rulestack_get_change_log_request( + global_rulestack_name=global_rulestack_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Changelog, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_advanced_security_objects( + self, + global_rulestack_name: str, + *, + type: Union[str, _models.AdvSecurityObjectTypeEnum], + skip: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> _models.AdvSecurityObjectListResponse: + """Get the list of advanced security objects. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :keyword type: Known values are: "urlCustom" and "feeds". Required. + :paramtype type: str or ~azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectTypeEnum + :keyword skip: Default value is None. + :paramtype skip: str + :keyword top: Default value is None. + :paramtype top: int + :return: AdvSecurityObjectListResponse. The AdvSecurityObjectListResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectListResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AdvSecurityObjectListResponse] = kwargs.pop("cls", None) + + _request = build_global_rulestack_list_advanced_security_objects_request( + global_rulestack_name=global_rulestack_name, + type=type, + skip=skip, + top=top, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AdvSecurityObjectListResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_app_ids( + self, + global_rulestack_name: str, + *, + app_id_version: Optional[str] = None, + app_prefix: Optional[str] = None, + skip: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> _models.ListAppIdResponse: + """List of AppIds for GlobalRulestack ApiVersion. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :keyword app_id_version: Default value is None. + :paramtype app_id_version: str + :keyword app_prefix: Default value is None. + :paramtype app_prefix: str + :keyword skip: Default value is None. + :paramtype skip: str + :keyword top: Default value is None. + :paramtype top: int + :return: ListAppIdResponse. The ListAppIdResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.ListAppIdResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ListAppIdResponse] = kwargs.pop("cls", None) + + _request = build_global_rulestack_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ListAppIdResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_countries( + self, global_rulestack_name: str, *, skip: Optional[str] = None, top: Optional[int] = None, **kwargs: Any + ) -> _models.CountriesResponse: + """List of countries for Rulestack. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :keyword skip: Default value is None. + :paramtype skip: str + :keyword top: Default value is None. + :paramtype top: int + :return: CountriesResponse. The CountriesResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.CountriesResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CountriesResponse] = kwargs.pop("cls", None) + + _request = build_global_rulestack_list_countries_request( + global_rulestack_name=global_rulestack_name, + skip=skip, + top=top, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CountriesResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_firewalls(self, global_rulestack_name: str, **kwargs: Any) -> _models.ListFirewallsResponse: + """List of Firewalls associated with Rulestack. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :return: ListFirewallsResponse. The ListFirewallsResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.ListFirewallsResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ListFirewallsResponse] = kwargs.pop("cls", None) + + _request = build_global_rulestack_list_firewalls_request( + global_rulestack_name=global_rulestack_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ListFirewallsResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_predefined_url_categories( + self, global_rulestack_name: str, *, skip: Optional[str] = None, top: Optional[int] = None, **kwargs: Any + ) -> _models.PredefinedUrlCategoriesResponse: + """List predefined URL categories for rulestack. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :keyword skip: Default value is None. + :paramtype skip: str + :keyword top: Default value is None. + :paramtype top: int + :return: PredefinedUrlCategoriesResponse. The PredefinedUrlCategoriesResponse is compatible + with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.PredefinedUrlCategoriesResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PredefinedUrlCategoriesResponse] = kwargs.pop("cls", None) + + _request = build_global_rulestack_list_predefined_url_categories_request( + global_rulestack_name=global_rulestack_name, + skip=skip, + top=top, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PredefinedUrlCategoriesResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_security_services( + self, + global_rulestack_name: str, + *, + type: Union[str, _models.SecurityServicesTypeEnum], + skip: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> _models.SecurityServicesResponse: + """List the security services for rulestack. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :keyword type: Known values are: "antiSpyware", "antiVirus", "ipsVulnerability", + "urlFiltering", "fileBlocking", and "dnsSubscription". Required. + :paramtype type: str or ~azure.mgmt.paloaltonetworksngfw.models.SecurityServicesTypeEnum + :keyword skip: Default value is None. + :paramtype skip: str + :keyword top: Default value is None. + :paramtype top: int + :return: SecurityServicesResponse. The SecurityServicesResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SecurityServicesResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SecurityServicesResponse] = kwargs.pop("cls", None) + + _request = build_global_rulestack_list_security_services_request( + global_rulestack_name=global_rulestack_name, + type=type, + skip=skip, + top=top, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SecurityServicesResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + 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 + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_global_rulestack_revert_request( + global_rulestack_name=global_rulestack_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class CertificateObjectGlobalRulestackOperations: # 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:`certificate_object_global_rulestack` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: 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 get( + self, global_rulestack_name: str, name: str, **kwargs: Any + ) -> _models.CertificateObjectGlobalRulestackResource: + """Get a CertificateObjectGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: certificate name. Required. + :type name: str + :return: CertificateObjectGlobalRulestackResource. The CertificateObjectGlobalRulestackResource + is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CertificateObjectGlobalRulestackResource] = kwargs.pop("cls", None) + + _request = build_certificate_object_global_rulestack_get_request( + global_rulestack_name=global_rulestack_name, + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CertificateObjectGlobalRulestackResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + global_rulestack_name: str, + name: str, + resource: Union[_models.CertificateObjectGlobalRulestackResource, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_certificate_object_global_rulestack_create_or_update_request( + global_rulestack_name=global_rulestack_name, + name=name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + global_rulestack_name: str, + name: str, + resource: _models.CertificateObjectGlobalRulestackResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CertificateObjectGlobalRulestackResource]: + """Create a CertificateObjectGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: certificate name. Required. + :type name: str + :param resource: Resource create parameters. Required. + :type resource: + ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource + :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 CertificateObjectGlobalRulestackResource. + The CertificateObjectGlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + global_rulestack_name: str, + name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CertificateObjectGlobalRulestackResource]: + """Create a CertificateObjectGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: certificate name. Required. + :type name: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns CertificateObjectGlobalRulestackResource. + The CertificateObjectGlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + global_rulestack_name: str, + name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CertificateObjectGlobalRulestackResource]: + """Create a CertificateObjectGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: certificate name. Required. + :type 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 CertificateObjectGlobalRulestackResource. + The CertificateObjectGlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + global_rulestack_name: str, + name: str, + resource: Union[_models.CertificateObjectGlobalRulestackResource, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.CertificateObjectGlobalRulestackResource]: + """Create a CertificateObjectGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: certificate name. Required. + :type name: str + :param resource: Resource create parameters. Is one of the following types: + CertificateObjectGlobalRulestackResource, JSON, IO[bytes] Required. + :type resource: + ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns CertificateObjectGlobalRulestackResource. + The CertificateObjectGlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateObjectGlobalRulestackResource] = 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( + global_rulestack_name=global_rulestack_name, + name=name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CertificateObjectGlobalRulestackResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CertificateObjectGlobalRulestackResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CertificateObjectGlobalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial(self, global_rulestack_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_certificate_object_global_rulestack_delete_request( + global_rulestack_name=global_rulestack_name, + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Delete a CertificateObjectGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: certificate name. Required. + :type name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + global_rulestack_name=global_rulestack_name, + name=name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, global_rulestack_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.CertificateObjectGlobalRulestackResource"]: + """List CertificateObjectGlobalRulestackResource resources by Tenant. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :return: An iterator like instance of CertificateObjectGlobalRulestackResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CertificateObjectGlobalRulestackResource]] = 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_certificate_object_global_rulestack_list_request( + global_rulestack_name=global_rulestack_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.CertificateObjectGlobalRulestackResource], deserialized.get("value", []) + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class FqdnListGlobalRulestackOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.paloaltonetworksngfw.aio.PaloAltoNetworksNgfwMgmtClient`'s + :attr:`fqdn_list_global_rulestack` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: 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 get( + self, global_rulestack_name: str, name: str, **kwargs: Any + ) -> _models.FqdnListGlobalRulestackResource: + """Get a FqdnListGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: fqdn list name. Required. + :type name: str + :return: FqdnListGlobalRulestackResource. The FqdnListGlobalRulestackResource is compatible + with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.FqdnListGlobalRulestackResource] = kwargs.pop("cls", None) + + _request = build_fqdn_list_global_rulestack_get_request( + global_rulestack_name=global_rulestack_name, + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.FqdnListGlobalRulestackResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + global_rulestack_name: str, + name: str, + resource: Union[_models.FqdnListGlobalRulestackResource, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_fqdn_list_global_rulestack_create_or_update_request( + global_rulestack_name=global_rulestack_name, + name=name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + global_rulestack_name: str, + name: str, + resource: _models.FqdnListGlobalRulestackResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FqdnListGlobalRulestackResource]: + """Create a FqdnListGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: fqdn list name. Required. + :type name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource + :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 FqdnListGlobalRulestackResource. The + FqdnListGlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + global_rulestack_name: str, + name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FqdnListGlobalRulestackResource]: + """Create a FqdnListGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: fqdn list name. Required. + :type name: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns FqdnListGlobalRulestackResource. The + FqdnListGlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + global_rulestack_name: str, + name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FqdnListGlobalRulestackResource]: + """Create a FqdnListGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: fqdn list name. Required. + :type 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 FqdnListGlobalRulestackResource. The + FqdnListGlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + global_rulestack_name: str, + name: str, + resource: Union[_models.FqdnListGlobalRulestackResource, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.FqdnListGlobalRulestackResource]: + """Create a FqdnListGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: fqdn list name. Required. + :type name: str + :param resource: Resource create parameters. Is one of the following types: + FqdnListGlobalRulestackResource, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource or JSON + or IO[bytes] + :return: An instance of AsyncLROPoller that returns FqdnListGlobalRulestackResource. The + FqdnListGlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FqdnListGlobalRulestackResource] = 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( + global_rulestack_name=global_rulestack_name, + name=name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.FqdnListGlobalRulestackResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.FqdnListGlobalRulestackResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.FqdnListGlobalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial(self, global_rulestack_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_fqdn_list_global_rulestack_delete_request( + global_rulestack_name=global_rulestack_name, + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Delete a FqdnListGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: fqdn list name. Required. + :type name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + global_rulestack_name=global_rulestack_name, + name=name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, global_rulestack_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.FqdnListGlobalRulestackResource"]: + """List FqdnListGlobalRulestackResource resources by Tenant. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :return: An iterator like instance of FqdnListGlobalRulestackResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.FqdnListGlobalRulestackResource]] = 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_fqdn_list_global_rulestack_list_request( + global_rulestack_name=global_rulestack_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.FqdnListGlobalRulestackResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class PostRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.paloaltonetworksngfw.aio.PaloAltoNetworksNgfwMgmtClient`'s + :attr:`post_rules` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: 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 get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> _models.PostRulesResource: + """Get a PostRulesResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Post Rule priority. Required. + :type priority: str + :return: PostRulesResource. The PostRulesResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PostRulesResource] = kwargs.pop("cls", None) + + _request = build_post_rules_get_request( + global_rulestack_name=global_rulestack_name, + priority=priority, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PostRulesResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + global_rulestack_name: str, + priority: str, + resource: Union[_models.PostRulesResource, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_post_rules_create_or_update_request( + global_rulestack_name=global_rulestack_name, + priority=priority, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + global_rulestack_name: str, + priority: str, + resource: _models.PostRulesResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PostRulesResource]: + """Create a PostRulesResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Post Rule priority. Required. + :type priority: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource + :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 PostRulesResource. The PostRulesResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + global_rulestack_name: str, + priority: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PostRulesResource]: + """Create a PostRulesResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Post Rule priority. Required. + :type priority: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns PostRulesResource. The PostRulesResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + global_rulestack_name: str, + priority: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PostRulesResource]: + """Create a PostRulesResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Post Rule priority. Required. + :type priority: 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 PostRulesResource. The PostRulesResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + global_rulestack_name: str, + priority: str, + resource: Union[_models.PostRulesResource, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.PostRulesResource]: + """Create a PostRulesResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Post Rule priority. Required. + :type priority: str + :param resource: Resource create parameters. Is one of the following types: PostRulesResource, + JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns PostRulesResource. The PostRulesResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PostRulesResource] = 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( + global_rulestack_name=global_rulestack_name, + priority=priority, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PostRulesResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.PostRulesResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.PostRulesResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_post_rules_delete_request( + global_rulestack_name=global_rulestack_name, + priority=priority, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Delete a PostRulesResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Post Rule priority. Required. + :type priority: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + global_rulestack_name=global_rulestack_name, + priority=priority, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list(self, 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 + :return: An iterator like instance of PostRulesResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PostRulesResource]] = 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_post_rules_list_request( + global_rulestack_name=global_rulestack_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PostRulesResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_counters( + self, global_rulestack_name: str, priority: str, *, firewall_name: Optional[str] = None, **kwargs: Any + ) -> _models.RuleCounter: + """Get counters. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Post Rule priority. Required. + :type priority: str + :keyword firewall_name: Default value is None. + :paramtype firewall_name: str + :return: RuleCounter. The RuleCounter is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounter + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RuleCounter] = kwargs.pop("cls", None) + + _request = build_post_rules_get_counters_request( + global_rulestack_name=global_rulestack_name, + priority=priority, + firewall_name=firewall_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RuleCounter, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def refresh_counters( + self, global_rulestack_name: str, priority: str, *, firewall_name: Optional[str] = None, **kwargs: Any + ) -> None: + """Refresh counters. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Post Rule priority. Required. + :type priority: str + :keyword firewall_name: Default value is None. + :paramtype firewall_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_post_rules_refresh_counters_request( + global_rulestack_name=global_rulestack_name, + priority=priority, + firewall_name=firewall_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def reset_counters( + self, global_rulestack_name: str, priority: str, *, firewall_name: Optional[str] = None, **kwargs: Any + ) -> _models.RuleCounterReset: + """Reset counters. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Post Rule priority. Required. + :type priority: str + :keyword firewall_name: Default value is None. + :paramtype firewall_name: str + :return: RuleCounterReset. The RuleCounterReset is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounterReset + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RuleCounterReset] = kwargs.pop("cls", None) + + _request = build_post_rules_reset_counters_request( + global_rulestack_name=global_rulestack_name, + priority=priority, + firewall_name=firewall_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RuleCounterReset, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class PrefixListGlobalRulestackOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.paloaltonetworksngfw.aio.PaloAltoNetworksNgfwMgmtClient`'s + :attr:`prefix_list_global_rulestack` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: 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 get( + self, global_rulestack_name: str, name: str, **kwargs: Any + ) -> _models.PrefixListGlobalRulestackResource: + """Get a PrefixListGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: Local Rule priority. Required. + :type name: str + :return: PrefixListGlobalRulestackResource. The PrefixListGlobalRulestackResource is compatible + with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrefixListGlobalRulestackResource] = kwargs.pop("cls", None) + + _request = build_prefix_list_global_rulestack_get_request( + global_rulestack_name=global_rulestack_name, + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrefixListGlobalRulestackResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + global_rulestack_name: str, + name: str, + resource: Union[_models.PrefixListGlobalRulestackResource, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_prefix_list_global_rulestack_create_or_update_request( + global_rulestack_name=global_rulestack_name, + name=name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + global_rulestack_name: str, + name: str, + resource: _models.PrefixListGlobalRulestackResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrefixListGlobalRulestackResource]: + """Create a PrefixListGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: Local Rule priority. Required. + :type name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource + :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 PrefixListGlobalRulestackResource. The + PrefixListGlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + global_rulestack_name: str, + name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrefixListGlobalRulestackResource]: + """Create a PrefixListGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: Local Rule priority. Required. + :type name: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns PrefixListGlobalRulestackResource. The + PrefixListGlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + global_rulestack_name: str, + name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrefixListGlobalRulestackResource]: + """Create a PrefixListGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: Local Rule priority. Required. + :type 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 PrefixListGlobalRulestackResource. The + PrefixListGlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + global_rulestack_name: str, + name: str, + resource: Union[_models.PrefixListGlobalRulestackResource, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.PrefixListGlobalRulestackResource]: + """Create a PrefixListGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: Local Rule priority. Required. + :type name: str + :param resource: Resource create parameters. Is one of the following types: + PrefixListGlobalRulestackResource, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource or + JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns PrefixListGlobalRulestackResource. The + PrefixListGlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrefixListGlobalRulestackResource] = 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( + global_rulestack_name=global_rulestack_name, + name=name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PrefixListGlobalRulestackResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.PrefixListGlobalRulestackResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.PrefixListGlobalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial(self, global_rulestack_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_prefix_list_global_rulestack_delete_request( + global_rulestack_name=global_rulestack_name, + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Delete a PrefixListGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: Local Rule priority. Required. + :type name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + global_rulestack_name=global_rulestack_name, + name=name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, global_rulestack_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.PrefixListGlobalRulestackResource"]: + """List PrefixListGlobalRulestackResource resources by Tenant. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :return: An iterator like instance of PrefixListGlobalRulestackResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrefixListGlobalRulestackResource]] = 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_prefix_list_global_rulestack_list_request( + global_rulestack_name=global_rulestack_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PrefixListGlobalRulestackResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class PreRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.paloaltonetworksngfw.aio.PaloAltoNetworksNgfwMgmtClient`'s + :attr:`pre_rules` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: 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 get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> _models.PreRulesResource: + """Get a PreRulesResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Pre Rule priority. Required. + :type priority: str + :return: PreRulesResource. The PreRulesResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PreRulesResource] = kwargs.pop("cls", None) + + _request = build_pre_rules_get_request( + global_rulestack_name=global_rulestack_name, + priority=priority, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PreRulesResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + global_rulestack_name: str, + priority: str, + resource: Union[_models.PreRulesResource, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_pre_rules_create_or_update_request( + global_rulestack_name=global_rulestack_name, + priority=priority, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + global_rulestack_name: str, + priority: str, + resource: _models.PreRulesResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PreRulesResource]: + """Create a PreRulesResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Pre Rule priority. Required. + :type priority: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource + :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 PreRulesResource. The PreRulesResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + global_rulestack_name: str, + priority: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PreRulesResource]: + """Create a PreRulesResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Pre Rule priority. Required. + :type priority: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns PreRulesResource. The PreRulesResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + global_rulestack_name: str, + priority: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PreRulesResource]: + """Create a PreRulesResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Pre Rule priority. Required. + :type priority: 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 PreRulesResource. The PreRulesResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + global_rulestack_name: str, + priority: str, + resource: Union[_models.PreRulesResource, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.PreRulesResource]: + """Create a PreRulesResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Pre Rule priority. Required. + :type priority: str + :param resource: Resource create parameters. Is one of the following types: PreRulesResource, + JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns PreRulesResource. The PreRulesResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PreRulesResource] = 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( + global_rulestack_name=global_rulestack_name, + priority=priority, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PreRulesResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.PreRulesResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.PreRulesResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_pre_rules_delete_request( + global_rulestack_name=global_rulestack_name, + priority=priority, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Delete a PreRulesResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Pre Rule priority. Required. + :type priority: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + global_rulestack_name=global_rulestack_name, + priority=priority, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list(self, 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 + :return: An iterator like instance of PreRulesResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PreRulesResource]] = 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_pre_rules_list_request( + global_rulestack_name=global_rulestack_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PreRulesResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_counters( + self, global_rulestack_name: str, priority: str, *, firewall_name: Optional[str] = None, **kwargs: Any + ) -> _models.RuleCounter: + """Get counters. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Pre Rule priority. Required. + :type priority: str + :keyword firewall_name: Default value is None. + :paramtype firewall_name: str + :return: RuleCounter. The RuleCounter is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounter + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RuleCounter] = kwargs.pop("cls", None) + + _request = build_pre_rules_get_counters_request( + global_rulestack_name=global_rulestack_name, + priority=priority, + firewall_name=firewall_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RuleCounter, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def refresh_counters( + self, global_rulestack_name: str, priority: str, *, firewall_name: Optional[str] = None, **kwargs: Any + ) -> None: + """Refresh counters. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Pre Rule priority. Required. + :type priority: str + :keyword firewall_name: Default value is None. + :paramtype firewall_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_pre_rules_refresh_counters_request( + global_rulestack_name=global_rulestack_name, + priority=priority, + firewall_name=firewall_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def reset_counters( + self, global_rulestack_name: str, priority: str, *, firewall_name: Optional[str] = None, **kwargs: Any + ) -> _models.RuleCounterReset: + """Reset counters. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Pre Rule priority. Required. + :type priority: str + :keyword firewall_name: Default value is None. + :paramtype firewall_name: str + :return: RuleCounterReset. The RuleCounterReset is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounterReset + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RuleCounterReset] = kwargs.pop("cls", None) + + _request = build_pre_rules_reset_counters_request( + global_rulestack_name=global_rulestack_name, + priority=priority, + firewall_name=firewall_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RuleCounterReset, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class FirewallsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.paloaltonetworksngfw.aio.PaloAltoNetworksNgfwMgmtClient`'s + :attr:`firewalls` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: 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 get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _models.FirewallResource: + """Get a FirewallResource. + + :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: FirewallResource. The FirewallResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.FirewallResource] = kwargs.pop("cls", None) + + _request = build_firewalls_get_request( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.FirewallResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + firewall_name: str, + resource: Union[_models.FirewallResource, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_firewalls_create_or_update_request( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if 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.FirewallResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FirewallResource]: + """Create a FirewallResource. + + :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.FirewallResource + :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 FirewallResource. The FirewallResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + firewall_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FirewallResource]: + """Create a FirewallResource. + + :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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns FirewallResource. The FirewallResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] + :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.FirewallResource]: + """Create a FirewallResource. + + :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 FirewallResource. The FirewallResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] + :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.FirewallResource, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.FirewallResource]: + """Create a FirewallResource. + + :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 one of the following types: FirewallResource, + JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns FirewallResource. The FirewallResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FirewallResource] = 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.FirewallResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.FirewallResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.FirewallResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def update( + self, + resource_group_name: str, + firewall_name: str, + properties: _models.FirewallResourceUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FirewallResource: + """Update a FirewallResource. + + :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 properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResourceUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: FirewallResource. The FirewallResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + firewall_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FirewallResource: + """Update a FirewallResource. + + :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 properties: The resource properties to be updated. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: FirewallResource. The FirewallResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + firewall_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FirewallResource: + """Update a FirewallResource. + + :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 properties: The resource properties to be updated. Required. + :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 + :return: FirewallResource. The FirewallResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + firewall_name: str, + properties: Union[_models.FirewallResourceUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.FirewallResource: + """Update a FirewallResource. + + :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 properties: The resource properties to be updated. Is one of the following types: + FirewallResourceUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResourceUpdate or JSON or + IO[bytes] + :return: FirewallResource. The FirewallResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FirewallResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_firewalls_update_request( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.FirewallResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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 = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_firewalls_delete_request( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if 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 FirewallResource. + + :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 None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.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 + :return: An iterator like instance of FirewallResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.FirewallResource]] = 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_firewalls_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.FirewallResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.FirewallResource"]: + """List FirewallResource resources by subscription ID. + + :return: An iterator like instance of FirewallResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.FirewallResource]] = 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_firewalls_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.FirewallResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_global_rulestack( + self, resource_group_name: str, firewall_name: str, **kwargs: Any + ) -> _models.GlobalRulestackInfo: + """Get Global Rulestack associated with the Firewall. + + :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: GlobalRulestackInfo. The GlobalRulestackInfo is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackInfo + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GlobalRulestackInfo] = kwargs.pop("cls", None) + + _request = build_firewalls_get_global_rulestack_request( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.GlobalRulestackInfo, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_log_profile(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _models.LogSettings: + """Log Profile for Firewall. + + :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: LogSettings. The LogSettings is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LogSettings + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.LogSettings] = kwargs.pop("cls", None) + + _request = build_firewalls_get_log_profile_request( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.LogSettings, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_support_info( + self, resource_group_name: str, firewall_name: str, *, email: Optional[str] = None, **kwargs: Any + ) -> _models.SupportInfo: + """support info for firewall. + + :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 + :keyword email: email address on behalf of which this API called. Default value is None. + :paramtype email: str + :return: SupportInfo. The SupportInfo is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SupportInfo + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SupportInfo] = kwargs.pop("cls", None) + + _request = build_firewalls_get_support_info_request( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + subscription_id=self._config.subscription_id, + email=email, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SupportInfo, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def save_log_profile( + self, + resource_group_name: str, + firewall_name: str, + log_settings: Optional[_models.LogSettings] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Log Profile for Firewall. + + :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 log_settings: Default value is None. + :type log_settings: ~azure.mgmt.paloaltonetworksngfw.models.LogSettings + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def save_log_profile( + self, + resource_group_name: str, + firewall_name: str, + log_settings: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Log Profile for Firewall. + + :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 log_settings: Default value is None. + :type log_settings: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def save_log_profile( + self, + resource_group_name: str, + firewall_name: str, + log_settings: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Log Profile for Firewall. + + :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 log_settings: Default value is None. + :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 + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def save_log_profile( + self, + resource_group_name: str, + firewall_name: str, + log_settings: Optional[Union[_models.LogSettings, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> None: + """Log Profile for Firewall. + + :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 log_settings: Is one of the following types: LogSettings, JSON, IO[bytes] Default value + is None. + :type log_settings: ~azure.mgmt.paloaltonetworksngfw.models.LogSettings or JSON or IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if log_settings else None + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if log_settings else None + _content = None + if isinstance(log_settings, (IOBase, bytes)): + _content = log_settings + else: + if log_settings is not None: + _content = json.dumps(log_settings, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_firewalls_save_log_profile_request( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class LocalRulestacksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.paloaltonetworksngfw.aio.PaloAltoNetworksNgfwMgmtClient`'s + :attr:`local_rulestacks` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: 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 get( + self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any + ) -> _models.LocalRulestackResource: + """Get a LocalRulestackResource. + + :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 + :return: LocalRulestackResource. The LocalRulestackResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.LocalRulestackResource] = kwargs.pop("cls", None) + + _request = build_local_rulestacks_get_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.LocalRulestackResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + local_rulestack_name: str, + resource: Union[_models.LocalRulestackResource, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_local_rulestacks_create_or_update_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if 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, + local_rulestack_name: str, + resource: _models.LocalRulestackResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.LocalRulestackResource]: + """Create a LocalRulestackResource. + + :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 resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource + :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 LocalRulestackResource. The + LocalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + local_rulestack_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.LocalRulestackResource]: + """Create a LocalRulestackResource. + + :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 resource: Resource create parameters. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns LocalRulestackResource. The + LocalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + local_rulestack_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.LocalRulestackResource]: + """Create a LocalRulestackResource. + + :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 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 LocalRulestackResource. The + LocalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + local_rulestack_name: str, + resource: Union[_models.LocalRulestackResource, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.LocalRulestackResource]: + """Create a LocalRulestackResource. + + :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 resource: Resource create parameters. Is one of the following types: + LocalRulestackResource, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns LocalRulestackResource. The + LocalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LocalRulestackResource] = 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, + local_rulestack_name=local_rulestack_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.LocalRulestackResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.LocalRulestackResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.LocalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def update( + self, + resource_group_name: str, + local_rulestack_name: str, + properties: _models.LocalRulestackResourceUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LocalRulestackResource: + """Update a LocalRulestackResource. + + :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 properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResourceUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: LocalRulestackResource. The LocalRulestackResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + local_rulestack_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LocalRulestackResource: + """Update a LocalRulestackResource. + + :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 properties: The resource properties to be updated. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: LocalRulestackResource. The LocalRulestackResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + local_rulestack_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LocalRulestackResource: + """Update a LocalRulestackResource. + + :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 properties: The resource properties to be updated. Required. + :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 + :return: LocalRulestackResource. The LocalRulestackResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + local_rulestack_name: str, + properties: Union[_models.LocalRulestackResourceUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.LocalRulestackResource: + """Update a LocalRulestackResource. + + :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 properties: The resource properties to be updated. Is one of the following types: + LocalRulestackResourceUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResourceUpdate or JSON + or IO[bytes] + :return: LocalRulestackResource. The LocalRulestackResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LocalRulestackResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_local_rulestacks_update_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.LocalRulestackResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_local_rulestacks_delete_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if 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, local_rulestack_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a LocalRulestackResource. + + :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 + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.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 + :return: An iterator like instance of LocalRulestackResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.LocalRulestackResource]] = 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_local_rulestacks_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.LocalRulestackResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.LocalRulestackResource"]: + """List LocalRulestackResource resources by subscription ID. + + :return: An iterator like instance of LocalRulestackResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.LocalRulestackResource]] = 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_local_rulestacks_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.LocalRulestackResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _commit_initial( + self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_local_rulestacks_commit_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_commit( + self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Commit rulestack configuration. + + :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 + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._commit_initial( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get_change_log( + self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any + ) -> _models.Changelog: + """Get changelog. + + :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 + :return: Changelog. The Changelog is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.Changelog + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Changelog] = kwargs.pop("cls", None) + + _request = build_local_rulestacks_get_change_log_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Changelog, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_support_info( + self, resource_group_name: str, local_rulestack_name: str, *, email: Optional[str] = None, **kwargs: Any + ) -> _models.SupportInfo: + """support info 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 + :keyword email: email address on behalf of which this API called. Default value is None. + :paramtype email: str + :return: SupportInfo. The SupportInfo is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SupportInfo + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SupportInfo] = kwargs.pop("cls", None) + + _request = build_local_rulestacks_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SupportInfo, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_advanced_security_objects( + self, + resource_group_name: str, + local_rulestack_name: str, + *, + type: Union[str, _models.AdvSecurityObjectTypeEnum], + skip: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> _models.AdvSecurityObjectListResponse: + """Get the list of advanced security objects. + + :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 + :keyword type: Known values are: "urlCustom" and "feeds". Required. + :paramtype type: str or ~azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectTypeEnum + :keyword skip: Default value is None. + :paramtype skip: str + :keyword top: Default value is None. + :paramtype top: int + :return: AdvSecurityObjectListResponse. The AdvSecurityObjectListResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectListResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AdvSecurityObjectListResponse] = kwargs.pop("cls", None) + + _request = build_local_rulestacks_list_advanced_security_objects_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + subscription_id=self._config.subscription_id, + type=type, + skip=skip, + top=top, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AdvSecurityObjectListResponse, response.json()) + + if cls: + 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 + :keyword app_id_version: Default value is None. + :paramtype app_id_version: str + :keyword app_prefix: Default value is None. + :paramtype app_prefix: str + :keyword skip: Default value is None. + :paramtype skip: str + :keyword top: Default value is None. + :paramtype top: int + :return: An iterator like instance of str + :rtype: ~azure.core.async_paging.AsyncItemPaged[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[str]] = 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_local_rulestacks_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[str], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_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 + :keyword skip: Default value is None. + :paramtype skip: str + :keyword top: Default value is None. + :paramtype top: int + :return: An iterator like instance of Country + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.Country] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Country]] = 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_local_rulestacks_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Country], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def list_firewalls( + self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any + ) -> _models.ListFirewallsResponse: + """List of Firewalls associated with 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 + :return: ListFirewallsResponse. The ListFirewallsResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.ListFirewallsResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ListFirewallsResponse] = kwargs.pop("cls", None) + + _request = build_local_rulestacks_list_firewalls_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ListFirewallsResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @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 + :keyword skip: Default value is None. + :paramtype skip: str + :keyword top: Default value is None. + :paramtype top: int + :return: An iterator like instance of PredefinedUrlCategory + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.PredefinedUrlCategory] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PredefinedUrlCategory]] = 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_local_rulestacks_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PredefinedUrlCategory], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def list_security_services( + self, + resource_group_name: str, + local_rulestack_name: str, + *, + type: Union[str, _models.SecurityServicesTypeEnum], + skip: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> _models.SecurityServicesResponse: + """List the security services 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 + :keyword type: Known values are: "antiSpyware", "antiVirus", "ipsVulnerability", + "urlFiltering", "fileBlocking", and "dnsSubscription". Required. + :paramtype type: str or ~azure.mgmt.paloaltonetworksngfw.models.SecurityServicesTypeEnum + :keyword skip: Default value is None. + :paramtype skip: str + :keyword top: Default value is None. + :paramtype top: int + :return: SecurityServicesResponse. The SecurityServicesResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SecurityServicesResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SecurityServicesResponse] = kwargs.pop("cls", None) + + _request = build_local_rulestacks_list_security_services_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + subscription_id=self._config.subscription_id, + type=type, + skip=skip, + top=top, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SecurityServicesResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + 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. + Required. + :type resource_group_name: str + :param local_rulestack_name: LocalRulestack resource name. Required. + :type local_rulestack_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_local_rulestacks_revert_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +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. + """ + + 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 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. The MetricsObjectFirewallResource is compatible with + MutableMapping + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.MetricsObjectFirewallResource] = kwargs.pop("cls", None) + + _request = build_metrics_object_firewall_get_request( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.MetricsObjectFirewallResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + firewall_name: str, + resource: Union[_models.MetricsObjectFirewallResource, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_metrics_object_firewall_create_or_update_request( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if 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 MetricsObjectFirewallResource. The + MetricsObjectFirewallResource is compatible with MutableMapping + :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: JSON, + *, + 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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns MetricsObjectFirewallResource. The + MetricsObjectFirewallResource is compatible with MutableMapping + :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 MetricsObjectFirewallResource. The + MetricsObjectFirewallResource is compatible with MutableMapping + :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, JSON, 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 one of the following types: + MetricsObjectFirewallResource, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.MetricsObjectFirewallResource or JSON + or IO[bytes] + :return: An instance of AsyncLROPoller that returns MetricsObjectFirewallResource. The + MetricsObjectFirewallResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.MetricsObjectFirewallResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.MetricsObjectFirewallResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.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 = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_metrics_object_firewall_delete_request( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if 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 None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_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 MetricsObjectFirewallResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.MetricsObjectFirewallResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.MetricsObjectFirewallResource]] = 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_metrics_object_firewall_list_by_firewalls_request( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.MetricsObjectFirewallResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class FirewallStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.paloaltonetworksngfw.aio.PaloAltoNetworksNgfwMgmtClient`'s + :attr:`firewall_status` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: 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 get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _models.FirewallStatusResource: + """Get a FirewallStatusResource. + + :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: FirewallStatusResource. The FirewallStatusResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallStatusResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.FirewallStatusResource] = kwargs.pop("cls", None) + + _request = build_firewall_status_get_request( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.FirewallStatusResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_firewalls( + self, resource_group_name: str, firewall_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.FirewallStatusResource"]: + """List FirewallStatusResource 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 FirewallStatusResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.FirewallStatusResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.FirewallStatusResource]] = 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_firewall_status_list_by_firewalls_request( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.FirewallStatusResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class CertificateObjectLocalRulestackOperations: # 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:`certificate_object_local_rulestack` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: 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 get( + self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any + ) -> _models.CertificateObjectLocalRulestackResource: + """Get a CertificateObjectLocalRulestackResource. + + :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 name: certificate name. Required. + :type name: str + :return: CertificateObjectLocalRulestackResource. The CertificateObjectLocalRulestackResource + is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CertificateObjectLocalRulestackResource] = kwargs.pop("cls", None) + + _request = build_certificate_object_local_rulestack_get_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CertificateObjectLocalRulestackResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + local_rulestack_name: str, + name: str, + resource: Union[_models.CertificateObjectLocalRulestackResource, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_certificate_object_local_rulestack_create_or_update_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if 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, + local_rulestack_name: str, + name: str, + resource: _models.CertificateObjectLocalRulestackResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CertificateObjectLocalRulestackResource]: + """Create a CertificateObjectLocalRulestackResource. + + :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 name: certificate name. Required. + :type name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource + :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 CertificateObjectLocalRulestackResource. + The CertificateObjectLocalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + local_rulestack_name: str, + name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CertificateObjectLocalRulestackResource]: + """Create a CertificateObjectLocalRulestackResource. + + :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 name: certificate name. Required. + :type name: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns CertificateObjectLocalRulestackResource. + The CertificateObjectLocalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + local_rulestack_name: str, + name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CertificateObjectLocalRulestackResource]: + """Create a CertificateObjectLocalRulestackResource. + + :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 name: certificate name. Required. + :type 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 CertificateObjectLocalRulestackResource. + The CertificateObjectLocalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + local_rulestack_name: str, + name: str, + resource: Union[_models.CertificateObjectLocalRulestackResource, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.CertificateObjectLocalRulestackResource]: + """Create a CertificateObjectLocalRulestackResource. + + :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 name: certificate name. Required. + :type name: str + :param resource: Resource create parameters. Is one of the following types: + CertificateObjectLocalRulestackResource, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource + or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns CertificateObjectLocalRulestackResource. + The CertificateObjectLocalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateObjectLocalRulestackResource] = 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, + local_rulestack_name=local_rulestack_name, + name=name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CertificateObjectLocalRulestackResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CertificateObjectLocalRulestackResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CertificateObjectLocalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_certificate_object_local_rulestack_delete_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if 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, local_rulestack_name: str, name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a CertificateObjectLocalRulestackResource. + + :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 name: certificate name. Required. + :type name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + name=name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_local_rulestacks( + self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.CertificateObjectLocalRulestackResource"]: + """List CertificateObjectLocalRulestackResource resources by LocalRulestacks. + + :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 + :return: An iterator like instance of CertificateObjectLocalRulestackResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CertificateObjectLocalRulestackResource]] = 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_certificate_object_local_rulestack_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.CertificateObjectLocalRulestackResource], deserialized.get("value", []) + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class FqdnListLocalRulestackOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.paloaltonetworksngfw.aio.PaloAltoNetworksNgfwMgmtClient`'s + :attr:`fqdn_list_local_rulestack` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: 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 get( + self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any + ) -> _models.FqdnListLocalRulestackResource: + """Get a FqdnListLocalRulestackResource. + + :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 name: fqdn list name. Required. + :type name: str + :return: FqdnListLocalRulestackResource. The FqdnListLocalRulestackResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.FqdnListLocalRulestackResource] = kwargs.pop("cls", None) + + _request = build_fqdn_list_local_rulestack_get_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.FqdnListLocalRulestackResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + local_rulestack_name: str, + name: str, + resource: Union[_models.FqdnListLocalRulestackResource, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_fqdn_list_local_rulestack_create_or_update_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if 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, + local_rulestack_name: str, + name: str, + resource: _models.FqdnListLocalRulestackResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FqdnListLocalRulestackResource]: + """Create a FqdnListLocalRulestackResource. + + :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 name: fqdn list name. Required. + :type name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource + :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 FqdnListLocalRulestackResource. The + FqdnListLocalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + local_rulestack_name: str, + name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FqdnListLocalRulestackResource]: + """Create a FqdnListLocalRulestackResource. + + :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 name: fqdn list name. Required. + :type name: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns FqdnListLocalRulestackResource. The + FqdnListLocalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + local_rulestack_name: str, + name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FqdnListLocalRulestackResource]: + """Create a FqdnListLocalRulestackResource. + + :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 name: fqdn list name. Required. + :type 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 FqdnListLocalRulestackResource. The + FqdnListLocalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + local_rulestack_name: str, + name: str, + resource: Union[_models.FqdnListLocalRulestackResource, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.FqdnListLocalRulestackResource]: + """Create a FqdnListLocalRulestackResource. + + :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 name: fqdn list name. Required. + :type name: str + :param resource: Resource create parameters. Is one of the following types: + FqdnListLocalRulestackResource, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource or JSON + or IO[bytes] + :return: An instance of AsyncLROPoller that returns FqdnListLocalRulestackResource. The + FqdnListLocalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FqdnListLocalRulestackResource] = 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, + local_rulestack_name=local_rulestack_name, + name=name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.FqdnListLocalRulestackResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.FqdnListLocalRulestackResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.FqdnListLocalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_fqdn_list_local_rulestack_delete_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if 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, local_rulestack_name: str, name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a FqdnListLocalRulestackResource. + + :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 name: fqdn list name. Required. + :type name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + name=name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_local_rulestacks( + self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.FqdnListLocalRulestackResource"]: + """List FqdnListLocalRulestackResource resources by LocalRulestacks. + + :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 + :return: An iterator like instance of FqdnListLocalRulestackResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.FqdnListLocalRulestackResource]] = 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_fqdn_list_local_rulestack_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.FqdnListLocalRulestackResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class LocalRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.paloaltonetworksngfw.aio.PaloAltoNetworksNgfwMgmtClient`'s + :attr:`local_rules` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: 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 get( + self, resource_group_name: str, local_rulestack_name: str, priority: str, **kwargs: Any + ) -> _models.LocalRulesResource: + """Get a LocalRulesResource. + + :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 priority: Local Rule priority. Required. + :type priority: str + :return: LocalRulesResource. The LocalRulesResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.LocalRulesResource] = kwargs.pop("cls", None) + + _request = build_local_rules_get_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + priority=priority, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.LocalRulesResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + local_rulestack_name: str, + priority: str, + resource: Union[_models.LocalRulesResource, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_local_rules_create_or_update_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + priority=priority, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if 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, + local_rulestack_name: str, + priority: str, + resource: _models.LocalRulesResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.LocalRulesResource]: + """Create a LocalRulesResource. + + :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 priority: Local Rule priority. Required. + :type priority: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource + :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 LocalRulesResource. The LocalRulesResource + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + local_rulestack_name: str, + priority: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.LocalRulesResource]: + """Create a LocalRulesResource. + + :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 priority: Local Rule priority. Required. + :type priority: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns LocalRulesResource. The LocalRulesResource + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + local_rulestack_name: str, + priority: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.LocalRulesResource]: + """Create a LocalRulesResource. + + :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 priority: Local Rule priority. Required. + :type priority: 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 LocalRulesResource. The LocalRulesResource + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + local_rulestack_name: str, + priority: str, + resource: Union[_models.LocalRulesResource, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.LocalRulesResource]: + """Create a LocalRulesResource. + + :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 priority: Local Rule priority. Required. + :type priority: str + :param resource: Resource create parameters. Is one of the following types: LocalRulesResource, + JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns LocalRulesResource. The LocalRulesResource + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LocalRulesResource] = 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, + local_rulestack_name=local_rulestack_name, + priority=priority, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.LocalRulesResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.LocalRulesResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.LocalRulesResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, local_rulestack_name: str, priority: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_local_rules_delete_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + priority=priority, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if 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, local_rulestack_name: str, priority: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a LocalRulesResource. + + :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 priority: Local Rule priority. Required. + :type priority: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + priority=priority, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_local_rulestacks( + self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.LocalRulesResource"]: + """List LocalRulesResource resources by LocalRulestacks. + + :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 + :return: An iterator like instance of LocalRulesResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.LocalRulesResource]] = 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_local_rules_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.LocalRulesResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_counters( + self, + resource_group_name: str, + local_rulestack_name: str, + priority: str, + *, + firewall_name: Optional[str] = None, + **kwargs: Any + ) -> _models.RuleCounter: + """Get counters. + + :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 priority: Local Rule priority. Required. + :type priority: str + :keyword firewall_name: Default value is None. + :paramtype firewall_name: str + :return: RuleCounter. The RuleCounter is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounter + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RuleCounter] = kwargs.pop("cls", None) + + _request = build_local_rules_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RuleCounter, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def refresh_counters( + self, + resource_group_name: str, + local_rulestack_name: str, + priority: str, + *, + firewall_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """Refresh counters. + + :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 priority: Local Rule priority. Required. + :type priority: str + :keyword firewall_name: Default value is None. + :paramtype firewall_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_local_rules_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def reset_counters( + self, + resource_group_name: str, + local_rulestack_name: str, + priority: str, + *, + firewall_name: Optional[str] = None, + **kwargs: Any + ) -> _models.RuleCounterReset: + """Reset counters. + + :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 priority: Local Rule priority. Required. + :type priority: str + :keyword firewall_name: Default value is None. + :paramtype firewall_name: str + :return: RuleCounterReset. The RuleCounterReset is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounterReset + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RuleCounterReset] = kwargs.pop("cls", None) + + _request = build_local_rules_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RuleCounterReset, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class PrefixListLocalRulestackOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.paloaltonetworksngfw.aio.PaloAltoNetworksNgfwMgmtClient`'s + :attr:`prefix_list_local_rulestack` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: 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 get( + self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any + ) -> _models.PrefixListResource: + """Get a PrefixListResource. + + :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 name: Local Rule priority. Required. + :type name: str + :return: PrefixListResource. The PrefixListResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrefixListResource] = kwargs.pop("cls", None) + + _request = build_prefix_list_local_rulestack_get_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrefixListResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + local_rulestack_name: str, + name: str, + resource: Union[_models.PrefixListResource, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_prefix_list_local_rulestack_create_or_update_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if 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, + local_rulestack_name: str, + name: str, + resource: _models.PrefixListResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrefixListResource]: + """Create a PrefixListResource. + + :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 name: Local Rule priority. Required. + :type name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource + :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 PrefixListResource. The PrefixListResource + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + local_rulestack_name: str, + name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrefixListResource]: + """Create a PrefixListResource. + + :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 name: Local Rule priority. Required. + :type name: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns PrefixListResource. The PrefixListResource + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + local_rulestack_name: str, + name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrefixListResource]: + """Create a PrefixListResource. + + :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 name: Local Rule priority. Required. + :type 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 PrefixListResource. The PrefixListResource + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + local_rulestack_name: str, + name: str, + resource: Union[_models.PrefixListResource, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.PrefixListResource]: + """Create a PrefixListResource. + + :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 name: Local Rule priority. Required. + :type name: str + :param resource: Resource create parameters. Is one of the following types: PrefixListResource, + JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns PrefixListResource. The PrefixListResource + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrefixListResource] = 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, + local_rulestack_name=local_rulestack_name, + name=name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PrefixListResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.PrefixListResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.PrefixListResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_prefix_list_local_rulestack_delete_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if 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, local_rulestack_name: str, name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a PrefixListResource. + + :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 name: Local Rule priority. Required. + :type name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + name=name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_local_rulestacks( + self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.PrefixListResource"]: + """List PrefixListResource resources by LocalRulestacks. + + :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 + :return: An iterator like instance of PrefixListResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrefixListResource]] = 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_prefix_list_local_rulestack_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PrefixListResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class 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. + """ + + 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. The ProductSerialNumberRequestStatus is compatible + with MutableMapping + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ProductSerialNumberRequestStatus] = kwargs.pop("cls", None) + + _request = build_palo_alto_networks_cloudngfw_operations_create_product_serial_number_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ProductSerialNumberRequestStatus, response.json()) + + 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. The CloudManagerTenantList is compatible with MutableMapping + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CloudManagerTenantList] = kwargs.pop("cls", None) + + _request = build_palo_alto_networks_cloudngfw_operations_list_cloud_manager_tenants_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CloudManagerTenantList, response.json()) + + 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. The ProductSerialNumberStatus is compatible with + MutableMapping + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[Optional[_models.ProductSerialNumberStatus]] = kwargs.pop("cls", None) + + _request = build_palo_alto_networks_cloudngfw_operations_list_product_serial_number_status_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ProductSerialNumberStatus, response.json()) + + 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. The SupportInfoModel is compatible with MutableMapping + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SupportInfoModel] = kwargs.pop("cls", None) + + _request = build_palo_alto_networks_cloudngfw_operations_list_support_info_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SupportInfoModel, response.json()) + + 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 deleted file mode 100644 index b350aa6b3171..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_post_rules_operations.py +++ /dev/null @@ -1,737 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import 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 ..._vendor import _convert_request -from ...operations._post_rules_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_counters_request, - build_get_request, - build_list_request, - build_refresh_counters_request, - build_reset_counters_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PostRulesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.paloaltonetworksngfw.aio.PaloAltoNetworksNgfwMgmtClient`'s - :attr:`post_rules` attribute. - """ - - models = _models - - 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") - - @distributed_trace - def list(self, global_rulestack_name: str, **kwargs: Any) -> AsyncIterable["_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] - :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.PostRulesResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - 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) - - 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 = _convert_request(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) - 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) - - 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. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :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 = { - 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.PostRulesResource] = kwargs.pop("cls", None) - - 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) - - _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("PostRulesResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}" - } - - async def _create_or_update_initial( - self, global_rulestack_name: str, priority: str, resource: Union[_models.PostRulesResource, IO], **kwargs: Any - ) -> _models.PostRulesResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PostRulesResource] = 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, "PostRulesResource") - - 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) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("PostRulesResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PostRulesResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # 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, - global_rulestack_name: str, - priority: str, - resource: _models.PostRulesResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PostRulesResource]: - """Create a PostRulesResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param priority: Post Rule priority. Required. - :type priority: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource - :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: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - global_rulestack_name: str, - priority: str, - resource: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PostRulesResource]: - """Create a PostRulesResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param priority: Post Rule priority. Required. - :type priority: str - :param resource: Resource create parameters. Required. - :type resource: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :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: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, global_rulestack_name: str, priority: str, resource: Union[_models.PostRulesResource, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.PostRulesResource]: - """Create a PostRulesResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :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. - :return: An instance of AsyncLROPoller that returns either PostRulesResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource] - :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.PostRulesResource] = 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( - global_rulestack_name=global_rulestack_name, - priority=priority, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PostRulesResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, priority: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - 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) - - _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, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}" - } - - @distributed_trace_async - async def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Delete a PostRulesResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :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: - """ - _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( # type: ignore - global_rulestack_name=global_rulestack_name, - priority=priority, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - 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.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}" - } - - @distributed_trace_async - async def get_counters( - self, global_rulestack_name: str, priority: str, firewall_name: Optional[str] = None, **kwargs: Any - ) -> _models.RuleCounter: - """Get counters. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param priority: Post Rule priority. Required. - :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 = { - 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.RuleCounter] = kwargs.pop("cls", None) - - 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) - - _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("RuleCounter", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}/getCounters" - } - - @distributed_trace_async - async def refresh_counters( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, priority: str, firewall_name: Optional[str] = None, **kwargs: Any - ) -> None: - """Refresh counters. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param priority: Post Rule priority. Required. - :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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_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) - - _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 [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - refresh_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}/refreshCounters" - } - - @distributed_trace_async - async def reset_counters( - self, global_rulestack_name: str, priority: str, firewall_name: Optional[str] = None, **kwargs: Any - ) -> _models.RuleCounterReset: - """Reset counters. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param priority: Post Rule priority. Required. - :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 = { - 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.RuleCounterReset] = kwargs.pop("cls", None) - - 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) - - _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("RuleCounterReset", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - reset_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}/resetCounters" - } 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 deleted file mode 100644 index f3c54af9d87d..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_pre_rules_operations.py +++ /dev/null @@ -1,737 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import 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 ..._vendor import _convert_request -from ...operations._pre_rules_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_counters_request, - build_get_request, - build_list_request, - build_refresh_counters_request, - build_reset_counters_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PreRulesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.paloaltonetworksngfw.aio.PaloAltoNetworksNgfwMgmtClient`'s - :attr:`pre_rules` attribute. - """ - - models = _models - - 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") - - @distributed_trace - def list(self, global_rulestack_name: str, **kwargs: Any) -> AsyncIterable["_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] - :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.PreRulesResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - 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) - - 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 = _convert_request(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) - 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) - - 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. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :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 = { - 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.PreRulesResource] = kwargs.pop("cls", None) - - 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) - - _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("PreRulesResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}" - } - - async def _create_or_update_initial( - self, global_rulestack_name: str, priority: str, resource: Union[_models.PreRulesResource, IO], **kwargs: Any - ) -> _models.PreRulesResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PreRulesResource] = 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, "PreRulesResource") - - 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) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("PreRulesResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PreRulesResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # 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, - global_rulestack_name: str, - priority: str, - resource: _models.PreRulesResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PreRulesResource]: - """Create a PreRulesResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param priority: Pre Rule priority. Required. - :type priority: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource - :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: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - global_rulestack_name: str, - priority: str, - resource: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PreRulesResource]: - """Create a PreRulesResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param priority: Pre Rule priority. Required. - :type priority: str - :param resource: Resource create parameters. Required. - :type resource: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :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: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, global_rulestack_name: str, priority: str, resource: Union[_models.PreRulesResource, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.PreRulesResource]: - """Create a PreRulesResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :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. - :return: An instance of AsyncLROPoller that returns either PreRulesResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource] - :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.PreRulesResource] = 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( - global_rulestack_name=global_rulestack_name, - priority=priority, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PreRulesResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, priority: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - 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) - - _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, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}" - } - - @distributed_trace_async - async def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Delete a PreRulesResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :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: - """ - _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( # type: ignore - global_rulestack_name=global_rulestack_name, - priority=priority, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - 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.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}" - } - - @distributed_trace_async - async def get_counters( - self, global_rulestack_name: str, priority: str, firewall_name: Optional[str] = None, **kwargs: Any - ) -> _models.RuleCounter: - """Get counters. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param priority: Pre Rule priority. Required. - :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 = { - 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.RuleCounter] = kwargs.pop("cls", None) - - 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) - - _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("RuleCounter", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}/getCounters" - } - - @distributed_trace_async - async def refresh_counters( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, priority: str, firewall_name: Optional[str] = None, **kwargs: Any - ) -> None: - """Refresh counters. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param priority: Pre Rule priority. Required. - :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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_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) - - _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 [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - refresh_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}/refreshCounters" - } - - @distributed_trace_async - async def reset_counters( - self, global_rulestack_name: str, priority: str, firewall_name: Optional[str] = None, **kwargs: Any - ) -> _models.RuleCounterReset: - """Reset counters. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param priority: Pre Rule priority. Required. - :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 = { - 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.RuleCounterReset] = kwargs.pop("cls", None) - - 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) - - _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("RuleCounterReset", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - reset_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}/resetCounters" - } 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 deleted file mode 100644 index 48950b46a194..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_prefix_list_global_rulestack_operations.py +++ /dev/null @@ -1,553 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import 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 ..._vendor import _convert_request -from ...operations._prefix_list_global_rulestack_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PrefixListGlobalRulestackOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.paloaltonetworksngfw.aio.PaloAltoNetworksNgfwMgmtClient`'s - :attr:`prefix_list_global_rulestack` attribute. - """ - - models = _models - - 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") - - @distributed_trace - def list( - self, global_rulestack_name: str, **kwargs: Any - ) -> AsyncIterable["_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: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource] - :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.PrefixListGlobalRulestackResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - 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) - - 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 = _convert_request(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) - 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) - - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists"} - - @distributed_trace_async - async def get( - self, global_rulestack_name: str, name: str, **kwargs: Any - ) -> _models.PrefixListGlobalRulestackResource: - """Get a PrefixListGlobalRulestackResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :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 = { - 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.PrefixListGlobalRulestackResource] = kwargs.pop("cls", None) - - 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) - - _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("PrefixListGlobalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}" - } - - async def _create_or_update_initial( - self, - global_rulestack_name: str, - name: str, - resource: Union[_models.PrefixListGlobalRulestackResource, IO], - **kwargs: Any - ) -> _models.PrefixListGlobalRulestackResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrefixListGlobalRulestackResource] = 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, "PrefixListGlobalRulestackResource") - - 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) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("PrefixListGlobalRulestackResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PrefixListGlobalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # 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, - global_rulestack_name: str, - name: str, - resource: _models.PrefixListGlobalRulestackResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PrefixListGlobalRulestackResource]: - """Create a PrefixListGlobalRulestackResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param name: Local Rule priority. Required. - :type name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource - :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: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - global_rulestack_name: str, - name: str, - resource: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PrefixListGlobalRulestackResource]: - """Create a PrefixListGlobalRulestackResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param name: Local Rule priority. Required. - :type name: str - :param resource: Resource create parameters. Required. - :type resource: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :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: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - global_rulestack_name: str, - name: str, - resource: Union[_models.PrefixListGlobalRulestackResource, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.PrefixListGlobalRulestackResource]: - """Create a PrefixListGlobalRulestackResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :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. - :return: An instance of AsyncLROPoller that returns either PrefixListGlobalRulestackResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource] - :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.PrefixListGlobalRulestackResource] = 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( - global_rulestack_name=global_rulestack_name, - name=name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrefixListGlobalRulestackResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - 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) - - _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, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}" - } - - @distributed_trace_async - async def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Delete a PrefixListGlobalRulestackResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :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: - """ - _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( # type: ignore - global_rulestack_name=global_rulestack_name, - name=name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - 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.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}" - } 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 deleted file mode 100644 index 162c902c17f3..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_prefix_list_local_rulestack_operations.py +++ /dev/null @@ -1,588 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import 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 ..._vendor import _convert_request -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, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PrefixListLocalRulestackOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.paloaltonetworksngfw.aio.PaloAltoNetworksNgfwMgmtClient`'s - :attr:`prefix_list_local_rulestack` attribute. - """ - - models = _models - - 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") - - @distributed_trace - def list_by_local_rulestacks( - self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PrefixListResource"]: - """List PrefixListResource resources by LocalRulestacks. - - :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 - :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] - :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.PrefixListResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 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_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) - - 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 = _convert_request(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) - 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) - - 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 - ) -> _models.PrefixListResource: - """Get a PrefixListResource. - - :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 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 = { - 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.PrefixListResource] = kwargs.pop("cls", None) - - 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) - - _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("PrefixListResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}" - } - - async def _create_or_update_initial( - self, - resource_group_name: str, - local_rulestack_name: str, - name: str, - resource: Union[_models.PrefixListResource, IO], - **kwargs: Any - ) -> _models.PrefixListResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrefixListResource] = 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, "PrefixListResource") - - request = build_create_or_update_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, - 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) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("PrefixListResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PrefixListResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # 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, - resource_group_name: str, - local_rulestack_name: str, - name: str, - resource: _models.PrefixListResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PrefixListResource]: - """Create a PrefixListResource. - - :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 name: Local Rule priority. Required. - :type name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource - :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: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - local_rulestack_name: str, - name: str, - resource: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PrefixListResource]: - """Create a PrefixListResource. - - :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 name: Local Rule priority. Required. - :type name: str - :param resource: Resource create parameters. Required. - :type resource: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :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: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - local_rulestack_name: str, - name: str, - resource: Union[_models.PrefixListResource, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.PrefixListResource]: - """Create a PrefixListResource. - - :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 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. - :return: An instance of AsyncLROPoller that returns either PrefixListResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource] - :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.PrefixListResource] = 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, - local_rulestack_name=local_rulestack_name, - name=name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrefixListResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - 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) - - _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, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}" - } - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a PrefixListResource. - - :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 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: - """ - _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( # type: ignore - resource_group_name=resource_group_name, - local_rulestack_name=local_rulestack_name, - name=name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - 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.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}" - } 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..15023a9b1e61 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 @@ -2,125 +2,140 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -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 import ( # type: ignore + AdvSecurityObjectListResponse, + AdvSecurityObjectModel, + AppSeenData, + AppSeenInfo, + ApplicationInsights, + AzureResourceManagerManagedIdentityProperties, + AzureResourceManagerUserAssignedIdentity, + Category, + CertificateObject, + CertificateObjectGlobalRulestackResource, + CertificateObjectLocalRulestackResource, + Changelog, + CloudManagerTenantList, + CountriesResponse, + Country, + DNSSettings, + DestinationAddr, + EndpointConfiguration, + ErrorAdditionalInfo, + ErrorDetail, + ErrorResponse, + EventHub, + FirewallDeploymentProperties, + FirewallResource, + FirewallResourceUpdate, + FirewallResourceUpdateProperties, + FirewallStatusProperty, + FirewallStatusResource, + FqdnListGlobalRulestackResource, + FqdnListLocalRulestackResource, + FqdnObject, + FrontendSetting, + GlobalRulestackInfo, + GlobalRulestackResource, + GlobalRulestackResourceUpdate, + GlobalRulestackResourceUpdateProperties, + IPAddress, + IPAddressSpace, + ListAppIdResponse, + ListFirewallsResponse, + LocalRulesResource, + LocalRulestackResource, + LocalRulestackResourceUpdate, + LocalRulestackResourceUpdateProperties, + LogDestination, + LogSettings, + MarketplaceDetails, + MetricsObject, + MetricsObjectFirewallResource, + MonitorLog, + NameDescriptionObject, + NetworkProfile, + Operation, + OperationDisplay, + PanoramaConfig, + PanoramaStatus, + PlanData, + PostRulesResource, + PreRulesResource, + PredefinedUrlCategoriesResponse, + PredefinedUrlCategory, + PrefixListGlobalRulestackResource, + PrefixListResource, + PrefixObject, + ProductSerialNumberRequestStatus, + ProductSerialNumberStatus, + ProxyResource, + Resource, + RuleCounter, + RuleCounterReset, + RuleEntry, + RulestackDetails, + RulestackProperties, + SecurityServices, + SecurityServicesResponse, + SecurityServicesTypeList, + SourceAddr, + StorageAccount, + StrataCloudManagerConfig, + StrataCloudManagerInfo, + SupportInfo, + SupportInfoModel, + SystemData, + TagInfo, + TrackedResource, + VnetConfiguration, + VwanConfiguration, +) + +from ._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__ = [ @@ -132,11 +147,11 @@ "AzureResourceManagerManagedIdentityProperties", "AzureResourceManagerUserAssignedIdentity", "Category", + "CertificateObject", "CertificateObjectGlobalRulestackResource", - "CertificateObjectGlobalRulestackResourceListResult", "CertificateObjectLocalRulestackResource", - "CertificateObjectLocalRulestackResourceListResult", "Changelog", + "CloudManagerTenantList", "CountriesResponse", "Country", "DNSSettings", @@ -146,20 +161,18 @@ "ErrorDetail", "ErrorResponse", "EventHub", + "FirewallDeploymentProperties", "FirewallResource", - "FirewallResourceListResult", "FirewallResourceUpdate", "FirewallResourceUpdateProperties", + "FirewallStatusProperty", "FirewallStatusResource", - "FirewallStatusResourceListResult", "FqdnListGlobalRulestackResource", - "FqdnListGlobalRulestackResourceListResult", "FqdnListLocalRulestackResource", - "FqdnListLocalRulestackResourceListResult", + "FqdnObject", "FrontendSetting", "GlobalRulestackInfo", "GlobalRulestackResource", - "GlobalRulestackResourceListResult", "GlobalRulestackResourceUpdate", "GlobalRulestackResourceUpdateProperties", "IPAddress", @@ -167,44 +180,47 @@ "ListAppIdResponse", "ListFirewallsResponse", "LocalRulesResource", - "LocalRulesResourceListResult", "LocalRulestackResource", - "LocalRulestackResourceListResult", "LocalRulestackResourceUpdate", "LocalRulestackResourceUpdateProperties", "LogDestination", "LogSettings", "MarketplaceDetails", + "MetricsObject", + "MetricsObjectFirewallResource", "MonitorLog", "NameDescriptionObject", "NetworkProfile", "Operation", "OperationDisplay", - "OperationListResult", "PanoramaConfig", "PanoramaStatus", "PlanData", "PostRulesResource", - "PostRulesResourceListResult", "PreRulesResource", - "PreRulesResourceListResult", "PredefinedUrlCategoriesResponse", "PredefinedUrlCategory", "PrefixListGlobalRulestackResource", - "PrefixListGlobalRulestackResourceListResult", "PrefixListResource", - "PrefixListResourceListResult", + "PrefixObject", + "ProductSerialNumberRequestStatus", + "ProductSerialNumberStatus", "ProxyResource", "Resource", "RuleCounter", "RuleCounterReset", + "RuleEntry", "RulestackDetails", + "RulestackProperties", "SecurityServices", "SecurityServicesResponse", "SecurityServicesTypeList", "SourceAddr", "StorageAccount", + "StrataCloudManagerConfig", + "StrataCloudManagerInfo", "SupportInfo", + "SupportInfoModel", "SystemData", "TagInfo", "TrackedResource", @@ -220,6 +236,7 @@ "DecryptionRuleTypeEnum", "DefaultMode", "EgressNat", + "EnableStatus", "EnabledDNSType", "HealthStatus", "LogOption", @@ -228,14 +245,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/_palo_alto_networks_ngfw_mgmt_client_enums.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_enums.py similarity index 80% rename from sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_palo_alto_networks_ngfw_mgmt_client_enums.py rename to sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_enums.py index 58c50e2a512c..2f4d7ffe6a74 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/_enums.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -11,7 +11,7 @@ class ActionEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ActionEnum.""" + """Type of ActionEnum.""" ALLOW = "Allow" DENY_SILENT = "DenySilent" @@ -20,13 +20,16 @@ class ActionEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" + """Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal + only APIs. + """ INTERNAL = "Internal" + """Actions are for internal-only APIs.""" class AdvSecurityObjectTypeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AdvSecurityObjectTypeEnum.""" + """Type of AdvSecurityObjectTypeEnum.""" URL_CUSTOM = "urlCustom" FEEDS = "feeds" @@ -47,16 +50,20 @@ class BooleanEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" + """The kind of entity that created the resource.""" USER = "User" + """The entity was created by a user.""" APPLICATION = "Application" + """The entity was created by an application.""" MANAGED_IDENTITY = "ManagedIdentity" + """The entity was created by a managed identity.""" KEY = "Key" + """The entity was created by a key.""" class DecryptionRuleTypeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """DecryptionRuleTypeEnum.""" + """Type of DecryptionRuleTypeEnum.""" SSL_OUTBOUND_INSPECTION = "SSLOutboundInspection" SSL_INBOUND_INSPECTION = "SSLInboundInspection" @@ -92,6 +99,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.""" @@ -152,8 +166,18 @@ class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ USER = "user" + """Indicates the operation is initiated by a user.""" SYSTEM = "system" + """Indicates the operation is initiated by a system.""" USER_SYSTEM = "user,system" + """Indicates the operation is initiated by a user or system.""" + + +class ProductSerialStatusValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """allocation status of the product serial number.""" + + ALLOCATED = "Allocated" + IN_PROGRESS = "InProgress" class ProtocolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -185,16 +209,22 @@ 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.""" LOCAL = "LOCAL" GLOBAL = "GLOBAL" - GLOBAL_ENUM = "GLOBAL" class SecurityServicesTypeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """SecurityServicesTypeEnum.""" + """Type of SecurityServicesTypeEnum.""" ANTI_SPYWARE = "antiSpyware" ANTI_VIRUS = "antiVirus" diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_models.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_models.py new file mode 100644 index 000000000000..7561f6a291e7 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_models.py @@ -0,0 +1,4651 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=useless-super-delegation + +import datetime +from typing import Any, Mapping, Optional, TYPE_CHECKING, Union, overload + +from .._utils.model_base import Model as _Model, rest_field + +if TYPE_CHECKING: + from .. import models as _models + + +class AdvSecurityObjectListResponse(_Model): + """advanced security object. + + :ivar value: response value. Required. + :vartype value: ~azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectModel + :ivar next_link: next link. + :vartype next_link: str + """ + + value: "_models.AdvSecurityObjectModel" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """response value. Required.""" + next_link: Optional[str] = rest_field(name="nextLink", visibility=["read", "create", "update", "delete", "query"]) + """next link.""" + + @overload + def __init__( + self, + *, + value: "_models.AdvSecurityObjectModel", + next_link: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AdvSecurityObjectModel(_Model): + """List of custom and predefined url category. + + :ivar type: type of object. + :vartype type: str + :ivar entry: URL entry. Required. + :vartype entry: list[~azure.mgmt.paloaltonetworksngfw.models.NameDescriptionObject] + """ + + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """type of object.""" + entry: list["_models.NameDescriptionObject"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """URL entry. Required.""" + + @overload + def __init__( + self, + *, + entry: list["_models.NameDescriptionObject"], + type: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApplicationInsights(_Model): + """Application Insights key. + + :ivar id: Resource id for Application Insights. + :vartype id: str + :ivar key: Application Insights key. + :vartype key: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource id for Application Insights.""" + key: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Application Insights key.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + key: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AppSeenData(_Model): + """Data Type for App Seen. + + :ivar count: number of rows. Required. + :vartype count: int + :ivar app_seen_list: array of appSeen. Required. + :vartype app_seen_list: list[~azure.mgmt.paloaltonetworksngfw.models.AppSeenInfo] + """ + + count: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """number of rows. Required.""" + app_seen_list: list["_models.AppSeenInfo"] = rest_field( + name="appSeenList", visibility=["read", "create", "update", "delete", "query"] + ) + """array of appSeen. Required.""" + + @overload + def __init__( + self, + *, + count: int, + app_seen_list: list["_models.AppSeenInfo"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AppSeenInfo(_Model): + """Definition for App Seen. + + :ivar title: title. Required. + :vartype title: str + :ivar category: category. Required. + :vartype category: str + :ivar sub_category: subCategory. Required. + :vartype sub_category: str + :ivar risk: risk. Required. + :vartype risk: str + :ivar tag: tag. Required. + :vartype tag: str + :ivar technology: technology. Required. + :vartype technology: str + :ivar standard_ports: standardPorts. Required. + :vartype standard_ports: str + """ + + title: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """title. Required.""" + category: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """category. Required.""" + sub_category: str = rest_field(name="subCategory", visibility=["read", "create", "update", "delete", "query"]) + """subCategory. Required.""" + risk: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """risk. Required.""" + tag: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """tag. Required.""" + technology: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """technology. Required.""" + standard_ports: str = rest_field(name="standardPorts", visibility=["read", "create", "update", "delete", "query"]) + """standardPorts. Required.""" + + @overload + def __init__( + self, + *, + title: str, + category: str, + sub_category: str, + risk: str, + tag: str, + technology: str, + standard_ports: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AzureResourceManagerManagedIdentityProperties(_Model): # pylint: disable=name-too-long + """The properties of the managed service identities assigned to this resource. + + :ivar tenant_id: The Active Directory tenant id of the principal. + :vartype tenant_id: str + :ivar principal_id: The active directory identifier of this principal. + :vartype principal_id: str + :ivar type: The type of managed identity assigned to this resource. Required. Known values are: + "None", "SystemAssigned", "UserAssigned", and "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.paloaltonetworksngfw.models.ManagedIdentityType + :ivar user_assigned_identities: The identities assigned to this resource by the user. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.paloaltonetworksngfw.models.AzureResourceManagerUserAssignedIdentity] + """ + + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) + """The Active Directory tenant id of the principal.""" + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The active directory identifier of this principal.""" + type: Union[str, "_models.ManagedIdentityType"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The type of managed identity assigned to this resource. Required. Known values are: \"None\", + \"SystemAssigned\", \"UserAssigned\", and \"SystemAssigned,UserAssigned\".""" + user_assigned_identities: Optional[dict[str, "_models.AzureResourceManagerUserAssignedIdentity"]] = rest_field( + name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"] + ) + """The identities assigned to this resource by the user.""" + + @overload + def __init__( + self, + *, + type: Union[str, "_models.ManagedIdentityType"], + user_assigned_identities: Optional[dict[str, "_models.AzureResourceManagerUserAssignedIdentity"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AzureResourceManagerUserAssignedIdentity(_Model): + """A managed identity assigned by the user. + + :ivar client_id: The active directory client identifier for this principal. + :vartype client_id: str + :ivar principal_id: The active directory identifier for this principal. + :vartype principal_id: str + """ + + client_id: Optional[str] = rest_field(name="clientId", visibility=["read", "create", "update", "delete", "query"]) + """The active directory client identifier for this principal.""" + principal_id: Optional[str] = rest_field( + name="principalId", visibility=["read", "create", "update", "delete", "query"] + ) + """The active directory identifier for this principal.""" + + @overload + def __init__( + self, + *, + client_id: Optional[str] = None, + principal_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Category(_Model): + """URL/EDL to match. + + :ivar url_custom: custom URL. Required. + :vartype url_custom: list[str] + :ivar feeds: feed list. Required. + :vartype feeds: list[str] + """ + + url_custom: list[str] = rest_field(name="urlCustom", visibility=["read", "create", "update", "delete", "query"]) + """custom URL. Required.""" + feeds: list[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """feed list. Required.""" + + @overload + def __init__( + self, + *, + url_custom: list[str], + feeds: list[str], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CertificateObject(_Model): + """certificate used for inbound and outbound decryption. + + :ivar certificate_signer_resource_id: Resource Id of certificate signer, to be populated only + when certificateSelfSigned is false. + :vartype certificate_signer_resource_id: str + :ivar certificate_self_signed: use certificate self signed. Required. Known values are: "TRUE" + and "FALSE". + :vartype certificate_self_signed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum + :ivar audit_comment: comment for this object. + :vartype audit_comment: str + :ivar description: user description for this object. + :vartype description: str + :ivar etag: read only string representing last create or update. + :vartype 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 + """ + + certificate_signer_resource_id: Optional[str] = rest_field( + name="certificateSignerResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Resource Id of certificate signer, to be populated only when certificateSelfSigned is false.""" + certificate_self_signed: Union[str, "_models.BooleanEnum"] = rest_field( + name="certificateSelfSigned", visibility=["read", "create", "update", "delete", "query"] + ) + """use certificate self signed. Required. Known values are: \"TRUE\" and \"FALSE\".""" + audit_comment: Optional[str] = rest_field( + name="auditComment", visibility=["read", "create", "update", "delete", "query"] + ) + """comment for this object.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """user description for this object.""" + etag: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """read only string representing last create or update.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning state of the resource. Known values are: \"Accepted\", \"Creating\", \"Updating\", + \"Deleting\", \"Succeeded\", \"Failed\", \"Canceled\", \"Deleted\", and \"NotSpecified\".""" + + @overload + def __init__( + self, + *, + certificate_self_signed: Union[str, "_models.BooleanEnum"], + certificate_signer_resource_id: Optional[str] = None, + audit_comment: Optional[str] = None, + description: Optional[str] = None, + etag: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Resource(_Model): + """Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.paloaltonetworksngfw.models.SystemData + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or + \"Microsoft.Storage/storageAccounts\".""" + system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) + """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" + + +class ProxyResource(Resource): + """Proxy Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.paloaltonetworksngfw.models.SystemData + """ + + +class CertificateObjectGlobalRulestackResource(ProxyResource): + """GlobalRulestack Certificate Object. + + :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 properties: The resource-specific properties for this resource. Required. + :vartype properties: ~azure.mgmt.paloaltonetworksngfw.models.CertificateObject + """ + + properties: "_models.CertificateObject" = rest_field(visibility=["read", "create"]) + """The resource-specific properties for this resource. Required.""" + + __flattened_items = [ + "certificate_signer_resource_id", + "certificate_self_signed", + "audit_comment", + "description", + "etag", + "provisioning_state", + ] + + @overload + def __init__( + self, + *, + properties: "_models.CertificateObject", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class CertificateObjectLocalRulestackResource(ProxyResource): + """LocalRulestack Certificate Object. + + :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 properties: The resource-specific properties for this resource. Required. + :vartype properties: ~azure.mgmt.paloaltonetworksngfw.models.CertificateObject + """ + + properties: "_models.CertificateObject" = rest_field(visibility=["read", "create"]) + """The resource-specific properties for this resource. Required.""" + + __flattened_items = [ + "certificate_signer_resource_id", + "certificate_self_signed", + "audit_comment", + "description", + "etag", + "provisioning_state", + ] + + @overload + def __init__( + self, + *, + properties: "_models.CertificateObject", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class Changelog(_Model): + """Changelog list. + + :ivar changes: list of changes. Required. + :vartype changes: list[str] + :ivar last_committed: lastCommitted timestamp. + :vartype last_committed: ~datetime.datetime + :ivar last_modified: lastModified timestamp. + :vartype last_modified: ~datetime.datetime + """ + + changes: list[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """list of changes. Required.""" + last_committed: Optional[datetime.datetime] = rest_field( + name="lastCommitted", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """lastCommitted timestamp.""" + last_modified: Optional[datetime.datetime] = rest_field( + name="lastModified", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """lastModified timestamp.""" + + @overload + def __init__( + self, + *, + changes: list[str], + last_committed: Optional[datetime.datetime] = None, + last_modified: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CloudManagerTenantList(_Model): + """Cloud Manager Tenant. + + :ivar value: List of Cloud Manager Tenants. Required. + :vartype value: list[str] + """ + + value: list[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """List of Cloud Manager Tenants. Required.""" + + @overload + def __init__( + self, + *, + value: list[str], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CountriesResponse(_Model): + """Countries Response Object. + + :ivar value: The Country items on this page. Required. + :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.Country] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + value: list["_models.Country"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The Country items on this page. Required.""" + next_link: Optional[str] = rest_field(name="nextLink", visibility=["read", "create", "update", "delete", "query"]) + """The link to the next page of items.""" + + @overload + def __init__( + self, + *, + value: list["_models.Country"], + next_link: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Country(_Model): + """Country Description. + + :ivar code: country code. Required. + :vartype code: str + :ivar description: code description. + :vartype description: str + """ + + code: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """country code. Required.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """code description.""" + + @overload + def __init__( + self, + *, + code: str, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DestinationAddr(_Model): + """destination address. + + :ivar cidrs: special value 'any'. + :vartype cidrs: list[str] + :ivar countries: list of countries. + :vartype countries: list[str] + :ivar feeds: list of feeds. + :vartype feeds: list[str] + :ivar prefix_lists: prefix list. + :vartype prefix_lists: list[str] + :ivar fqdn_lists: fqdn list. + :vartype fqdn_lists: list[str] + """ + + cidrs: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """special value 'any'.""" + countries: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """list of countries.""" + feeds: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """list of feeds.""" + prefix_lists: Optional[list[str]] = rest_field( + name="prefixLists", visibility=["read", "create", "update", "delete", "query"] + ) + """prefix list.""" + fqdn_lists: Optional[list[str]] = rest_field( + name="fqdnLists", visibility=["read", "create", "update", "delete", "query"] + ) + """fqdn list.""" + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DNSSettings(_Model): + """DNS Proxy settings for Firewall. + + :ivar enable_dns_proxy: Enable DNS proxy, disabled by default. Known values are: "DISABLED" and + "ENABLED". + :vartype enable_dns_proxy: str or ~azure.mgmt.paloaltonetworksngfw.models.DNSProxy + :ivar enabled_dns_type: Enabled DNS proxy type, disabled by default. Known values are: "CUSTOM" + and "AZURE". + :vartype enabled_dns_type: str or ~azure.mgmt.paloaltonetworksngfw.models.EnabledDNSType + :ivar dns_servers: List of IPs associated with the Firewall. + :vartype dns_servers: list[~azure.mgmt.paloaltonetworksngfw.models.IPAddress] + """ + + enable_dns_proxy: Optional[Union[str, "_models.DNSProxy"]] = rest_field( + name="enableDnsProxy", visibility=["read", "create", "update", "delete", "query"] + ) + """Enable DNS proxy, disabled by default. Known values are: \"DISABLED\" and \"ENABLED\".""" + enabled_dns_type: Optional[Union[str, "_models.EnabledDNSType"]] = rest_field( + name="enabledDnsType", visibility=["read", "create", "update", "delete", "query"] + ) + """Enabled DNS proxy type, disabled by default. Known values are: \"CUSTOM\" and \"AZURE\".""" + dns_servers: Optional[list["_models.IPAddress"]] = rest_field( + name="dnsServers", visibility=["read", "create", "update", "delete", "query"] + ) + """List of IPs associated with the Firewall.""" + + @overload + def __init__( + self, + *, + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EndpointConfiguration(_Model): + """Endpoint Configuration for frontend and backend. + + :ivar port: port ID. Required. + :vartype port: str + :ivar address: Address Space. Required. + :vartype address: ~azure.mgmt.paloaltonetworksngfw.models.IPAddress + """ + + port: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """port ID. Required.""" + address: "_models.IPAddress" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Address Space. Required.""" + + @overload + def __init__( + self, + *, + port: str, + address: "_models.IPAddress", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ErrorAdditionalInfo(_Model): + """The resource management error additional info. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + type: Optional[str] = rest_field(visibility=["read"]) + """The additional info type.""" + info: Optional[Any] = rest_field(visibility=["read"]) + """The additional info.""" + + +class ErrorDetail(_Model): + """The error detail. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.paloaltonetworksngfw.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.paloaltonetworksngfw.models.ErrorAdditionalInfo] + """ + + code: Optional[str] = rest_field(visibility=["read"]) + """The error code.""" + message: Optional[str] = rest_field(visibility=["read"]) + """The error message.""" + target: Optional[str] = rest_field(visibility=["read"]) + """The error target.""" + details: Optional[list["_models.ErrorDetail"]] = rest_field(visibility=["read"]) + """The error details.""" + additional_info: Optional[list["_models.ErrorAdditionalInfo"]] = rest_field( + name="additionalInfo", visibility=["read"] + ) + """The error additional info.""" + + +class ErrorResponse(_Model): + """Error response. + + :ivar error: The error object. + :vartype error: ~azure.mgmt.paloaltonetworksngfw.models.ErrorDetail + """ + + error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The error object.""" + + @overload + def __init__( + self, + *, + error: Optional["_models.ErrorDetail"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EventHub(_Model): + """EventHub configurations. + + :ivar id: Resource ID of EventHub. + :vartype id: str + :ivar subscription_id: Subscription Id. + :vartype subscription_id: str + :ivar name: EventHub name. + :vartype name: str + :ivar name_space: EventHub namespace. + :vartype name_space: str + :ivar policy_name: EventHub policy name. + :vartype policy_name: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource ID of EventHub.""" + subscription_id: Optional[str] = rest_field( + name="subscriptionId", visibility=["read", "create", "update", "delete", "query"] + ) + """Subscription Id.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """EventHub name.""" + name_space: Optional[str] = rest_field(name="nameSpace", visibility=["read", "create", "update", "delete", "query"]) + """EventHub namespace.""" + policy_name: Optional[str] = rest_field( + name="policyName", visibility=["read", "create", "update", "delete", "query"] + ) + """EventHub policy name.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + subscription_id: Optional[str] = None, + name: Optional[str] = None, + name_space: Optional[str] = None, + policy_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FirewallDeploymentProperties(_Model): + """Properties specific to the Firewall resource deployment. + + :ivar pan_etag: panEtag info. + :vartype pan_etag: str + :ivar network_profile: Network settings. Required. + :vartype network_profile: ~azure.mgmt.paloaltonetworksngfw.models.NetworkProfile + :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. + :vartype dns_settings: ~azure.mgmt.paloaltonetworksngfw.models.DNSSettings + :ivar front_end_settings: Frontend settings for Firewall. + :vartype front_end_settings: list[~azure.mgmt.paloaltonetworksngfw.models.FrontendSetting] + :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 + :ivar plan_data: Billing plan information. Required. + :vartype plan_data: ~azure.mgmt.paloaltonetworksngfw.models.PlanData + :ivar marketplace_details: Marketplace details. Required. + :vartype marketplace_details: ~azure.mgmt.paloaltonetworksngfw.models.MarketplaceDetails + """ + + pan_etag: Optional[str] = rest_field(name="panEtag", visibility=["read", "create", "update", "delete", "query"]) + """panEtag info.""" + network_profile: "_models.NetworkProfile" = rest_field( + name="networkProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Network settings. Required.""" + is_panorama_managed: Optional[Union[str, "_models.BooleanEnum"]] = rest_field( + name="isPanoramaManaged", visibility=["read", "create", "update", "delete", "query"] + ) + """Panorama Managed: Default is False. Default will be CloudSec managed. Known values are: + \"TRUE\" and \"FALSE\".""" + is_strata_cloud_managed: Optional[Union[str, "_models.BooleanEnum"]] = rest_field( + name="isStrataCloudManaged", visibility=["read", "create", "update", "delete", "query"] + ) + """Strata Cloud Managed: Default is False. Default will be CloudSec managed. Known values are: + \"TRUE\" and \"FALSE\".""" + panorama_config: Optional["_models.PanoramaConfig"] = rest_field( + name="panoramaConfig", visibility=["read", "create", "update", "delete", "query"] + ) + """Panorama Configuration.""" + strata_cloud_manager_config: Optional["_models.StrataCloudManagerConfig"] = rest_field( + name="strataCloudManagerConfig", visibility=["read", "create", "update", "delete", "query"] + ) + """Strata Cloud Manager Configuration, only applicable if Strata Cloud Manager is selected.""" + associated_rulestack: Optional["_models.RulestackDetails"] = rest_field( + name="associatedRulestack", visibility=["read", "create", "update", "delete", "query"] + ) + """Associated Rulestack.""" + dns_settings: "_models.DNSSettings" = rest_field( + name="dnsSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """DNS settings for Firewall. Required.""" + front_end_settings: Optional[list["_models.FrontendSetting"]] = rest_field( + name="frontEndSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Frontend settings for Firewall.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning state of the resource. Known values are: \"Accepted\", \"Creating\", \"Updating\", + \"Deleting\", \"Succeeded\", \"Failed\", \"Canceled\", \"Deleted\", and \"NotSpecified\".""" + plan_data: "_models.PlanData" = rest_field( + name="planData", visibility=["read", "create", "update", "delete", "query"] + ) + """Billing plan information. Required.""" + marketplace_details: "_models.MarketplaceDetails" = rest_field( + name="marketplaceDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Marketplace details. Required.""" + + @overload + def __init__( + self, + *, + network_profile: "_models.NetworkProfile", + dns_settings: "_models.DNSSettings", + plan_data: "_models.PlanData", + marketplace_details: "_models.MarketplaceDetails", + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TrackedResource(Resource): + """Tracked Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.paloaltonetworksngfw.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + location: str = rest_field(visibility=["read", "create"]) + """The geo-location where the resource lives. Required.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FirewallResource(TrackedResource): + """PaloAltoNetworks Firewall. + + :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 tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The resource-specific properties for this resource. Required. + :vartype properties: ~azure.mgmt.paloaltonetworksngfw.models.FirewallDeploymentProperties + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: + ~azure.mgmt.paloaltonetworksngfw.models.AzureResourceManagerManagedIdentityProperties + """ + + properties: "_models.FirewallDeploymentProperties" = rest_field(visibility=["read", "create"]) + """The resource-specific properties for this resource. Required.""" + identity: Optional["_models.AzureResourceManagerManagedIdentityProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The managed service identities assigned to this resource.""" + + __flattened_items = [ + "pan_etag", + "network_profile", + "is_panorama_managed", + "is_strata_cloud_managed", + "panorama_config", + "strata_cloud_manager_config", + "associated_rulestack", + "dns_settings", + "front_end_settings", + "provisioning_state", + "plan_data", + "marketplace_details", + ] + + @overload + def __init__( + self, + *, + location: str, + properties: "_models.FirewallDeploymentProperties", + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.AzureResourceManagerManagedIdentityProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class FirewallResourceUpdate(_Model): + """The type used for update operations of the FirewallResource. + + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: + ~azure.mgmt.paloaltonetworksngfw.models.AzureResourceManagerManagedIdentityProperties + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: The updatable properties of the FirewallResource. + :vartype properties: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResourceUpdateProperties + """ + + identity: Optional["_models.AzureResourceManagerManagedIdentityProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The managed service identities assigned to this resource.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + properties: Optional["_models.FirewallResourceUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The updatable properties of the FirewallResource.""" + + @overload + def __init__( + self, + *, + identity: Optional["_models.AzureResourceManagerManagedIdentityProperties"] = None, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.FirewallResourceUpdateProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FirewallResourceUpdateProperties(_Model): + """The updatable properties of the FirewallResource. + + :ivar pan_etag: panEtag info. + :vartype pan_etag: str + :ivar network_profile: Network settings. + :vartype network_profile: ~azure.mgmt.paloaltonetworksngfw.models.NetworkProfile + :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. + :vartype dns_settings: ~azure.mgmt.paloaltonetworksngfw.models.DNSSettings + :ivar front_end_settings: Frontend settings for Firewall. + :vartype front_end_settings: list[~azure.mgmt.paloaltonetworksngfw.models.FrontendSetting] + :ivar plan_data: Billing plan information. + :vartype plan_data: ~azure.mgmt.paloaltonetworksngfw.models.PlanData + :ivar marketplace_details: Marketplace details. + :vartype marketplace_details: ~azure.mgmt.paloaltonetworksngfw.models.MarketplaceDetails + """ + + pan_etag: Optional[str] = rest_field(name="panEtag", visibility=["read", "create", "update", "delete", "query"]) + """panEtag info.""" + network_profile: Optional["_models.NetworkProfile"] = rest_field( + name="networkProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Network settings.""" + is_panorama_managed: Optional[Union[str, "_models.BooleanEnum"]] = rest_field( + name="isPanoramaManaged", visibility=["read", "create", "update", "delete", "query"] + ) + """Panorama Managed: Default is False. Default will be CloudSec managed. Known values are: + \"TRUE\" and \"FALSE\".""" + is_strata_cloud_managed: Optional[Union[str, "_models.BooleanEnum"]] = rest_field( + name="isStrataCloudManaged", visibility=["read", "create", "update", "delete", "query"] + ) + """Strata Cloud Managed: Default is False. Default will be CloudSec managed. Known values are: + \"TRUE\" and \"FALSE\".""" + panorama_config: Optional["_models.PanoramaConfig"] = rest_field( + name="panoramaConfig", visibility=["read", "create", "update", "delete", "query"] + ) + """Panorama Configuration.""" + strata_cloud_manager_config: Optional["_models.StrataCloudManagerConfig"] = rest_field( + name="strataCloudManagerConfig", visibility=["read", "create", "update", "delete", "query"] + ) + """Strata Cloud Manager Configuration, only applicable if Strata Cloud Manager is selected.""" + associated_rulestack: Optional["_models.RulestackDetails"] = rest_field( + name="associatedRulestack", visibility=["read", "create", "update", "delete", "query"] + ) + """Associated Rulestack.""" + dns_settings: Optional["_models.DNSSettings"] = rest_field( + name="dnsSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """DNS settings for Firewall.""" + front_end_settings: Optional[list["_models.FrontendSetting"]] = rest_field( + name="frontEndSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Frontend settings for Firewall.""" + plan_data: Optional["_models.PlanData"] = rest_field( + name="planData", visibility=["read", "create", "update", "delete", "query"] + ) + """Billing plan information.""" + marketplace_details: Optional["_models.MarketplaceDetails"] = rest_field( + name="marketplaceDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Marketplace details.""" + + @overload + def __init__( + self, + *, + 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, + plan_data: Optional["_models.PlanData"] = None, + marketplace_details: Optional["_models.MarketplaceDetails"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FirewallStatusProperty(_Model): + """Firewall Status. + + :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 health_status: Current status of the Firewall. Known values are: "GREEN", "YELLOW", + "RED", and "INITIALIZING". + :vartype health_status: str or ~azure.mgmt.paloaltonetworksngfw.models.HealthStatus + :ivar health_reason: Detail description of current health of the Firewall. + :vartype health_reason: str + :ivar panorama_status: Panorama Status. + :vartype panorama_status: ~azure.mgmt.paloaltonetworksngfw.models.PanoramaStatus + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", + "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 + """ + + is_panorama_managed: Optional[Union[str, "_models.BooleanEnum"]] = rest_field( + name="isPanoramaManaged", visibility=["read"] + ) + """Panorama Managed: Default is False. Default will be CloudSec managed. Known values are: + \"TRUE\" and \"FALSE\".""" + health_status: Optional[Union[str, "_models.HealthStatus"]] = rest_field(name="healthStatus", visibility=["read"]) + """Current status of the Firewall. Known values are: \"GREEN\", \"YELLOW\", \"RED\", and + \"INITIALIZING\".""" + health_reason: Optional[str] = rest_field(name="healthReason", visibility=["read"]) + """Detail description of current health of the Firewall.""" + panorama_status: Optional["_models.PanoramaStatus"] = rest_field(name="panoramaStatus", visibility=["read"]) + """Panorama Status.""" + provisioning_state: Optional[Union[str, "_models.ReadOnlyProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning state of the resource. Known values are: \"Succeeded\", \"Failed\", and + \"Deleted\".""" + is_strata_cloud_managed: Optional[Union[str, "_models.BooleanEnum"]] = rest_field( + name="isStrataCloudManaged", visibility=["read"] + ) + """Strata Cloud Manager. Known values are: \"TRUE\" and \"FALSE\".""" + strata_cloud_manager_info: Optional["_models.StrataCloudManagerInfo"] = rest_field( + name="strataCloudManagerInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """This field is only present if Strata Cloud Manager is managing the policy for this firewall.""" + + @overload + def __init__( + self, + *, + strata_cloud_manager_info: Optional["_models.StrataCloudManagerInfo"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FirewallStatusResource(ProxyResource): + """Firewall Status. + + :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 properties: The resource-specific properties for this resource. Required. + :vartype properties: ~azure.mgmt.paloaltonetworksngfw.models.FirewallStatusProperty + """ + + properties: "_models.FirewallStatusProperty" = rest_field(visibility=["read", "create"]) + """The resource-specific properties for this resource. Required.""" + + __flattened_items = [ + "is_panorama_managed", + "health_status", + "health_reason", + "panorama_status", + "provisioning_state", + "is_strata_cloud_managed", + "strata_cloud_manager_info", + ] + + @overload + def __init__( + self, + *, + properties: "_models.FirewallStatusProperty", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class FqdnListGlobalRulestackResource(ProxyResource): + """GlobalRulestack fqdnList. + + :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 properties: The resource-specific properties for this resource. Required. + :vartype properties: ~azure.mgmt.paloaltonetworksngfw.models.FqdnObject + """ + + properties: "_models.FqdnObject" = rest_field(visibility=["read", "create"]) + """The resource-specific properties for this resource. Required.""" + + __flattened_items = ["description", "fqdn_list", "etag", "audit_comment", "provisioning_state"] + + @overload + def __init__( + self, + *, + properties: "_models.FqdnObject", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class FqdnListLocalRulestackResource(ProxyResource): + """LocalRulestack fqdnList. + + :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 properties: The resource-specific properties for this resource. Required. + :vartype properties: ~azure.mgmt.paloaltonetworksngfw.models.FqdnObject + """ + + properties: "_models.FqdnObject" = rest_field(visibility=["read", "create"]) + """The resource-specific properties for this resource. Required.""" + + __flattened_items = ["description", "fqdn_list", "etag", "audit_comment", "provisioning_state"] + + @overload + def __init__( + self, + *, + properties: "_models.FqdnObject", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class FqdnObject(_Model): + """fqdn object. + + :ivar description: fqdn object description. + :vartype description: str + :ivar fqdn_list: fqdn list. Required. + :vartype fqdn_list: list[str] + :ivar etag: etag info. + :vartype etag: str + :ivar audit_comment: comment for this object. + :vartype audit_comment: 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 + """ + + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """fqdn object description.""" + fqdn_list: list[str] = rest_field(name="fqdnList", visibility=["read", "create", "update", "delete", "query"]) + """fqdn list. Required.""" + etag: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """etag info.""" + audit_comment: Optional[str] = rest_field( + name="auditComment", visibility=["read", "create", "update", "delete", "query"] + ) + """comment for this object.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning state of the resource. Known values are: \"Accepted\", \"Creating\", \"Updating\", + \"Deleting\", \"Succeeded\", \"Failed\", \"Canceled\", \"Deleted\", and \"NotSpecified\".""" + + @overload + def __init__( + self, + *, + fqdn_list: list[str], + description: Optional[str] = None, + etag: Optional[str] = None, + audit_comment: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FrontendSetting(_Model): + """Frontend setting for Firewall. + + :ivar name: Settings name. Required. + :vartype name: str + :ivar protocol: Protocol Type. Required. Known values are: "TCP" and "UDP". + :vartype protocol: str or ~azure.mgmt.paloaltonetworksngfw.models.ProtocolType + :ivar frontend_configuration: Frontend configurations. Required. + :vartype frontend_configuration: ~azure.mgmt.paloaltonetworksngfw.models.EndpointConfiguration + :ivar backend_configuration: Backend configurations. Required. + :vartype backend_configuration: ~azure.mgmt.paloaltonetworksngfw.models.EndpointConfiguration + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Settings name. Required.""" + protocol: Union[str, "_models.ProtocolType"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Protocol Type. Required. Known values are: \"TCP\" and \"UDP\".""" + frontend_configuration: "_models.EndpointConfiguration" = rest_field( + name="frontendConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """Frontend configurations. Required.""" + backend_configuration: "_models.EndpointConfiguration" = rest_field( + name="backendConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """Backend configurations. Required.""" + + @overload + def __init__( + self, + *, + name: str, + protocol: Union[str, "_models.ProtocolType"], + frontend_configuration: "_models.EndpointConfiguration", + backend_configuration: "_models.EndpointConfiguration", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GlobalRulestackInfo(_Model): + """PAN Rulestack Describe Object. + + :ivar azure_id: rulestack description. Required. + :vartype azure_id: str + """ + + azure_id: str = rest_field(name="azureId", visibility=["read", "create", "update", "delete", "query"]) + """rulestack description. Required.""" + + @overload + def __init__( + self, + *, + azure_id: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GlobalRulestackResource(ProxyResource): + """PaloAltoNetworks GlobalRulestack. + + :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 properties: The resource-specific properties for this resource. Required. + :vartype properties: ~azure.mgmt.paloaltonetworksngfw.models.RulestackProperties + :ivar location: Global Location. Required. + :vartype location: str + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: + ~azure.mgmt.paloaltonetworksngfw.models.AzureResourceManagerManagedIdentityProperties + """ + + properties: "_models.RulestackProperties" = rest_field(visibility=["read", "create"]) + """The resource-specific properties for this resource. Required.""" + location: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Global Location. Required.""" + identity: Optional["_models.AzureResourceManagerManagedIdentityProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The managed service identities assigned to this resource.""" + + __flattened_items = [ + "pan_etag", + "pan_location", + "scope", + "associated_subscriptions", + "description", + "default_mode", + "min_app_id_version", + "provisioning_state", + "security_services", + ] + + @overload + def __init__( + self, + *, + properties: "_models.RulestackProperties", + location: str, + identity: Optional["_models.AzureResourceManagerManagedIdentityProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class GlobalRulestackResourceUpdate(_Model): + """The type used for update operations of the GlobalRulestackResource. + + :ivar location: Global Location. + :vartype location: str + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: + ~azure.mgmt.paloaltonetworksngfw.models.AzureResourceManagerManagedIdentityProperties + :ivar properties: The updatable properties of the GlobalRulestackResource. + :vartype properties: + ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResourceUpdateProperties + """ + + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Global Location.""" + identity: Optional["_models.AzureResourceManagerManagedIdentityProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The managed service identities assigned to this resource.""" + properties: Optional["_models.GlobalRulestackResourceUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The updatable properties of the GlobalRulestackResource.""" + + @overload + def __init__( + self, + *, + location: Optional[str] = None, + identity: Optional["_models.AzureResourceManagerManagedIdentityProperties"] = None, + properties: Optional["_models.GlobalRulestackResourceUpdateProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GlobalRulestackResourceUpdateProperties(_Model): + """The updatable properties of the GlobalRulestackResource. + + :ivar pan_etag: PanEtag info. + :vartype pan_etag: str + :ivar pan_location: Rulestack Location, Required for GlobalRulestacks, Not for LocalRulestacks. + :vartype pan_location: str + :ivar scope: Rulestack Type. Known values are: "LOCAL" and "GLOBAL". + :vartype scope: str or ~azure.mgmt.paloaltonetworksngfw.models.ScopeType + :ivar associated_subscriptions: subscription scope of global rulestack. + :vartype associated_subscriptions: list[str] + :ivar description: rulestack description. + :vartype description: str + :ivar default_mode: Mode for default rules creation. Known values are: "IPS", "FIREWALL", and + "NONE". + :vartype default_mode: str or ~azure.mgmt.paloaltonetworksngfw.models.DefaultMode + :ivar min_app_id_version: minimum version. + :vartype min_app_id_version: str + :ivar security_services: Security Profile. + :vartype security_services: ~azure.mgmt.paloaltonetworksngfw.models.SecurityServices + """ + + pan_etag: Optional[str] = rest_field(name="panEtag", visibility=["read", "create", "update", "delete", "query"]) + """PanEtag info.""" + pan_location: Optional[str] = rest_field( + name="panLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """Rulestack Location, Required for GlobalRulestacks, Not for LocalRulestacks.""" + scope: Optional[Union[str, "_models.ScopeType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Rulestack Type. Known values are: \"LOCAL\" and \"GLOBAL\".""" + associated_subscriptions: Optional[list[str]] = rest_field( + name="associatedSubscriptions", visibility=["read", "create", "update", "delete", "query"] + ) + """subscription scope of global rulestack.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """rulestack description.""" + default_mode: Optional[Union[str, "_models.DefaultMode"]] = rest_field( + name="defaultMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Mode for default rules creation. Known values are: \"IPS\", \"FIREWALL\", and \"NONE\".""" + min_app_id_version: Optional[str] = rest_field( + name="minAppIdVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """minimum version.""" + security_services: Optional["_models.SecurityServices"] = rest_field( + name="securityServices", visibility=["read", "create", "update", "delete", "query"] + ) + """Security Profile.""" + + @overload + def __init__( + self, + *, + pan_etag: Optional[str] = None, + pan_location: Optional[str] = None, + scope: Optional[Union[str, "_models.ScopeType"]] = 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, + security_services: Optional["_models.SecurityServices"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class IPAddress(_Model): + """IP Address. + + :ivar resource_id: Resource Id. + :vartype resource_id: str + :ivar address: Address value. + :vartype address: str + """ + + resource_id: Optional[str] = rest_field( + name="resourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Resource Id.""" + address: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Address value.""" + + @overload + def __init__( + self, + *, + resource_id: Optional[str] = None, + address: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class IPAddressSpace(_Model): + """IP Address Space. + + :ivar resource_id: Resource Id. + :vartype resource_id: str + :ivar address_space: Address Space. + :vartype address_space: str + """ + + resource_id: Optional[str] = rest_field( + name="resourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Resource Id.""" + address_space: Optional[str] = rest_field( + name="addressSpace", visibility=["read", "create", "update", "delete", "query"] + ) + """Address Space.""" + + @overload + def __init__( + self, + *, + resource_id: Optional[str] = None, + address_space: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ListAppIdResponse(_Model): + """ListAppIdResponse. + + :ivar value: Required. + :vartype value: list[str] + :ivar next_link: + :vartype next_link: str + """ + + value: list[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + next_link: Optional[str] = rest_field(name="nextLink", visibility=["read", "create", "update", "delete", "query"]) + + @overload + def __init__( + self, + *, + value: list[str], + next_link: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ListFirewallsResponse(_Model): + """List firewalls response. + + :ivar value: firewalls list. Required. + :vartype value: list[str] + :ivar next_link: next link. + :vartype next_link: str + """ + + value: list[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """firewalls list. Required.""" + next_link: Optional[str] = rest_field(name="nextLink", visibility=["read", "create", "update", "delete", "query"]) + """next link.""" + + @overload + def __init__( + self, + *, + value: list[str], + next_link: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class LocalRulesResource(ProxyResource): + """LocalRulestack rule list. + + :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 properties: The resource-specific properties for this resource. Required. + :vartype properties: ~azure.mgmt.paloaltonetworksngfw.models.RuleEntry + """ + + properties: "_models.RuleEntry" = rest_field(visibility=["read", "create"]) + """The resource-specific properties for this resource. Required.""" + + __flattened_items = [ + "etag", + "rule_name", + "priority", + "description", + "rule_state", + "source", + "negate_source", + "destination", + "negate_destination", + "applications", + "category", + "protocol", + "protocol_port_list", + "inbound_inspection_certificate", + "audit_comment", + "action_type", + "enable_logging", + "decryption_rule_type", + "tags", + "provisioning_state", + ] + + @overload + def __init__( + self, + *, + properties: "_models.RuleEntry", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class LocalRulestackResource(TrackedResource): + """PaloAltoNetworks LocalRulestack. + + :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 tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The resource-specific properties for this resource. Required. + :vartype properties: ~azure.mgmt.paloaltonetworksngfw.models.RulestackProperties + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: + ~azure.mgmt.paloaltonetworksngfw.models.AzureResourceManagerManagedIdentityProperties + """ + + properties: "_models.RulestackProperties" = rest_field(visibility=["read", "create"]) + """The resource-specific properties for this resource. Required.""" + identity: Optional["_models.AzureResourceManagerManagedIdentityProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The managed service identities assigned to this resource.""" + + __flattened_items = [ + "pan_etag", + "pan_location", + "scope", + "associated_subscriptions", + "description", + "default_mode", + "min_app_id_version", + "provisioning_state", + "security_services", + ] + + @overload + def __init__( + self, + *, + location: str, + properties: "_models.RulestackProperties", + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.AzureResourceManagerManagedIdentityProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class LocalRulestackResourceUpdate(_Model): + """The type used for update operations of the LocalRulestackResource. + + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: + ~azure.mgmt.paloaltonetworksngfw.models.AzureResourceManagerManagedIdentityProperties + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: The updatable properties of the LocalRulestackResource. + :vartype properties: + ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResourceUpdateProperties + """ + + identity: Optional["_models.AzureResourceManagerManagedIdentityProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The managed service identities assigned to this resource.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + properties: Optional["_models.LocalRulestackResourceUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The updatable properties of the LocalRulestackResource.""" + + @overload + def __init__( + self, + *, + identity: Optional["_models.AzureResourceManagerManagedIdentityProperties"] = None, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.LocalRulestackResourceUpdateProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class LocalRulestackResourceUpdateProperties(_Model): + """The updatable properties of the LocalRulestackResource. + + :ivar pan_etag: PanEtag info. + :vartype pan_etag: str + :ivar pan_location: Rulestack Location, Required for GlobalRulestacks, Not for LocalRulestacks. + :vartype pan_location: str + :ivar scope: Rulestack Type. Known values are: "LOCAL" and "GLOBAL". + :vartype scope: str or ~azure.mgmt.paloaltonetworksngfw.models.ScopeType + :ivar associated_subscriptions: subscription scope of global rulestack. + :vartype associated_subscriptions: list[str] + :ivar description: rulestack description. + :vartype description: str + :ivar default_mode: Mode for default rules creation. Known values are: "IPS", "FIREWALL", and + "NONE". + :vartype default_mode: str or ~azure.mgmt.paloaltonetworksngfw.models.DefaultMode + :ivar min_app_id_version: minimum version. + :vartype min_app_id_version: str + :ivar security_services: Security Profile. + :vartype security_services: ~azure.mgmt.paloaltonetworksngfw.models.SecurityServices + """ + + pan_etag: Optional[str] = rest_field(name="panEtag", visibility=["read", "create", "update", "delete", "query"]) + """PanEtag info.""" + pan_location: Optional[str] = rest_field( + name="panLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """Rulestack Location, Required for GlobalRulestacks, Not for LocalRulestacks.""" + scope: Optional[Union[str, "_models.ScopeType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Rulestack Type. Known values are: \"LOCAL\" and \"GLOBAL\".""" + associated_subscriptions: Optional[list[str]] = rest_field( + name="associatedSubscriptions", visibility=["read", "create", "update", "delete", "query"] + ) + """subscription scope of global rulestack.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """rulestack description.""" + default_mode: Optional[Union[str, "_models.DefaultMode"]] = rest_field( + name="defaultMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Mode for default rules creation. Known values are: \"IPS\", \"FIREWALL\", and \"NONE\".""" + min_app_id_version: Optional[str] = rest_field( + name="minAppIdVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """minimum version.""" + security_services: Optional["_models.SecurityServices"] = rest_field( + name="securityServices", visibility=["read", "create", "update", "delete", "query"] + ) + """Security Profile.""" + + @overload + def __init__( + self, + *, + pan_etag: Optional[str] = None, + pan_location: Optional[str] = None, + scope: Optional[Union[str, "_models.ScopeType"]] = 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, + security_services: Optional["_models.SecurityServices"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class LogDestination(_Model): + """Log Destination. + + :ivar storage_configurations: Storage account configurations. + :vartype storage_configurations: ~azure.mgmt.paloaltonetworksngfw.models.StorageAccount + :ivar event_hub_configurations: Event Hub configurations. + :vartype event_hub_configurations: ~azure.mgmt.paloaltonetworksngfw.models.EventHub + :ivar monitor_configurations: Monitor Log configurations. + :vartype monitor_configurations: ~azure.mgmt.paloaltonetworksngfw.models.MonitorLog + """ + + storage_configurations: Optional["_models.StorageAccount"] = rest_field( + name="storageConfigurations", visibility=["read", "create", "update", "delete", "query"] + ) + """Storage account configurations.""" + event_hub_configurations: Optional["_models.EventHub"] = rest_field( + name="eventHubConfigurations", visibility=["read", "create", "update", "delete", "query"] + ) + """Event Hub configurations.""" + monitor_configurations: Optional["_models.MonitorLog"] = rest_field( + name="monitorConfigurations", visibility=["read", "create", "update", "delete", "query"] + ) + """Monitor Log configurations.""" + + @overload + def __init__( + self, + *, + storage_configurations: Optional["_models.StorageAccount"] = None, + event_hub_configurations: Optional["_models.EventHub"] = None, + monitor_configurations: Optional["_models.MonitorLog"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class LogSettings(_Model): + """Log Settings for Firewall. + + :ivar log_type: One of possible log type. Known values are: "TRAFFIC", "THREAT", "DECRYPTION", + "WILDFIRE", "DLP", and "AUDIT". + :vartype log_type: str or ~azure.mgmt.paloaltonetworksngfw.models.LogType + :ivar log_option: Log option SAME/INDIVIDUAL. Known values are: "SAME_DESTINATION" and + "INDIVIDUAL_DESTINATION". + :vartype log_option: str or ~azure.mgmt.paloaltonetworksngfw.models.LogOption + :ivar application_insights: Application Insight details. + :vartype application_insights: ~azure.mgmt.paloaltonetworksngfw.models.ApplicationInsights + :ivar common_destination: Common destination configurations. + :vartype common_destination: ~azure.mgmt.paloaltonetworksngfw.models.LogDestination + :ivar traffic_log_destination: Traffic destination configurations. + :vartype traffic_log_destination: ~azure.mgmt.paloaltonetworksngfw.models.LogDestination + :ivar threat_log_destination: Threat destination configurations. + :vartype threat_log_destination: ~azure.mgmt.paloaltonetworksngfw.models.LogDestination + :ivar decrypt_log_destination: Decrypt destination configurations. + :vartype decrypt_log_destination: ~azure.mgmt.paloaltonetworksngfw.models.LogDestination + """ + + log_type: Optional[Union[str, "_models.LogType"]] = rest_field( + name="logType", visibility=["read", "create", "update", "delete", "query"] + ) + """One of possible log type. Known values are: \"TRAFFIC\", \"THREAT\", \"DECRYPTION\", + \"WILDFIRE\", \"DLP\", and \"AUDIT\".""" + log_option: Optional[Union[str, "_models.LogOption"]] = rest_field( + name="logOption", visibility=["read", "create", "update", "delete", "query"] + ) + """Log option SAME/INDIVIDUAL. Known values are: \"SAME_DESTINATION\" and + \"INDIVIDUAL_DESTINATION\".""" + application_insights: Optional["_models.ApplicationInsights"] = rest_field( + name="applicationInsights", visibility=["read", "create", "update", "delete", "query"] + ) + """Application Insight details.""" + common_destination: Optional["_models.LogDestination"] = rest_field( + name="commonDestination", visibility=["read", "create", "update", "delete", "query"] + ) + """Common destination configurations.""" + traffic_log_destination: Optional["_models.LogDestination"] = rest_field( + name="trafficLogDestination", visibility=["read", "create", "update", "delete", "query"] + ) + """Traffic destination configurations.""" + threat_log_destination: Optional["_models.LogDestination"] = rest_field( + name="threatLogDestination", visibility=["read", "create", "update", "delete", "query"] + ) + """Threat destination configurations.""" + decrypt_log_destination: Optional["_models.LogDestination"] = rest_field( + name="decryptLogDestination", visibility=["read", "create", "update", "delete", "query"] + ) + """Decrypt destination configurations.""" + + @overload + def __init__( + self, + *, + log_type: Optional[Union[str, "_models.LogType"]] = None, + log_option: Optional[Union[str, "_models.LogOption"]] = None, + application_insights: Optional["_models.ApplicationInsights"] = None, + common_destination: Optional["_models.LogDestination"] = None, + traffic_log_destination: Optional["_models.LogDestination"] = None, + threat_log_destination: Optional["_models.LogDestination"] = None, + decrypt_log_destination: Optional["_models.LogDestination"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MarketplaceDetails(_Model): + """MarketplaceDetails of PAN Firewall resource. + + :ivar marketplace_subscription_id: Marketplace Subscription Id. + :vartype marketplace_subscription_id: str + :ivar offer_id: Offer Id. Required. + :vartype offer_id: str + :ivar publisher_id: Publisher Id. Required. + :vartype publisher_id: str + :ivar marketplace_subscription_status: Marketplace Subscription Status. Known values are: + "PendingFulfillmentStart", "Subscribed", "Suspended", "Unsubscribed", "NotStarted", and + "FulfillmentRequested". + :vartype marketplace_subscription_status: str or + ~azure.mgmt.paloaltonetworksngfw.models.MarketplaceSubscriptionStatus + """ + + marketplace_subscription_id: Optional[str] = rest_field(name="marketplaceSubscriptionId", visibility=["read"]) + """Marketplace Subscription Id.""" + offer_id: str = rest_field(name="offerId", visibility=["read", "create", "update", "delete", "query"]) + """Offer Id. Required.""" + publisher_id: str = rest_field(name="publisherId", visibility=["read", "create", "update", "delete", "query"]) + """Publisher Id. Required.""" + marketplace_subscription_status: Optional[Union[str, "_models.MarketplaceSubscriptionStatus"]] = rest_field( + name="marketplaceSubscriptionStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """Marketplace Subscription Status. Known values are: \"PendingFulfillmentStart\", \"Subscribed\", + \"Suspended\", \"Unsubscribed\", \"NotStarted\", and \"FulfillmentRequested\".""" + + @overload + def __init__( + self, + *, + offer_id: str, + publisher_id: str, + marketplace_subscription_status: Optional[Union[str, "_models.MarketplaceSubscriptionStatus"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MetricsObject(_Model): + """Config for Metrics for firewall metrics. + + :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 + """ + + application_insights_resource_id: str = rest_field( + name="applicationInsightsResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Resource Id of application insights resource. Required.""" + application_insights_connection_string: str = rest_field( + name="applicationInsightsConnectionString", visibility=["read", "create", "update", "delete", "query"] + ) + """Connection string of application insights resource. Required.""" + pan_etag: Optional[str] = rest_field(name="panEtag", visibility=["read", "create", "update", "delete", "query"]) + """read only string representing last create or update.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning state of the resource. Known values are: \"Accepted\", \"Creating\", \"Updating\", + \"Deleting\", \"Succeeded\", \"Failed\", \"Canceled\", \"Deleted\", and \"NotSpecified\".""" + + @overload + def __init__( + self, + *, + application_insights_resource_id: str, + application_insights_connection_string: str, + pan_etag: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MetricsObjectFirewallResource(ProxyResource): + """Firewall Metrics Object. + + :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 properties: The resource-specific properties for this resource. Required. + :vartype properties: ~azure.mgmt.paloaltonetworksngfw.models.MetricsObject + """ + + properties: "_models.MetricsObject" = rest_field(visibility=["read", "create"]) + """The resource-specific properties for this resource. Required.""" + + __flattened_items = [ + "application_insights_resource_id", + "application_insights_connection_string", + "pan_etag", + "provisioning_state", + ] + + @overload + def __init__( + self, + *, + properties: "_models.MetricsObject", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class MonitorLog(_Model): + """MonitorLog configurations. + + :ivar id: Resource ID of MonitorLog. + :vartype id: str + :ivar subscription_id: Subscription Id. + :vartype subscription_id: str + :ivar workspace: MonitorLog workspace. + :vartype workspace: str + :ivar primary_key: Primary Key value for Monitor. + :vartype primary_key: str + :ivar secondary_key: Secondary Key value for Monitor. + :vartype secondary_key: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource ID of MonitorLog.""" + subscription_id: Optional[str] = rest_field( + name="subscriptionId", visibility=["read", "create", "update", "delete", "query"] + ) + """Subscription Id.""" + workspace: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """MonitorLog workspace.""" + primary_key: Optional[str] = rest_field( + name="primaryKey", visibility=["read", "create", "update", "delete", "query"] + ) + """Primary Key value for Monitor.""" + secondary_key: Optional[str] = rest_field( + name="secondaryKey", visibility=["read", "create", "update", "delete", "query"] + ) + """Secondary Key value for Monitor.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + subscription_id: Optional[str] = None, + workspace: Optional[str] = None, + primary_key: Optional[str] = None, + secondary_key: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NameDescriptionObject(_Model): + """object type info. + + :ivar name: name value. Required. + :vartype name: str + :ivar description: description value. + :vartype description: str + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """name value. Required.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """description value.""" + + @overload + def __init__( + self, + *, + name: str, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NetworkProfile(_Model): + """Network settings for Firewall. + + :ivar vnet_configuration: Vnet configurations. + :vartype vnet_configuration: ~azure.mgmt.paloaltonetworksngfw.models.VnetConfiguration + :ivar vwan_configuration: Vwan configurations. + :vartype vwan_configuration: ~azure.mgmt.paloaltonetworksngfw.models.VwanConfiguration + :ivar network_type: vnet or vwan, cannot be updated. Required. Known values are: "VNET" and + "VWAN". + :vartype network_type: str or ~azure.mgmt.paloaltonetworksngfw.models.NetworkType + :ivar public_ips: List of IPs associated with the Firewall. Required. + :vartype public_ips: list[~azure.mgmt.paloaltonetworksngfw.models.IPAddress] + :ivar enable_egress_nat: Enable egress NAT, enabled by default. Required. Known values are: + "DISABLED" and "ENABLED". + :vartype enable_egress_nat: str or ~azure.mgmt.paloaltonetworksngfw.models.EgressNat + :ivar egress_nat_ip: Egress nat IP to use. + :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] + """ + + vnet_configuration: Optional["_models.VnetConfiguration"] = rest_field( + name="vnetConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """Vnet configurations.""" + vwan_configuration: Optional["_models.VwanConfiguration"] = rest_field( + name="vwanConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """Vwan configurations.""" + network_type: Union[str, "_models.NetworkType"] = rest_field( + name="networkType", visibility=["read", "create", "update", "delete", "query"] + ) + """vnet or vwan, cannot be updated. Required. Known values are: \"VNET\" and \"VWAN\".""" + public_ips: list["_models.IPAddress"] = rest_field( + name="publicIps", visibility=["read", "create", "update", "delete", "query"] + ) + """List of IPs associated with the Firewall. Required.""" + enable_egress_nat: Union[str, "_models.EgressNat"] = rest_field( + name="enableEgressNat", visibility=["read", "create", "update", "delete", "query"] + ) + """Enable egress NAT, enabled by default. Required. Known values are: \"DISABLED\" and + \"ENABLED\".""" + egress_nat_ip: Optional[list["_models.IPAddress"]] = rest_field( + name="egressNatIp", visibility=["read", "create", "update", "delete", "query"] + ) + """Egress nat IP to use.""" + trusted_ranges: Optional[list[str]] = rest_field( + name="trustedRanges", visibility=["read", "create", "update", "delete", "query"] + ) + """Non-RFC 1918 address.""" + private_source_nat_rules_destination: Optional[list[str]] = rest_field( + name="privateSourceNatRulesDestination", visibility=["read", "create", "update", "delete", "query"] + ) + """Array of ipv4 destination address for which source NAT is to be performed.""" + + @overload + def __init__( + self, + *, + network_type: Union[str, "_models.NetworkType"], + 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, + private_source_nat_rules_destination: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Operation(_Model): + """REST API Operation. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for Azure Resource Manager/control-plane operations. + :vartype is_data_action: bool + :ivar display: Localized display information for this particular operation. + :vartype display: ~azure.mgmt.paloaltonetworksngfw.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", + and "user,system". + :vartype origin: str or ~azure.mgmt.paloaltonetworksngfw.models.Origin + :ivar action_type: Extensible enum. Indicates the action type. "Internal" refers to actions + that are for internal only APIs. "Internal" + :vartype action_type: str or ~azure.mgmt.paloaltonetworksngfw.models.ActionType + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + \"Microsoft.Compute/virtualMachines/write\", + \"Microsoft.Compute/virtualMachines/capture/action\".""" + is_data_action: Optional[bool] = rest_field(name="isDataAction", visibility=["read"]) + """Whether the operation applies to data-plane. This is \"true\" for data-plane operations and + \"false\" for Azure Resource Manager/control-plane operations.""" + display: Optional["_models.OperationDisplay"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Localized display information for this particular operation.""" + origin: Optional[Union[str, "_models.Origin"]] = rest_field(visibility=["read"]) + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is \"user,system\". Known values are: \"user\", \"system\", and + \"user,system\".""" + action_type: Optional[Union[str, "_models.ActionType"]] = rest_field(name="actionType", visibility=["read"]) + """Extensible enum. Indicates the action type. \"Internal\" refers to actions that are for + internal only APIs. \"Internal\"""" + + @overload + def __init__( + self, + *, + display: Optional["_models.OperationDisplay"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationDisplay(_Model): + """Localized display information for and operation. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str + """ + + provider: Optional[str] = rest_field(visibility=["read"]) + """The localized friendly form of the resource provider name, e.g. \"Microsoft Monitoring + Insights\" or \"Microsoft Compute\".""" + resource: Optional[str] = rest_field(visibility=["read"]) + """The localized friendly name of the resource type related to this operation. E.g. \"Virtual + Machines\" or \"Job Schedule Collections\".""" + operation: Optional[str] = rest_field(visibility=["read"]) + """The concise, localized friendly name for the operation; suitable for dropdowns. E.g. \"Create + or Update Virtual Machine\", \"Restart Virtual Machine\".""" + description: Optional[str] = rest_field(visibility=["read"]) + """The short, localized friendly description of the operation; suitable for tool tips and detailed + views.""" + + +class PanoramaConfig(_Model): + """Panorama Config. + + :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. + Required. + :vartype config_string: str + :ivar vm_auth_key: VM auth key for panorama connectivity. + :vartype vm_auth_key: str + :ivar panorama_server: Primary Panorama Server IP address value in dotted format for IPv4. + :vartype panorama_server: str + :ivar panorama_server2: Secondary Panorama Server IP address value in dotted format for IPv4. + :vartype panorama_server2: str + :ivar dg_name: Panorama Device Group to join. + :vartype dg_name: str + :ivar tpl_name: Panorama Template Stack to join - (Once configured we can not edit the value). + :vartype tpl_name: str + :ivar cg_name: Panorama Collector Group to join - (Once configured we can not edit the value). + :vartype cg_name: str + :ivar host_name: Resource name(may be unique) for PN admin. + :vartype host_name: str + """ + + config_string: str = rest_field(name="configString", visibility=["read", "create", "update", "delete", "query"]) + """Base64 encoded string representing Panorama parameters to be used by Firewall to connect to + Panorama. This string is generated via azure plugin in Panorama. Required.""" + vm_auth_key: Optional[str] = rest_field(name="vmAuthKey", visibility=["read"]) + """VM auth key for panorama connectivity.""" + panorama_server: Optional[str] = rest_field(name="panoramaServer", visibility=["read"]) + """Primary Panorama Server IP address value in dotted format for IPv4.""" + panorama_server2: Optional[str] = rest_field(name="panoramaServer2", visibility=["read"]) + """Secondary Panorama Server IP address value in dotted format for IPv4.""" + dg_name: Optional[str] = rest_field(name="dgName", visibility=["read"]) + """Panorama Device Group to join.""" + tpl_name: Optional[str] = rest_field(name="tplName", visibility=["read"]) + """Panorama Template Stack to join - (Once configured we can not edit the value).""" + cg_name: Optional[str] = rest_field(name="cgName", visibility=["read"]) + """Panorama Collector Group to join - (Once configured we can not edit the value).""" + host_name: Optional[str] = rest_field(name="hostName", visibility=["read"]) + """Resource name(may be unique) for PN admin.""" + + @overload + def __init__( + self, + *, + config_string: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PanoramaStatus(_Model): + """Panorama connectivity information. + + :ivar panorama_server_status: Primary Panorama connection status. Known values are: "UP" and + "DOWN". + :vartype panorama_server_status: str or ~azure.mgmt.paloaltonetworksngfw.models.ServerStatus + :ivar panorama_server2_status: Secondary Panorama connection status. Known values are: "UP" and + "DOWN". + :vartype panorama_server2_status: str or ~azure.mgmt.paloaltonetworksngfw.models.ServerStatus + """ + + panorama_server_status: Optional[Union[str, "_models.ServerStatus"]] = rest_field( + name="panoramaServerStatus", visibility=["read"] + ) + """Primary Panorama connection status. Known values are: \"UP\" and \"DOWN\".""" + panorama_server2_status: Optional[Union[str, "_models.ServerStatus"]] = rest_field( + name="panoramaServer2Status", visibility=["read"] + ) + """Secondary Panorama connection status. Known values are: \"UP\" and \"DOWN\".""" + + +class PlanData(_Model): + """Billing plan information. + + :ivar usage_type: different usage type like PAYG/COMMITTED. Known values are: "PAYG" and + "COMMITTED". + :vartype usage_type: str or ~azure.mgmt.paloaltonetworksngfw.models.UsageType + :ivar billing_cycle: different billing cycles like MONTHLY/WEEKLY. Required. Known values are: + "WEEKLY" and "MONTHLY". + :vartype billing_cycle: str or ~azure.mgmt.paloaltonetworksngfw.models.BillingCycle + :ivar plan_id: plan id as published by Liftr.PAN. Required. + :vartype plan_id: str + :ivar effective_date: date when plan was applied. + :vartype effective_date: ~datetime.datetime + """ + + usage_type: Optional[Union[str, "_models.UsageType"]] = rest_field( + name="usageType", visibility=["read", "create", "update", "delete", "query"] + ) + """different usage type like PAYG/COMMITTED. Known values are: \"PAYG\" and \"COMMITTED\".""" + billing_cycle: Union[str, "_models.BillingCycle"] = rest_field( + name="billingCycle", visibility=["read", "create", "update", "delete", "query"] + ) + """different billing cycles like MONTHLY/WEEKLY. Required. Known values are: \"WEEKLY\" and + \"MONTHLY\".""" + plan_id: str = rest_field(name="planId", visibility=["read", "create", "update", "delete", "query"]) + """plan id as published by Liftr.PAN. Required.""" + effective_date: Optional[datetime.datetime] = rest_field( + name="effectiveDate", visibility=["read"], format="rfc3339" + ) + """date when plan was applied.""" + + @overload + def __init__( + self, + *, + billing_cycle: Union[str, "_models.BillingCycle"], + plan_id: str, + usage_type: Optional[Union[str, "_models.UsageType"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PostRulesResource(ProxyResource): + """PostRulestack rule list. + + :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 properties: The resource-specific properties for this resource. Required. + :vartype properties: ~azure.mgmt.paloaltonetworksngfw.models.RuleEntry + """ + + properties: "_models.RuleEntry" = rest_field(visibility=["read", "create"]) + """The resource-specific properties for this resource. Required.""" + + __flattened_items = [ + "etag", + "rule_name", + "priority", + "description", + "rule_state", + "source", + "negate_source", + "destination", + "negate_destination", + "applications", + "category", + "protocol", + "protocol_port_list", + "inbound_inspection_certificate", + "audit_comment", + "action_type", + "enable_logging", + "decryption_rule_type", + "tags", + "provisioning_state", + ] + + @overload + def __init__( + self, + *, + properties: "_models.RuleEntry", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class PredefinedUrlCategoriesResponse(_Model): + """predefined url categories response. + + :ivar value: The PredefinedUrlCategory items on this page. Required. + :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.PredefinedUrlCategory] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + value: list["_models.PredefinedUrlCategory"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The PredefinedUrlCategory items on this page. Required.""" + next_link: Optional[str] = rest_field(name="nextLink", visibility=["read", "create", "update", "delete", "query"]) + """The link to the next page of items.""" + + @overload + def __init__( + self, + *, + value: list["_models.PredefinedUrlCategory"], + next_link: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PredefinedUrlCategory(_Model): + """Predefined URL category object. + + :ivar action: Required. + :vartype action: str + :ivar name: Required. + :vartype name: str + """ + + action: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + + @overload + def __init__( + self, + *, + action: str, + name: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrefixListGlobalRulestackResource(ProxyResource): + """GlobalRulestack prefixList. + + :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 properties: The resource-specific properties for this resource. Required. + :vartype properties: ~azure.mgmt.paloaltonetworksngfw.models.PrefixObject + """ + + properties: "_models.PrefixObject" = rest_field(visibility=["read", "create"]) + """The resource-specific properties for this resource. Required.""" + + __flattened_items = ["description", "prefix_list", "etag", "audit_comment", "provisioning_state"] + + @overload + def __init__( + self, + *, + properties: "_models.PrefixObject", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class PrefixListResource(ProxyResource): + """LocalRulestack prefixList. + + :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 properties: The resource-specific properties for this resource. Required. + :vartype properties: ~azure.mgmt.paloaltonetworksngfw.models.PrefixObject + """ + + properties: "_models.PrefixObject" = rest_field(visibility=["read", "create"]) + """The resource-specific properties for this resource. Required.""" + + __flattened_items = ["description", "prefix_list", "etag", "audit_comment", "provisioning_state"] + + @overload + def __init__( + self, + *, + properties: "_models.PrefixObject", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class PrefixObject(_Model): + """prefix entry. + + :ivar description: prefix description. + :vartype description: str + :ivar prefix_list: prefix list. Required. + :vartype prefix_list: list[str] + :ivar etag: etag info. + :vartype etag: str + :ivar audit_comment: comment for this object. + :vartype audit_comment: 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 + """ + + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """prefix description.""" + prefix_list: list[str] = rest_field(name="prefixList", visibility=["read", "create", "update", "delete", "query"]) + """prefix list. Required.""" + etag: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """etag info.""" + audit_comment: Optional[str] = rest_field( + name="auditComment", visibility=["read", "create", "update", "delete", "query"] + ) + """comment for this object.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning state of the resource. Known values are: \"Accepted\", \"Creating\", \"Updating\", + \"Deleting\", \"Succeeded\", \"Failed\", \"Canceled\", \"Deleted\", and \"NotSpecified\".""" + + @overload + def __init__( + self, + *, + prefix_list: list[str], + description: Optional[str] = None, + etag: Optional[str] = None, + audit_comment: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PreRulesResource(ProxyResource): + """PreRulestack rule list. + + :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 properties: The resource-specific properties for this resource. Required. + :vartype properties: ~azure.mgmt.paloaltonetworksngfw.models.RuleEntry + """ + + properties: "_models.RuleEntry" = rest_field(visibility=["read", "create"]) + """The resource-specific properties for this resource. Required.""" + + __flattened_items = [ + "etag", + "rule_name", + "priority", + "description", + "rule_state", + "source", + "negate_source", + "destination", + "negate_destination", + "applications", + "category", + "protocol", + "protocol_port_list", + "inbound_inspection_certificate", + "audit_comment", + "action_type", + "enable_logging", + "decryption_rule_type", + "tags", + "provisioning_state", + ] + + @overload + def __init__( + self, + *, + properties: "_models.RuleEntry", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ProductSerialNumberRequestStatus(_Model): + """Create Product Serial Number Request status. + + :ivar status: allocation status of the product serial number. Required. + :vartype status: str + """ + + status: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """allocation status of the product serial number. Required.""" + + @overload + def __init__( + self, + *, + status: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ProductSerialNumberStatus(_Model): + """Product serial and status for the service. + + :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 + """ + + serial_number: Optional[str] = rest_field( + name="serialNumber", visibility=["read", "create", "update", "delete", "query"] + ) + """product Serial associated with given resource.""" + status: Union[str, "_models.ProductSerialStatusValues"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """allocation status of the product serial number. Required. Known values are: \"Allocated\" and + \"InProgress\".""" + + @overload + def __init__( + self, + *, + status: Union[str, "_models.ProductSerialStatusValues"], + serial_number: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RuleCounter(_Model): + """Rule counter. + + :ivar priority: priority number. Required. + :vartype priority: str + :ivar rule_stack_name: rule Stack Name. + :vartype rule_stack_name: str + :ivar rule_list_name: rule list name. + :vartype rule_list_name: str + :ivar firewall_name: firewall name. + :vartype firewall_name: str + :ivar rule_name: rule name. Required. + :vartype rule_name: str + :ivar hit_count: hit count. + :vartype hit_count: int + :ivar app_seen: apps seen. + :vartype app_seen: ~azure.mgmt.paloaltonetworksngfw.models.AppSeenData + :ivar timestamp: timestamp of response. + :vartype timestamp: ~datetime.datetime + :ivar request_timestamp: timestamp of request. + :vartype request_timestamp: ~datetime.datetime + :ivar last_updated_timestamp: last updated timestamp. + :vartype last_updated_timestamp: ~datetime.datetime + """ + + priority: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """priority number. Required.""" + rule_stack_name: Optional[str] = rest_field( + name="ruleStackName", visibility=["read", "create", "update", "delete", "query"] + ) + """rule Stack Name.""" + rule_list_name: Optional[str] = rest_field( + name="ruleListName", visibility=["read", "create", "update", "delete", "query"] + ) + """rule list name.""" + firewall_name: Optional[str] = rest_field( + name="firewallName", visibility=["read", "create", "update", "delete", "query"] + ) + """firewall name.""" + rule_name: str = rest_field(name="ruleName", visibility=["read", "create", "update", "delete", "query"]) + """rule name. Required.""" + hit_count: Optional[int] = rest_field(name="hitCount", visibility=["read", "create", "update", "delete", "query"]) + """hit count.""" + app_seen: Optional["_models.AppSeenData"] = rest_field( + name="appSeen", visibility=["read", "create", "update", "delete", "query"] + ) + """apps seen.""" + timestamp: Optional[datetime.datetime] = rest_field( + visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """timestamp of response.""" + request_timestamp: Optional[datetime.datetime] = rest_field( + name="requestTimestamp", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """timestamp of request.""" + last_updated_timestamp: Optional[datetime.datetime] = rest_field( + name="lastUpdatedTimestamp", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """last updated timestamp.""" + + @overload + def __init__( + self, + *, + priority: str, + rule_name: str, + rule_stack_name: Optional[str] = None, + rule_list_name: Optional[str] = None, + firewall_name: Optional[str] = None, + hit_count: Optional[int] = None, + app_seen: Optional["_models.AppSeenData"] = None, + timestamp: Optional[datetime.datetime] = None, + request_timestamp: Optional[datetime.datetime] = None, + last_updated_timestamp: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RuleCounterReset(_Model): + """Rule counter reset. + + :ivar priority: priority number. + :vartype priority: str + :ivar rule_stack_name: rule Stack Name. + :vartype rule_stack_name: str + :ivar rule_list_name: rule list name. + :vartype rule_list_name: str + :ivar firewall_name: firewall name. + :vartype firewall_name: str + :ivar rule_name: rule name. + :vartype rule_name: str + """ + + priority: Optional[str] = rest_field(visibility=["read"]) + """priority number.""" + rule_stack_name: Optional[str] = rest_field( + name="ruleStackName", visibility=["read", "create", "update", "delete", "query"] + ) + """rule Stack Name.""" + rule_list_name: Optional[str] = rest_field( + name="ruleListName", visibility=["read", "create", "update", "delete", "query"] + ) + """rule list name.""" + firewall_name: Optional[str] = rest_field( + name="firewallName", visibility=["read", "create", "update", "delete", "query"] + ) + """firewall name.""" + rule_name: Optional[str] = rest_field(name="ruleName", visibility=["read", "create", "update", "delete", "query"]) + """rule name.""" + + @overload + def __init__( + self, + *, + rule_stack_name: Optional[str] = None, + rule_list_name: Optional[str] = None, + firewall_name: Optional[str] = None, + rule_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RuleEntry(_Model): + """definition of rule. + + :ivar etag: etag info. + :vartype etag: str + :ivar rule_name: rule name. Required. + :vartype rule_name: str + :ivar priority: + :vartype priority: int + :ivar description: rule description. + :vartype description: str + :ivar rule_state: state of this rule. Known values are: "DISABLED" and "ENABLED". + :vartype rule_state: str or ~azure.mgmt.paloaltonetworksngfw.models.StateEnum + :ivar source: source address. + :vartype source: ~azure.mgmt.paloaltonetworksngfw.models.SourceAddr + :ivar negate_source: cidr should not be 'any'. Known values are: "TRUE" and "FALSE". + :vartype negate_source: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum + :ivar destination: destination address. + :vartype destination: ~azure.mgmt.paloaltonetworksngfw.models.DestinationAddr + :ivar negate_destination: cidr should not be 'any'. Known values are: "TRUE" and "FALSE". + :vartype negate_destination: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum + :ivar applications: array of rule applications. + :vartype applications: list[str] + :ivar category: rule category. + :vartype category: ~azure.mgmt.paloaltonetworksngfw.models.Category + :ivar protocol: any, application-default, TCP:number, UDP:number. + :vartype protocol: str + :ivar protocol_port_list: prot port list. + :vartype protocol_port_list: list[str] + :ivar inbound_inspection_certificate: inbound Inspection Certificate. + :vartype inbound_inspection_certificate: str + :ivar audit_comment: rule comment. + :vartype audit_comment: str + :ivar action_type: rule action. Known values are: "Allow", "DenySilent", "DenyResetServer", and + "DenyResetBoth". + :vartype action_type: str or ~azure.mgmt.paloaltonetworksngfw.models.ActionEnum + :ivar enable_logging: enable or disable logging. Known values are: "DISABLED" and "ENABLED". + :vartype enable_logging: str or ~azure.mgmt.paloaltonetworksngfw.models.StateEnum + :ivar decryption_rule_type: enable or disable decryption. Known values are: + "SSLOutboundInspection", "SSLInboundInspection", and "None". + :vartype decryption_rule_type: str or + ~azure.mgmt.paloaltonetworksngfw.models.DecryptionRuleTypeEnum + :ivar tags: tag for rule. + :vartype tags: list[~azure.mgmt.paloaltonetworksngfw.models.TagInfo] + :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 + """ + + etag: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """etag info.""" + rule_name: str = rest_field(name="ruleName", visibility=["read", "create", "update", "delete", "query"]) + """rule name. Required.""" + priority: Optional[int] = rest_field(visibility=["read"]) + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """rule description.""" + rule_state: Optional[Union[str, "_models.StateEnum"]] = rest_field( + name="ruleState", visibility=["read", "create", "update", "delete", "query"] + ) + """state of this rule. Known values are: \"DISABLED\" and \"ENABLED\".""" + source: Optional["_models.SourceAddr"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """source address.""" + negate_source: Optional[Union[str, "_models.BooleanEnum"]] = rest_field( + name="negateSource", visibility=["read", "create", "update", "delete", "query"] + ) + """cidr should not be 'any'. Known values are: \"TRUE\" and \"FALSE\".""" + destination: Optional["_models.DestinationAddr"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """destination address.""" + negate_destination: Optional[Union[str, "_models.BooleanEnum"]] = rest_field( + name="negateDestination", visibility=["read", "create", "update", "delete", "query"] + ) + """cidr should not be 'any'. Known values are: \"TRUE\" and \"FALSE\".""" + applications: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """array of rule applications.""" + category: Optional["_models.Category"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """rule category.""" + protocol: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """any, application-default, TCP:number, UDP:number.""" + protocol_port_list: Optional[list[str]] = rest_field( + name="protocolPortList", visibility=["read", "create", "update", "delete", "query"] + ) + """prot port list.""" + inbound_inspection_certificate: Optional[str] = rest_field( + name="inboundInspectionCertificate", visibility=["read", "create", "update", "delete", "query"] + ) + """inbound Inspection Certificate.""" + audit_comment: Optional[str] = rest_field( + name="auditComment", visibility=["read", "create", "update", "delete", "query"] + ) + """rule comment.""" + action_type: Optional[Union[str, "_models.ActionEnum"]] = rest_field( + name="actionType", visibility=["read", "create", "update", "delete", "query"] + ) + """rule action. Known values are: \"Allow\", \"DenySilent\", \"DenyResetServer\", and + \"DenyResetBoth\".""" + enable_logging: Optional[Union[str, "_models.StateEnum"]] = rest_field( + name="enableLogging", visibility=["read", "create", "update", "delete", "query"] + ) + """enable or disable logging. Known values are: \"DISABLED\" and \"ENABLED\".""" + decryption_rule_type: Optional[Union[str, "_models.DecryptionRuleTypeEnum"]] = rest_field( + name="decryptionRuleType", visibility=["read", "create", "update", "delete", "query"] + ) + """enable or disable decryption. Known values are: \"SSLOutboundInspection\", + \"SSLInboundInspection\", and \"None\".""" + tags: Optional[list["_models.TagInfo"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """tag for rule.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning state of the resource. Known values are: \"Accepted\", \"Creating\", \"Updating\", + \"Deleting\", \"Succeeded\", \"Failed\", \"Canceled\", \"Deleted\", and \"NotSpecified\".""" + + @overload + def __init__( + self, + *, + rule_name: str, + etag: Optional[str] = None, + description: Optional[str] = None, + rule_state: Optional[Union[str, "_models.StateEnum"]] = None, + source: Optional["_models.SourceAddr"] = None, + 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, + category: Optional["_models.Category"] = None, + protocol: Optional[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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RulestackDetails(_Model): + """Associated rulestack details. + + :ivar resource_id: Resource Id. + :vartype resource_id: str + :ivar rulestack_id: Associated rulestack Id. + :vartype rulestack_id: str + :ivar location: Rulestack location. + :vartype location: str + """ + + resource_id: Optional[str] = rest_field( + name="resourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Resource Id.""" + rulestack_id: Optional[str] = rest_field( + name="rulestackId", visibility=["read", "create", "update", "delete", "query"] + ) + """Associated rulestack Id.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Rulestack location.""" + + @overload + def __init__( + self, + *, + resource_id: Optional[str] = None, + rulestack_id: Optional[str] = None, + location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RulestackProperties(_Model): + """PAN Rulestack Describe Object. + + :ivar pan_etag: PanEtag info. + :vartype pan_etag: str + :ivar pan_location: Rulestack Location, Required for GlobalRulestacks, Not for LocalRulestacks. + :vartype pan_location: str + :ivar scope: Rulestack Type. Known values are: "LOCAL" and "GLOBAL". + :vartype scope: str or ~azure.mgmt.paloaltonetworksngfw.models.ScopeType + :ivar associated_subscriptions: subscription scope of global rulestack. + :vartype associated_subscriptions: list[str] + :ivar description: rulestack description. + :vartype description: str + :ivar default_mode: Mode for default rules creation. Known values are: "IPS", "FIREWALL", and + "NONE". + :vartype default_mode: str or ~azure.mgmt.paloaltonetworksngfw.models.DefaultMode + :ivar min_app_id_version: minimum version. + :vartype min_app_id_version: 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 + :ivar security_services: Security Profile. + :vartype security_services: ~azure.mgmt.paloaltonetworksngfw.models.SecurityServices + """ + + pan_etag: Optional[str] = rest_field(name="panEtag", visibility=["read", "create", "update", "delete", "query"]) + """PanEtag info.""" + pan_location: Optional[str] = rest_field( + name="panLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """Rulestack Location, Required for GlobalRulestacks, Not for LocalRulestacks.""" + scope: Optional[Union[str, "_models.ScopeType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Rulestack Type. Known values are: \"LOCAL\" and \"GLOBAL\".""" + associated_subscriptions: Optional[list[str]] = rest_field( + name="associatedSubscriptions", visibility=["read", "create", "update", "delete", "query"] + ) + """subscription scope of global rulestack.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """rulestack description.""" + default_mode: Optional[Union[str, "_models.DefaultMode"]] = rest_field( + name="defaultMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Mode for default rules creation. Known values are: \"IPS\", \"FIREWALL\", and \"NONE\".""" + min_app_id_version: Optional[str] = rest_field( + name="minAppIdVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """minimum version.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning state of the resource. Known values are: \"Accepted\", \"Creating\", \"Updating\", + \"Deleting\", \"Succeeded\", \"Failed\", \"Canceled\", \"Deleted\", and \"NotSpecified\".""" + security_services: Optional["_models.SecurityServices"] = rest_field( + name="securityServices", visibility=["read", "create", "update", "delete", "query"] + ) + """Security Profile.""" + + @overload + def __init__( + self, + *, + pan_etag: Optional[str] = None, + pan_location: Optional[str] = None, + scope: Optional[Union[str, "_models.ScopeType"]] = 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, + security_services: Optional["_models.SecurityServices"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SecurityServices(_Model): + """security services. + + :ivar vulnerability_profile: IPs Vulnerability Profile Data. + :vartype vulnerability_profile: str + :ivar anti_spyware_profile: Anti spyware Profile data. + :vartype anti_spyware_profile: str + :ivar anti_virus_profile: anti virus profile data. + :vartype anti_virus_profile: str + :ivar url_filtering_profile: URL filtering profile data. + :vartype url_filtering_profile: str + :ivar file_blocking_profile: File blocking profile data. + :vartype file_blocking_profile: str + :ivar dns_subscription: DNS Subscription profile data. + :vartype dns_subscription: str + :ivar outbound_un_trust_certificate: Untrusted Egress Decryption profile data. + :vartype outbound_un_trust_certificate: str + :ivar outbound_trust_certificate: Trusted Egress Decryption profile data. + :vartype outbound_trust_certificate: str + """ + + vulnerability_profile: Optional[str] = rest_field( + name="vulnerabilityProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """IPs Vulnerability Profile Data.""" + anti_spyware_profile: Optional[str] = rest_field( + name="antiSpywareProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Anti spyware Profile data.""" + anti_virus_profile: Optional[str] = rest_field( + name="antiVirusProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """anti virus profile data.""" + url_filtering_profile: Optional[str] = rest_field( + name="urlFilteringProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """URL filtering profile data.""" + file_blocking_profile: Optional[str] = rest_field( + name="fileBlockingProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """File blocking profile data.""" + dns_subscription: Optional[str] = rest_field( + name="dnsSubscription", visibility=["read", "create", "update", "delete", "query"] + ) + """DNS Subscription profile data.""" + outbound_un_trust_certificate: Optional[str] = rest_field( + name="outboundUnTrustCertificate", visibility=["read", "create", "update", "delete", "query"] + ) + """Untrusted Egress Decryption profile data.""" + outbound_trust_certificate: Optional[str] = rest_field( + name="outboundTrustCertificate", visibility=["read", "create", "update", "delete", "query"] + ) + """Trusted Egress Decryption profile data.""" + + @overload + def __init__( + self, + *, + vulnerability_profile: Optional[str] = None, + anti_spyware_profile: Optional[str] = None, + anti_virus_profile: Optional[str] = None, + url_filtering_profile: Optional[str] = None, + file_blocking_profile: Optional[str] = None, + dns_subscription: Optional[str] = None, + outbound_un_trust_certificate: Optional[str] = None, + outbound_trust_certificate: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SecurityServicesResponse(_Model): + """Security services list response. + + :ivar value: response value. Required. + :vartype value: ~azure.mgmt.paloaltonetworksngfw.models.SecurityServicesTypeList + :ivar next_link: next link. + :vartype next_link: str + """ + + value: "_models.SecurityServicesTypeList" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """response value. Required.""" + next_link: Optional[str] = rest_field(name="nextLink", visibility=["read", "create", "update", "delete", "query"]) + """next link.""" + + @overload + def __init__( + self, + *, + value: "_models.SecurityServicesTypeList", + next_link: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SecurityServicesTypeList(_Model): + """Security services type list. + + :ivar type: security services type. + :vartype type: str + :ivar entry: list. Required. + :vartype entry: list[~azure.mgmt.paloaltonetworksngfw.models.NameDescriptionObject] + """ + + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """security services type.""" + entry: list["_models.NameDescriptionObject"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """list. Required.""" + + @overload + def __init__( + self, + *, + entry: list["_models.NameDescriptionObject"], + type: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SourceAddr(_Model): + """Address properties. + + :ivar cidrs: special value 'any'. + :vartype cidrs: list[str] + :ivar countries: list of countries. + :vartype countries: list[str] + :ivar feeds: list of feeds. + :vartype feeds: list[str] + :ivar prefix_lists: prefix list. + :vartype prefix_lists: list[str] + """ + + cidrs: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """special value 'any'.""" + countries: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """list of countries.""" + feeds: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """list of feeds.""" + prefix_lists: Optional[list[str]] = rest_field( + name="prefixLists", visibility=["read", "create", "update", "delete", "query"] + ) + """prefix list.""" + + @overload + def __init__( + self, + *, + cidrs: Optional[list[str]] = None, + countries: Optional[list[str]] = None, + feeds: Optional[list[str]] = None, + prefix_lists: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StorageAccount(_Model): + """Storage Account configurations. + + :ivar id: Resource ID of storage account. + :vartype id: str + :ivar subscription_id: Subscription Id. + :vartype subscription_id: str + :ivar account_name: Storage account name. + :vartype account_name: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource ID of storage account.""" + subscription_id: Optional[str] = rest_field( + name="subscriptionId", visibility=["read", "create", "update", "delete", "query"] + ) + """Subscription Id.""" + account_name: Optional[str] = rest_field( + name="accountName", visibility=["read", "create", "update", "delete", "query"] + ) + """Storage account name.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + subscription_id: Optional[str] = None, + account_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StrataCloudManagerConfig(_Model): + """This field is only present if Strata Cloud Manager is managing the policy for this firewall. + + :ivar cloud_manager_name: Strata Cloud Manager name which is intended to manage the policy for + this firewall. Required. + :vartype cloud_manager_name: str + """ + + cloud_manager_name: str = rest_field( + name="cloudManagerName", visibility=["read", "create", "update", "delete", "query"] + ) + """Strata Cloud Manager name which is intended to manage the policy for this firewall. Required.""" + + @overload + def __init__( + self, + *, + cloud_manager_name: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StrataCloudManagerInfo(_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 + """ + + folder_name: Optional[str] = rest_field( + name="folderName", visibility=["read", "create", "update", "delete", "query"] + ) + """Strata Cloud Manager folder in which this firewall has been placed.""" + hub_url: Optional[str] = rest_field(name="hubUrl", visibility=["read", "create", "update", "delete", "query"]) + """URL for Strata Cloud Manager.""" + + @overload + def __init__( + self, + *, + folder_name: Optional[str] = None, + hub_url: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SupportInfo(_Model): + """Support information for the resource. + + :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_registered: account registered in Customer Support Portal. Known values are: + "TRUE" and "FALSE". + :vartype account_registered: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum + :ivar account_id: Support account associated with given resource. + :vartype account_id: str + :ivar user_domain_supported: user domain is supported in Customer Support Portal. Known values + are: "TRUE" and "FALSE". + :vartype user_domain_supported: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum + :ivar user_registered: user registered in Customer Support Portal. Known values are: "TRUE" and + "FALSE". + :vartype user_registered: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum + :ivar free_trial: Product usage is in free trial period. Known values are: "TRUE" and "FALSE". + :vartype free_trial: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum + :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 + """ + + product_sku: Optional[str] = rest_field( + name="productSku", visibility=["read", "create", "update", "delete", "query"] + ) + """product SKU associated with given resource.""" + product_serial: Optional[str] = rest_field( + name="productSerial", visibility=["read", "create", "update", "delete", "query"] + ) + """product Serial associated with given resource.""" + account_registered: Optional[Union[str, "_models.BooleanEnum"]] = rest_field( + name="accountRegistered", visibility=["read", "create", "update", "delete", "query"] + ) + """account registered in Customer Support Portal. Known values are: \"TRUE\" and \"FALSE\".""" + account_id: Optional[str] = rest_field(name="accountId", visibility=["read", "create", "update", "delete", "query"]) + """Support account associated with given resource.""" + user_domain_supported: Optional[Union[str, "_models.BooleanEnum"]] = rest_field( + name="userDomainSupported", visibility=["read", "create", "update", "delete", "query"] + ) + """user domain is supported in Customer Support Portal. Known values are: \"TRUE\" and \"FALSE\".""" + user_registered: Optional[Union[str, "_models.BooleanEnum"]] = rest_field( + name="userRegistered", visibility=["read", "create", "update", "delete", "query"] + ) + """user registered in Customer Support Portal. Known values are: \"TRUE\" and \"FALSE\".""" + free_trial: Optional[Union[str, "_models.BooleanEnum"]] = rest_field( + name="freeTrial", visibility=["read", "create", "update", "delete", "query"] + ) + """Product usage is in free trial period. Known values are: \"TRUE\" and \"FALSE\".""" + free_trial_days_left: Optional[int] = rest_field( + name="freeTrialDaysLeft", visibility=["read", "create", "update", "delete", "query"] + ) + """Free trial days remaining.""" + free_trial_credit_left: Optional[int] = rest_field( + name="freeTrialCreditLeft", visibility=["read", "create", "update", "delete", "query"] + ) + """Free trial credit remaining.""" + help_url: Optional[str] = rest_field(name="helpURL", visibility=["read", "create", "update", "delete", "query"]) + """URL for paloaltonetworks live community.""" + support_url: Optional[str] = rest_field( + name="supportURL", visibility=["read", "create", "update", "delete", "query"] + ) + """URL for paloaltonetworks Customer Service Portal.""" + register_url: Optional[str] = rest_field( + name="registerURL", visibility=["read", "create", "update", "delete", "query"] + ) + """URL for registering product in paloaltonetworks Customer Service Portal.""" + + @overload + def __init__( + self, + *, + product_sku: Optional[str] = None, + product_serial: Optional[str] = None, + account_registered: Optional[Union[str, "_models.BooleanEnum"]] = None, + account_id: Optional[str] = None, + user_domain_supported: Optional[Union[str, "_models.BooleanEnum"]] = None, + user_registered: Optional[Union[str, "_models.BooleanEnum"]] = None, + free_trial: Optional[Union[str, "_models.BooleanEnum"]] = 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SupportInfoModel(_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 + """ + + product_sku: Optional[str] = rest_field( + name="productSku", visibility=["read", "create", "update", "delete", "query"] + ) + """product SKU associated with given resource.""" + product_serial: Optional[str] = rest_field( + name="productSerial", visibility=["read", "create", "update", "delete", "query"] + ) + """product Serial associated with given resource.""" + account_registration_status: Optional[Union[str, "_models.RegistrationStatus"]] = rest_field( + name="accountRegistrationStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """account registered in Customer Support Portal. Known values are: \"Registered\" and \"Not + Registered\".""" + account_id: Optional[str] = rest_field(name="accountId", visibility=["read", "create", "update", "delete", "query"]) + """Support account associated with given resource.""" + free_trial: Optional[Union[str, "_models.EnableStatus"]] = rest_field( + name="freeTrial", visibility=["read", "create", "update", "delete", "query"] + ) + """Product usage is in free trial period. Known values are: \"Enabled\" and \"Disabled\".""" + free_trial_days_left: Optional[int] = rest_field( + name="freeTrialDaysLeft", visibility=["read", "create", "update", "delete", "query"] + ) + """Free trial days remaining.""" + free_trial_credit_left: Optional[int] = rest_field( + name="freeTrialCreditLeft", visibility=["read", "create", "update", "delete", "query"] + ) + """Free trial credit remaining.""" + help_url: Optional[str] = rest_field(name="helpURL", visibility=["read", "create", "update", "delete", "query"]) + """URL for paloaltonetworks live community.""" + support_url: Optional[str] = rest_field( + name="supportURL", visibility=["read", "create", "update", "delete", "query"] + ) + """URL for paloaltonetworks Customer Service Portal.""" + register_url: Optional[str] = rest_field( + name="registerURL", visibility=["read", "create", "update", "delete", "query"] + ) + """URL for registering product in paloaltonetworks Customer Service Portal.""" + hub_url: Optional[str] = rest_field(name="hubUrl", visibility=["read", "create", "update", "delete", "query"]) + """URL for Strata Cloud Manager.""" + credits: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """credits purchased, unit per hour.""" + monthly_credit_left: Optional[int] = rest_field( + name="monthlyCreditLeft", visibility=["read", "create", "update", "delete", "query"] + ) + """monthly credit is computed as credits * days in calendar month.""" + start_date_for_credits: Optional[str] = rest_field( + name="startDateForCredits", visibility=["read", "create", "update", "delete", "query"] + ) + """date in format yyyy-mm-dd.""" + end_date_for_credits: Optional[str] = rest_field( + name="endDateForCredits", visibility=["read", "create", "update", "delete", "query"] + ) + """date in format yyyy-mm-dd.""" + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SystemData(_Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.paloaltonetworksngfw.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.paloaltonetworksngfw.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + created_by: Optional[str] = rest_field(name="createdBy", visibility=["read", "create", "update", "delete", "query"]) + """The identity that created the resource.""" + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="createdByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that created the resource. Known values are: \"User\", \"Application\", + \"ManagedIdentity\", and \"Key\".""" + created_at: Optional[datetime.datetime] = rest_field( + name="createdAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource creation (UTC).""" + last_modified_by: Optional[str] = rest_field( + name="lastModifiedBy", visibility=["read", "create", "update", "delete", "query"] + ) + """The identity that last modified the resource.""" + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="lastModifiedByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that last modified the resource. Known values are: \"User\", + \"Application\", \"ManagedIdentity\", and \"Key\".""" + last_modified_at: Optional[datetime.datetime] = rest_field( + name="lastModifiedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource last modification (UTC).""" + + @overload + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TagInfo(_Model): + """Tag. + + :ivar key: tag name. Required. + :vartype key: str + :ivar value: tag value. Required. + :vartype value: str + """ + + key: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """tag name. Required.""" + value: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """tag value. Required.""" + + @overload + def __init__( + self, + *, + key: str, + value: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VnetConfiguration(_Model): + """VnetInfo for Firewall Networking. + + :ivar vnet: Azure Virtual Network. Required. + :vartype vnet: ~azure.mgmt.paloaltonetworksngfw.models.IPAddressSpace + :ivar trust_subnet: Trust Subnet. Required. + :vartype trust_subnet: ~azure.mgmt.paloaltonetworksngfw.models.IPAddressSpace + :ivar un_trust_subnet: Untrust Subnet. Required. + :vartype un_trust_subnet: ~azure.mgmt.paloaltonetworksngfw.models.IPAddressSpace + :ivar ip_of_trust_subnet_for_udr: IP of trust subnet for UDR. + :vartype ip_of_trust_subnet_for_udr: ~azure.mgmt.paloaltonetworksngfw.models.IPAddress + """ + + vnet: "_models.IPAddressSpace" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Azure Virtual Network. Required.""" + trust_subnet: "_models.IPAddressSpace" = rest_field( + name="trustSubnet", visibility=["read", "create", "update", "delete", "query"] + ) + """Trust Subnet. Required.""" + un_trust_subnet: "_models.IPAddressSpace" = rest_field( + name="unTrustSubnet", visibility=["read", "create", "update", "delete", "query"] + ) + """Untrust Subnet. Required.""" + ip_of_trust_subnet_for_udr: Optional["_models.IPAddress"] = rest_field( + name="ipOfTrustSubnetForUdr", visibility=["read", "create", "update", "delete", "query"] + ) + """IP of trust subnet for UDR.""" + + @overload + def __init__( + self, + *, + vnet: "_models.IPAddressSpace", + trust_subnet: "_models.IPAddressSpace", + un_trust_subnet: "_models.IPAddressSpace", + ip_of_trust_subnet_for_udr: Optional["_models.IPAddress"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VwanConfiguration(_Model): + """VwanInfo for Firewall Networking. + + :ivar network_virtual_appliance_id: Network Virtual Appliance resource ID. + :vartype network_virtual_appliance_id: str + :ivar v_hub: vHub Address. Required. + :vartype v_hub: ~azure.mgmt.paloaltonetworksngfw.models.IPAddressSpace + :ivar trust_subnet: Trust Subnet. + :vartype trust_subnet: ~azure.mgmt.paloaltonetworksngfw.models.IPAddressSpace + :ivar un_trust_subnet: Untrust Subnet. + :vartype un_trust_subnet: ~azure.mgmt.paloaltonetworksngfw.models.IPAddressSpace + :ivar ip_of_trust_subnet_for_udr: IP of trust subnet for UDR. + :vartype ip_of_trust_subnet_for_udr: ~azure.mgmt.paloaltonetworksngfw.models.IPAddress + """ + + network_virtual_appliance_id: Optional[str] = rest_field( + name="networkVirtualApplianceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Network Virtual Appliance resource ID.""" + v_hub: "_models.IPAddressSpace" = rest_field( + name="vHub", visibility=["read", "create", "update", "delete", "query"] + ) + """vHub Address. Required.""" + trust_subnet: Optional["_models.IPAddressSpace"] = rest_field( + name="trustSubnet", visibility=["read", "create", "update", "delete", "query"] + ) + """Trust Subnet.""" + un_trust_subnet: Optional["_models.IPAddressSpace"] = rest_field( + name="unTrustSubnet", visibility=["read", "create", "update", "delete", "query"] + ) + """Untrust Subnet.""" + ip_of_trust_subnet_for_udr: Optional["_models.IPAddress"] = rest_field( + name="ipOfTrustSubnetForUdr", visibility=["read", "create", "update", "delete", "query"] + ) + """IP of trust subnet for UDR.""" + + @overload + def __init__( + self, + *, + v_hub: "_models.IPAddressSpace", + network_virtual_appliance_id: Optional[str] = None, + trust_subnet: Optional["_models.IPAddressSpace"] = None, + un_trust_subnet: Optional["_models.IPAddressSpace"] = None, + ip_of_trust_subnet_for_udr: Optional["_models.IPAddress"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_models_py3.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_models_py3.py deleted file mode 100644 index 9f11b2f7c47f..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_models_py3.py +++ /dev/null @@ -1,4827 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from .. import _serialization - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models - - -class AdvSecurityObjectListResponse(_serialization.Model): - """advanced security object. - - All required parameters must be populated in order to send to Azure. - - :ivar value: response value. Required. - :vartype value: ~azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectModel - :ivar next_link: next link. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "AdvSecurityObjectModel"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: "_models.AdvSecurityObjectModel", next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: response value. Required. - :paramtype value: ~azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectModel - :keyword next_link: next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AdvSecurityObjectModel(_serialization.Model): - """List of custom and predefined url category. - - All required parameters must be populated in order to send to Azure. - - :ivar type: type of object. - :vartype type: str - :ivar entry: URL entry. Required. - :vartype entry: list[~azure.mgmt.paloaltonetworksngfw.models.NameDescriptionObject] - """ - - _validation = { - "entry": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "entry": {"key": "entry", "type": "[NameDescriptionObject]"}, - } - - def __init__( - self, *, entry: List["_models.NameDescriptionObject"], type: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword type: type of object. - :paramtype type: str - :keyword entry: URL entry. Required. - :paramtype entry: list[~azure.mgmt.paloaltonetworksngfw.models.NameDescriptionObject] - """ - super().__init__(**kwargs) - self.type = type - self.entry = entry - - -class ApplicationInsights(_serialization.Model): - """Application Insights key. - - :ivar id: Resource id for Application Insights. - :vartype id: str - :ivar key: Application Insights key. - :vartype key: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "key": {"key": "key", "type": "str"}, - } - - def __init__( - self, *, id: Optional[str] = None, key: Optional[str] = None, **kwargs: Any # pylint: disable=redefined-builtin - ) -> None: - """ - :keyword id: Resource id for Application Insights. - :paramtype id: str - :keyword key: Application Insights key. - :paramtype key: str - """ - super().__init__(**kwargs) - self.id = id - self.key = key - - -class AppSeenData(_serialization.Model): - """Data Type for App Seen. - - All required parameters must be populated in order to send to Azure. - - :ivar count: number of rows. Required. - :vartype count: int - :ivar app_seen_list: array of appSeen. Required. - :vartype app_seen_list: list[~azure.mgmt.paloaltonetworksngfw.models.AppSeenInfo] - """ - - _validation = { - "count": {"required": True}, - "app_seen_list": {"required": True}, - } - - _attribute_map = { - "count": {"key": "count", "type": "int"}, - "app_seen_list": {"key": "appSeenList", "type": "[AppSeenInfo]"}, - } - - def __init__(self, *, count: int, app_seen_list: List["_models.AppSeenInfo"], **kwargs: Any) -> None: - """ - :keyword count: number of rows. Required. - :paramtype count: int - :keyword app_seen_list: array of appSeen. Required. - :paramtype app_seen_list: list[~azure.mgmt.paloaltonetworksngfw.models.AppSeenInfo] - """ - super().__init__(**kwargs) - self.count = count - self.app_seen_list = app_seen_list - - -class AppSeenInfo(_serialization.Model): - """Definition for App Seen. - - All required parameters must be populated in order to send to Azure. - - :ivar title: title. Required. - :vartype title: str - :ivar category: category. Required. - :vartype category: str - :ivar sub_category: subCategory. Required. - :vartype sub_category: str - :ivar risk: risk. Required. - :vartype risk: str - :ivar tag: tag. Required. - :vartype tag: str - :ivar technology: technology. Required. - :vartype technology: str - :ivar standard_ports: standardPorts. Required. - :vartype standard_ports: str - """ - - _validation = { - "title": {"required": True}, - "category": {"required": True}, - "sub_category": {"required": True}, - "risk": {"required": True}, - "tag": {"required": True}, - "technology": {"required": True}, - "standard_ports": {"required": True}, - } - - _attribute_map = { - "title": {"key": "title", "type": "str"}, - "category": {"key": "category", "type": "str"}, - "sub_category": {"key": "subCategory", "type": "str"}, - "risk": {"key": "risk", "type": "str"}, - "tag": {"key": "tag", "type": "str"}, - "technology": {"key": "technology", "type": "str"}, - "standard_ports": {"key": "standardPorts", "type": "str"}, - } - - def __init__( - self, - *, - title: str, - category: str, - sub_category: str, - risk: str, - tag: str, - technology: str, - standard_ports: str, - **kwargs: Any - ) -> None: - """ - :keyword title: title. Required. - :paramtype title: str - :keyword category: category. Required. - :paramtype category: str - :keyword sub_category: subCategory. Required. - :paramtype sub_category: str - :keyword risk: risk. Required. - :paramtype risk: str - :keyword tag: tag. Required. - :paramtype tag: str - :keyword technology: technology. Required. - :paramtype technology: str - :keyword standard_ports: standardPorts. Required. - :paramtype standard_ports: str - """ - super().__init__(**kwargs) - self.title = title - self.category = category - self.sub_category = sub_category - self.risk = risk - self.tag = tag - self.technology = technology - self.standard_ports = standard_ports - - -class AzureResourceManagerManagedIdentityProperties(_serialization.Model): - """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. - - :ivar tenant_id: The Active Directory tenant id of the principal. - :vartype tenant_id: str - :ivar principal_id: The active directory identifier of this principal. - :vartype principal_id: str - :ivar type: The type of managed identity assigned to this resource. Required. Known values are: - "None", "SystemAssigned", "UserAssigned", and "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.paloaltonetworksngfw.models.ManagedIdentityType - :ivar user_assigned_identities: The identities assigned to this resource by the user. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.paloaltonetworksngfw.models.AzureResourceManagerUserAssignedIdentity] - """ - - _validation = { - "tenant_id": {"readonly": True}, - "principal_id": {"readonly": True}, - "type": {"required": True}, - } - - _attribute_map = { - "tenant_id": {"key": "tenantId", "type": "str"}, - "principal_id": {"key": "principalId", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "user_assigned_identities": { - "key": "userAssignedIdentities", - "type": "{AzureResourceManagerUserAssignedIdentity}", - }, - } - - def __init__( - self, - *, - type: Union[str, "_models.ManagedIdentityType"], - user_assigned_identities: Optional[Dict[str, "_models.AzureResourceManagerUserAssignedIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: The type of managed identity assigned to this resource. Required. Known values - are: "None", "SystemAssigned", "UserAssigned", and "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.paloaltonetworksngfw.models.ManagedIdentityType - :keyword user_assigned_identities: The identities assigned to this resource by the user. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.paloaltonetworksngfw.models.AzureResourceManagerUserAssignedIdentity] - """ - super().__init__(**kwargs) - self.tenant_id = None - self.principal_id = None - self.type = type - self.user_assigned_identities = user_assigned_identities - - -class AzureResourceManagerUserAssignedIdentity(_serialization.Model): - """A managed identity assigned by the user. - - :ivar client_id: The active directory client identifier for this principal. - :vartype client_id: str - :ivar principal_id: The active directory identifier for this principal. - :vartype principal_id: str - """ - - _attribute_map = { - "client_id": {"key": "clientId", "type": "str"}, - "principal_id": {"key": "principalId", "type": "str"}, - } - - def __init__(self, *, client_id: Optional[str] = None, principal_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword client_id: The active directory client identifier for this principal. - :paramtype client_id: str - :keyword principal_id: The active directory identifier for this principal. - :paramtype principal_id: str - """ - super().__init__(**kwargs) - self.client_id = client_id - self.principal_id = principal_id - - -class Category(_serialization.Model): - """URL/EDL to match. - - All required parameters must be populated in order to send to Azure. - - :ivar url_custom: custom URL. Required. - :vartype url_custom: list[str] - :ivar feeds: feed list. Required. - :vartype feeds: list[str] - """ - - _validation = { - "url_custom": {"required": True}, - "feeds": {"required": True}, - } - - _attribute_map = { - "url_custom": {"key": "urlCustom", "type": "[str]"}, - "feeds": {"key": "feeds", "type": "[str]"}, - } - - def __init__(self, *, url_custom: List[str], feeds: List[str], **kwargs: Any) -> None: - """ - :keyword url_custom: custom URL. Required. - :paramtype url_custom: list[str] - :keyword feeds: feed list. Required. - :paramtype feeds: list[str] - """ - super().__init__(**kwargs) - self.url_custom = url_custom - self.feeds = feeds - - -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. 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 - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. 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 - """ - - _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. - - :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 certificate_signer_resource_id: Resource Id of certificate signer, to be populated only - when certificateSelfSigned is false. - :vartype certificate_signer_resource_id: str - :ivar certificate_self_signed: use certificate self signed. Required. Known values are: "TRUE" - and "FALSE". - :vartype certificate_self_signed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum - :ivar audit_comment: comment for this object. - :vartype audit_comment: str - :ivar description: user description for this object. - :vartype description: str - :ivar etag: read only string representing last create or update. - :vartype 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}, - "certificate_self_signed": {"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"}, - "certificate_signer_resource_id": {"key": "properties.certificateSignerResourceId", "type": "str"}, - "certificate_self_signed": {"key": "properties.certificateSelfSigned", "type": "str"}, - "audit_comment": {"key": "properties.auditComment", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "etag": {"key": "properties.etag", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( - self, - *, - certificate_self_signed: Union[str, "_models.BooleanEnum"], - certificate_signer_resource_id: Optional[str] = None, - audit_comment: Optional[str] = None, - description: Optional[str] = None, - etag: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword certificate_signer_resource_id: Resource Id of certificate signer, to be populated - only when certificateSelfSigned is false. - :paramtype certificate_signer_resource_id: str - :keyword certificate_self_signed: use certificate self signed. Required. Known values are: - "TRUE" and "FALSE". - :paramtype certificate_self_signed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum - :keyword audit_comment: comment for this object. - :paramtype audit_comment: str - :keyword description: user description for this object. - :paramtype description: str - :keyword etag: read only string representing last create or update. - :paramtype etag: str - """ - super().__init__(**kwargs) - self.certificate_signer_resource_id = certificate_signer_resource_id - self.certificate_self_signed = certificate_self_signed - self.audit_comment = audit_comment - self.description = description - self.etag = etag - self.provisioning_state = None - - -class CertificateObjectGlobalRulestackResourceListResult(_serialization.Model): - """The response of a CertificateObjectGlobalRulestackResource list operation. - - All required parameters must be populated in order to send to Azure. - - :ivar value: The items on this page. Required. - :vartype value: - list[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource] - :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": "[CertificateObjectGlobalRulestackResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: List["_models.CertificateObjectGlobalRulestackResource"], - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The items on this page. Required. - :paramtype value: - list[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource] - :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 CertificateObjectLocalRulestackResource(ProxyResource): - """LocalRulestack 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. - - :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 certificate_signer_resource_id: Resource Id of certificate signer, to be populated only - when certificateSelfSigned is false. - :vartype certificate_signer_resource_id: str - :ivar certificate_self_signed: use certificate self signed. Required. Known values are: "TRUE" - and "FALSE". - :vartype certificate_self_signed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum - :ivar audit_comment: comment for this object. - :vartype audit_comment: str - :ivar description: user description for this object. - :vartype description: str - :ivar etag: read only string representing last create or update. - :vartype 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}, - "certificate_self_signed": {"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"}, - "certificate_signer_resource_id": {"key": "properties.certificateSignerResourceId", "type": "str"}, - "certificate_self_signed": {"key": "properties.certificateSelfSigned", "type": "str"}, - "audit_comment": {"key": "properties.auditComment", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "etag": {"key": "properties.etag", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( - self, - *, - certificate_self_signed: Union[str, "_models.BooleanEnum"], - certificate_signer_resource_id: Optional[str] = None, - audit_comment: Optional[str] = None, - description: Optional[str] = None, - etag: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword certificate_signer_resource_id: Resource Id of certificate signer, to be populated - only when certificateSelfSigned is false. - :paramtype certificate_signer_resource_id: str - :keyword certificate_self_signed: use certificate self signed. Required. Known values are: - "TRUE" and "FALSE". - :paramtype certificate_self_signed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum - :keyword audit_comment: comment for this object. - :paramtype audit_comment: str - :keyword description: user description for this object. - :paramtype description: str - :keyword etag: read only string representing last create or update. - :paramtype etag: str - """ - super().__init__(**kwargs) - self.certificate_signer_resource_id = certificate_signer_resource_id - self.certificate_self_signed = certificate_self_signed - self.audit_comment = audit_comment - self.description = description - self.etag = etag - self.provisioning_state = None - - -class CertificateObjectLocalRulestackResourceListResult(_serialization.Model): - """The response of a CertificateObjectLocalRulestackResource list operation. - - All required parameters must be populated in order to send to Azure. - - :ivar value: The items on this page. Required. - :vartype value: - list[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource] - :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": "[CertificateObjectLocalRulestackResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: List["_models.CertificateObjectLocalRulestackResource"], - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The items on this page. Required. - :paramtype value: - list[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource] - :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 Changelog(_serialization.Model): - """Changelog list. - - All required parameters must be populated in order to send to Azure. - - :ivar changes: list of changes. Required. - :vartype changes: list[str] - :ivar last_committed: lastCommitted timestamp. - :vartype last_committed: ~datetime.datetime - :ivar last_modified: lastModified timestamp. - :vartype last_modified: ~datetime.datetime - """ - - _validation = { - "changes": {"required": True}, - } - - _attribute_map = { - "changes": {"key": "changes", "type": "[str]"}, - "last_committed": {"key": "lastCommitted", "type": "iso-8601"}, - "last_modified": {"key": "lastModified", "type": "iso-8601"}, - } - - def __init__( - self, - *, - changes: List[str], - last_committed: Optional[datetime.datetime] = None, - last_modified: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword changes: list of changes. Required. - :paramtype changes: list[str] - :keyword last_committed: lastCommitted timestamp. - :paramtype last_committed: ~datetime.datetime - :keyword last_modified: lastModified timestamp. - :paramtype last_modified: ~datetime.datetime - """ - super().__init__(**kwargs) - self.changes = changes - self.last_committed = last_committed - self.last_modified = last_modified - - -class CountriesResponse(_serialization.Model): - """Countries Response Object. - - All required parameters must be populated in order to send to Azure. - - :ivar value: List of countries. Required. - :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.Country] - :ivar next_link: next link. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Country]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.Country"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: List of countries. Required. - :paramtype value: list[~azure.mgmt.paloaltonetworksngfw.models.Country] - :keyword next_link: next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class Country(_serialization.Model): - """Country Description. - - All required parameters must be populated in order to send to Azure. - - :ivar code: country code. Required. - :vartype code: str - :ivar description: code description. - :vartype description: str - """ - - _validation = { - "code": {"required": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__(self, *, code: str, description: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword code: country code. Required. - :paramtype code: str - :keyword description: code description. - :paramtype description: str - """ - super().__init__(**kwargs) - self.code = code - self.description = description - - -class DestinationAddr(_serialization.Model): - """destination address. - - :ivar cidrs: special value 'any'. - :vartype cidrs: list[str] - :ivar countries: list of countries. - :vartype countries: list[str] - :ivar feeds: list of feeds. - :vartype feeds: list[str] - :ivar prefix_lists: prefix list. - :vartype prefix_lists: list[str] - :ivar fqdn_lists: fqdn list. - :vartype fqdn_lists: list[str] - """ - - _attribute_map = { - "cidrs": {"key": "cidrs", "type": "[str]"}, - "countries": {"key": "countries", "type": "[str]"}, - "feeds": {"key": "feeds", "type": "[str]"}, - "prefix_lists": {"key": "prefixLists", "type": "[str]"}, - "fqdn_lists": {"key": "fqdnLists", "type": "[str]"}, - } - - 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, - **kwargs: Any - ) -> None: - """ - :keyword cidrs: special value 'any'. - :paramtype cidrs: list[str] - :keyword countries: list of countries. - :paramtype countries: list[str] - :keyword feeds: list of feeds. - :paramtype feeds: list[str] - :keyword prefix_lists: prefix list. - :paramtype prefix_lists: list[str] - :keyword fqdn_lists: fqdn list. - :paramtype fqdn_lists: list[str] - """ - super().__init__(**kwargs) - self.cidrs = cidrs - self.countries = countries - self.feeds = feeds - self.prefix_lists = prefix_lists - self.fqdn_lists = fqdn_lists - - -class DNSSettings(_serialization.Model): - """DNS Proxy settings for Firewall. - - :ivar enable_dns_proxy: Enable DNS proxy, disabled by default. Known values are: "DISABLED" and - "ENABLED". - :vartype enable_dns_proxy: str or ~azure.mgmt.paloaltonetworksngfw.models.DNSProxy - :ivar enabled_dns_type: Enabled DNS proxy type, disabled by default. Known values are: "CUSTOM" - and "AZURE". - :vartype enabled_dns_type: str or ~azure.mgmt.paloaltonetworksngfw.models.EnabledDNSType - :ivar dns_servers: List of IPs associated with the Firewall. - :vartype dns_servers: list[~azure.mgmt.paloaltonetworksngfw.models.IPAddress] - """ - - _attribute_map = { - "enable_dns_proxy": {"key": "enableDnsProxy", "type": "str"}, - "enabled_dns_type": {"key": "enabledDnsType", "type": "str"}, - "dns_servers": {"key": "dnsServers", "type": "[IPAddress]"}, - } - - def __init__( - self, - *, - 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, - **kwargs: Any - ) -> None: - """ - :keyword enable_dns_proxy: Enable DNS proxy, disabled by default. Known values are: "DISABLED" - and "ENABLED". - :paramtype enable_dns_proxy: str or ~azure.mgmt.paloaltonetworksngfw.models.DNSProxy - :keyword enabled_dns_type: Enabled DNS proxy type, disabled by default. Known values are: - "CUSTOM" and "AZURE". - :paramtype enabled_dns_type: str or ~azure.mgmt.paloaltonetworksngfw.models.EnabledDNSType - :keyword dns_servers: List of IPs associated with the Firewall. - :paramtype dns_servers: list[~azure.mgmt.paloaltonetworksngfw.models.IPAddress] - """ - super().__init__(**kwargs) - self.enable_dns_proxy = enable_dns_proxy - self.enabled_dns_type = enabled_dns_type - self.dns_servers = dns_servers - - -class EndpointConfiguration(_serialization.Model): - """Endpoint Configuration for frontend and backend. - - All required parameters must be populated in order to send to Azure. - - :ivar port: port ID. Required. - :vartype port: str - :ivar address: Address Space. Required. - :vartype address: ~azure.mgmt.paloaltonetworksngfw.models.IPAddress - """ - - _validation = { - "port": {"required": True}, - "address": {"required": True}, - } - - _attribute_map = { - "port": {"key": "port", "type": "str"}, - "address": {"key": "address", "type": "IPAddress"}, - } - - def __init__(self, *, port: str, address: "_models.IPAddress", **kwargs: Any) -> None: - """ - :keyword port: port ID. Required. - :paramtype port: str - :keyword address: Address Space. Required. - :paramtype address: ~azure.mgmt.paloaltonetworksngfw.models.IPAddress - """ - super().__init__(**kwargs) - self.port = port - self.address = address - - -class ErrorAdditionalInfo(_serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: JSON - """ - - _validation = { - "type": {"readonly": True}, - "info": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "info": {"key": "info", "type": "object"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(_serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.mgmt.paloaltonetworksngfw.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.paloaltonetworksngfw.models.ErrorAdditionalInfo] - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "target": {"readonly": True}, - "details": {"readonly": True}, - "additional_info": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[ErrorDetail]"}, - "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. (This also follows the OData error response format.). - - :ivar error: The error object. - :vartype error: ~azure.mgmt.paloaltonetworksngfw.models.ErrorDetail - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.paloaltonetworksngfw.models.ErrorDetail - """ - super().__init__(**kwargs) - self.error = error - - -class EventHub(_serialization.Model): - """EventHub configurations. - - :ivar id: Resource ID of EventHub. - :vartype id: str - :ivar subscription_id: Subscription Id. - :vartype subscription_id: str - :ivar name: EventHub name. - :vartype name: str - :ivar name_space: EventHub namespace. - :vartype name_space: str - :ivar policy_name: EventHub policy name. - :vartype policy_name: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "subscription_id": {"key": "subscriptionId", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "name_space": {"key": "nameSpace", "type": "str"}, - "policy_name": {"key": "policyName", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - subscription_id: Optional[str] = None, - name: Optional[str] = None, - name_space: Optional[str] = None, - policy_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Resource ID of EventHub. - :paramtype id: str - :keyword subscription_id: Subscription Id. - :paramtype subscription_id: str - :keyword name: EventHub name. - :paramtype name: str - :keyword name_space: EventHub namespace. - :paramtype name_space: str - :keyword policy_name: EventHub policy name. - :paramtype policy_name: str - """ - super().__init__(**kwargs) - self.id = id - self.subscription_id = subscription_id - self.name = name - self.name_space = name_space - self.policy_name = policy_name - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which - has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :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 tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - """ - super().__init__(**kwargs) - self.tags = tags - self.location = location - - -class FirewallResource(TrackedResource): # pylint: disable=too-many-instance-attributes - """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. - - :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 tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar identity: The managed service identities assigned to this resource. - :vartype identity: - ~azure.mgmt.paloaltonetworksngfw.models.AzureResourceManagerManagedIdentityProperties - :ivar pan_etag: panEtag info. - :vartype pan_etag: str - :ivar network_profile: Network settings. Required. - :vartype network_profile: ~azure.mgmt.paloaltonetworksngfw.models.NetworkProfile - :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 panorama_config: Panorama Configuration. - :vartype panorama_config: ~azure.mgmt.paloaltonetworksngfw.models.PanoramaConfig - :ivar associated_rulestack: Associated Rulestack. - :vartype associated_rulestack: ~azure.mgmt.paloaltonetworksngfw.models.RulestackDetails - :ivar dns_settings: DNS settings for Firewall. Required. - :vartype dns_settings: ~azure.mgmt.paloaltonetworksngfw.models.DNSSettings - :ivar front_end_settings: Frontend settings for Firewall. - :vartype front_end_settings: list[~azure.mgmt.paloaltonetworksngfw.models.FrontendSetting] - :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 - :ivar plan_data: Billing plan information. Required. - :vartype plan_data: ~azure.mgmt.paloaltonetworksngfw.models.PlanData - :ivar marketplace_details: Marketplace details. Required. - :vartype marketplace_details: ~azure.mgmt.paloaltonetworksngfw.models.MarketplaceDetails - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "network_profile": {"required": True}, - "dns_settings": {"required": True}, - "provisioning_state": {"readonly": True}, - "plan_data": {"required": True}, - "marketplace_details": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "identity": {"key": "identity", "type": "AzureResourceManagerManagedIdentityProperties"}, - "pan_etag": {"key": "properties.panEtag", "type": "str"}, - "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfile"}, - "is_panorama_managed": {"key": "properties.isPanoramaManaged", "type": "str"}, - "panorama_config": {"key": "properties.panoramaConfig", "type": "PanoramaConfig"}, - "associated_rulestack": {"key": "properties.associatedRulestack", "type": "RulestackDetails"}, - "dns_settings": {"key": "properties.dnsSettings", "type": "DNSSettings"}, - "front_end_settings": {"key": "properties.frontEndSettings", "type": "[FrontendSetting]"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "plan_data": {"key": "properties.planData", "type": "PlanData"}, - "marketplace_details": {"key": "properties.marketplaceDetails", "type": "MarketplaceDetails"}, - } - - def __init__( - self, - *, - location: str, - network_profile: "_models.NetworkProfile", - dns_settings: "_models.DNSSettings", - plan_data: "_models.PlanData", - marketplace_details: "_models.MarketplaceDetails", - 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, - panorama_config: Optional["_models.PanoramaConfig"] = None, - associated_rulestack: Optional["_models.RulestackDetails"] = None, - front_end_settings: Optional[List["_models.FrontendSetting"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword identity: The managed service identities assigned to this resource. - :paramtype identity: - ~azure.mgmt.paloaltonetworksngfw.models.AzureResourceManagerManagedIdentityProperties - :keyword pan_etag: panEtag info. - :paramtype pan_etag: str - :keyword network_profile: Network settings. Required. - :paramtype network_profile: ~azure.mgmt.paloaltonetworksngfw.models.NetworkProfile - :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 panorama_config: Panorama Configuration. - :paramtype panorama_config: ~azure.mgmt.paloaltonetworksngfw.models.PanoramaConfig - :keyword associated_rulestack: Associated Rulestack. - :paramtype associated_rulestack: ~azure.mgmt.paloaltonetworksngfw.models.RulestackDetails - :keyword dns_settings: DNS settings for Firewall. Required. - :paramtype dns_settings: ~azure.mgmt.paloaltonetworksngfw.models.DNSSettings - :keyword front_end_settings: Frontend settings for Firewall. - :paramtype front_end_settings: list[~azure.mgmt.paloaltonetworksngfw.models.FrontendSetting] - :keyword plan_data: Billing plan information. Required. - :paramtype plan_data: ~azure.mgmt.paloaltonetworksngfw.models.PlanData - :keyword marketplace_details: Marketplace details. Required. - :paramtype marketplace_details: ~azure.mgmt.paloaltonetworksngfw.models.MarketplaceDetails - """ - super().__init__(tags=tags, location=location, **kwargs) - self.identity = identity - self.pan_etag = pan_etag - self.network_profile = network_profile - self.is_panorama_managed = is_panorama_managed - self.panorama_config = panorama_config - self.associated_rulestack = associated_rulestack - self.dns_settings = dns_settings - self.front_end_settings = front_end_settings - self.provisioning_state = None - self.plan_data = plan_data - self.marketplace_details = marketplace_details - - -class FirewallResourceListResult(_serialization.Model): - """The response of a FirewallResource list operation. - - All required parameters must be populated in order to send to Azure. - - :ivar value: The 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 - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[FirewallResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: List["_models.FirewallResource"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The 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 - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class FirewallResourceUpdate(_serialization.Model): - """The type used for update operations of the FirewallResource. - - :ivar identity: The managed service identities assigned to this resource. - :vartype identity: - ~azure.mgmt.paloaltonetworksngfw.models.AzureResourceManagerManagedIdentityProperties - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar properties: The updatable properties of the FirewallResource. - :vartype properties: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResourceUpdateProperties - """ - - _attribute_map = { - "identity": {"key": "identity", "type": "AzureResourceManagerManagedIdentityProperties"}, - "tags": {"key": "tags", "type": "{str}"}, - "properties": {"key": "properties", "type": "FirewallResourceUpdateProperties"}, - } - - def __init__( - self, - *, - identity: Optional["_models.AzureResourceManagerManagedIdentityProperties"] = None, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.FirewallResourceUpdateProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword identity: The managed service identities assigned to this resource. - :paramtype identity: - ~azure.mgmt.paloaltonetworksngfw.models.AzureResourceManagerManagedIdentityProperties - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword properties: The updatable properties of the FirewallResource. - :paramtype properties: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResourceUpdateProperties - """ - super().__init__(**kwargs) - self.identity = identity - self.tags = tags - self.properties = properties - - -class FirewallResourceUpdateProperties(_serialization.Model): - """The updatable properties of the FirewallResource. - - :ivar pan_etag: panEtag info. - :vartype pan_etag: str - :ivar network_profile: Network settings. - :vartype network_profile: ~azure.mgmt.paloaltonetworksngfw.models.NetworkProfile - :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 panorama_config: Panorama Configuration. - :vartype panorama_config: ~azure.mgmt.paloaltonetworksngfw.models.PanoramaConfig - :ivar associated_rulestack: Associated Rulestack. - :vartype associated_rulestack: ~azure.mgmt.paloaltonetworksngfw.models.RulestackDetails - :ivar dns_settings: DNS settings for Firewall. - :vartype dns_settings: ~azure.mgmt.paloaltonetworksngfw.models.DNSSettings - :ivar front_end_settings: Frontend settings for Firewall. - :vartype front_end_settings: list[~azure.mgmt.paloaltonetworksngfw.models.FrontendSetting] - :ivar plan_data: Billing plan information. - :vartype plan_data: ~azure.mgmt.paloaltonetworksngfw.models.PlanData - :ivar marketplace_details: Marketplace details. - :vartype marketplace_details: ~azure.mgmt.paloaltonetworksngfw.models.MarketplaceDetails - """ - - _attribute_map = { - "pan_etag": {"key": "panEtag", "type": "str"}, - "network_profile": {"key": "networkProfile", "type": "NetworkProfile"}, - "is_panorama_managed": {"key": "isPanoramaManaged", "type": "str"}, - "panorama_config": {"key": "panoramaConfig", "type": "PanoramaConfig"}, - "associated_rulestack": {"key": "associatedRulestack", "type": "RulestackDetails"}, - "dns_settings": {"key": "dnsSettings", "type": "DNSSettings"}, - "front_end_settings": {"key": "frontEndSettings", "type": "[FrontendSetting]"}, - "plan_data": {"key": "planData", "type": "PlanData"}, - "marketplace_details": {"key": "marketplaceDetails", "type": "MarketplaceDetails"}, - } - - def __init__( - self, - *, - pan_etag: Optional[str] = None, - network_profile: Optional["_models.NetworkProfile"] = None, - is_panorama_managed: Optional[Union[str, "_models.BooleanEnum"]] = None, - panorama_config: Optional["_models.PanoramaConfig"] = None, - associated_rulestack: Optional["_models.RulestackDetails"] = None, - dns_settings: Optional["_models.DNSSettings"] = None, - front_end_settings: Optional[List["_models.FrontendSetting"]] = None, - plan_data: Optional["_models.PlanData"] = None, - marketplace_details: Optional["_models.MarketplaceDetails"] = None, - **kwargs: Any - ) -> None: - """ - :keyword pan_etag: panEtag info. - :paramtype pan_etag: str - :keyword network_profile: Network settings. - :paramtype network_profile: ~azure.mgmt.paloaltonetworksngfw.models.NetworkProfile - :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 panorama_config: Panorama Configuration. - :paramtype panorama_config: ~azure.mgmt.paloaltonetworksngfw.models.PanoramaConfig - :keyword associated_rulestack: Associated Rulestack. - :paramtype associated_rulestack: ~azure.mgmt.paloaltonetworksngfw.models.RulestackDetails - :keyword dns_settings: DNS settings for Firewall. - :paramtype dns_settings: ~azure.mgmt.paloaltonetworksngfw.models.DNSSettings - :keyword front_end_settings: Frontend settings for Firewall. - :paramtype front_end_settings: list[~azure.mgmt.paloaltonetworksngfw.models.FrontendSetting] - :keyword plan_data: Billing plan information. - :paramtype plan_data: ~azure.mgmt.paloaltonetworksngfw.models.PlanData - :keyword marketplace_details: Marketplace details. - :paramtype marketplace_details: ~azure.mgmt.paloaltonetworksngfw.models.MarketplaceDetails - """ - super().__init__(**kwargs) - self.pan_etag = pan_etag - self.network_profile = network_profile - self.is_panorama_managed = is_panorama_managed - self.panorama_config = panorama_config - self.associated_rulestack = associated_rulestack - self.dns_settings = dns_settings - self.front_end_settings = front_end_settings - self.plan_data = plan_data - self.marketplace_details = marketplace_details - - -class FirewallStatusResource(ProxyResource): - """Firewall Status. - - Variables are only populated by the server, and will be ignored when sending a request. - - :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 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 health_status: Current status of the Firewall. Known values are: "GREEN", "YELLOW", - "RED", and "INITIALIZING". - :vartype health_status: str or ~azure.mgmt.paloaltonetworksngfw.models.HealthStatus - :ivar health_reason: Detail description of current health of the Firewall. - :vartype health_reason: str - :ivar panorama_status: Panorama Status. - :vartype panorama_status: ~azure.mgmt.paloaltonetworksngfw.models.PanoramaStatus - :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", - "Failed", and "Deleted". - :vartype provisioning_state: str or - ~azure.mgmt.paloaltonetworksngfw.models.ReadOnlyProvisioningState - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "is_panorama_managed": {"readonly": True}, - "health_status": {"readonly": True}, - "health_reason": {"readonly": True}, - "panorama_status": {"readonly": 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"}, - "is_panorama_managed": {"key": "properties.isPanoramaManaged", "type": "str"}, - "health_status": {"key": "properties.healthStatus", "type": "str"}, - "health_reason": {"key": "properties.healthReason", "type": "str"}, - "panorama_status": {"key": "properties.panoramaStatus", "type": "PanoramaStatus"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.is_panorama_managed = None - self.health_status = None - self.health_reason = None - self.panorama_status = None - self.provisioning_state = None - - -class FirewallStatusResourceListResult(_serialization.Model): - """The response of a FirewallStatusResource list operation. - - All required parameters must be populated in order to send to Azure. - - :ivar value: The 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 - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[FirewallStatusResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: List["_models.FirewallStatusResource"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The 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 - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class FqdnListGlobalRulestackResource(ProxyResource): - """GlobalRulestack fqdnList. - - 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. - - :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 description: fqdn object description. - :vartype description: str - :ivar fqdn_list: fqdn list. Required. - :vartype fqdn_list: list[str] - :ivar etag: etag info. - :vartype etag: str - :ivar audit_comment: comment for this object. - :vartype audit_comment: 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}, - "fqdn_list": {"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"}, - "description": {"key": "properties.description", "type": "str"}, - "fqdn_list": {"key": "properties.fqdnList", "type": "[str]"}, - "etag": {"key": "properties.etag", "type": "str"}, - "audit_comment": {"key": "properties.auditComment", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( - self, - *, - fqdn_list: List[str], - description: Optional[str] = None, - etag: Optional[str] = None, - audit_comment: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword description: fqdn object description. - :paramtype description: str - :keyword fqdn_list: fqdn list. Required. - :paramtype fqdn_list: list[str] - :keyword etag: etag info. - :paramtype etag: str - :keyword audit_comment: comment for this object. - :paramtype audit_comment: str - """ - super().__init__(**kwargs) - self.description = description - self.fqdn_list = fqdn_list - self.etag = etag - self.audit_comment = audit_comment - self.provisioning_state = None - - -class FqdnListGlobalRulestackResourceListResult(_serialization.Model): - """The response of a FqdnListGlobalRulestackResource list operation. - - All required parameters must be populated in order to send to Azure. - - :ivar value: The 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 - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[FqdnListGlobalRulestackResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: List["_models.FqdnListGlobalRulestackResource"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The 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 - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class FqdnListLocalRulestackResource(ProxyResource): - """LocalRulestack fqdnList. - - 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. - - :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 description: fqdn object description. - :vartype description: str - :ivar fqdn_list: fqdn list. Required. - :vartype fqdn_list: list[str] - :ivar etag: etag info. - :vartype etag: str - :ivar audit_comment: comment for this object. - :vartype audit_comment: 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}, - "fqdn_list": {"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"}, - "description": {"key": "properties.description", "type": "str"}, - "fqdn_list": {"key": "properties.fqdnList", "type": "[str]"}, - "etag": {"key": "properties.etag", "type": "str"}, - "audit_comment": {"key": "properties.auditComment", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( - self, - *, - fqdn_list: List[str], - description: Optional[str] = None, - etag: Optional[str] = None, - audit_comment: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword description: fqdn object description. - :paramtype description: str - :keyword fqdn_list: fqdn list. Required. - :paramtype fqdn_list: list[str] - :keyword etag: etag info. - :paramtype etag: str - :keyword audit_comment: comment for this object. - :paramtype audit_comment: str - """ - super().__init__(**kwargs) - self.description = description - self.fqdn_list = fqdn_list - self.etag = etag - self.audit_comment = audit_comment - self.provisioning_state = None - - -class FqdnListLocalRulestackResourceListResult(_serialization.Model): - """The response of a FqdnListLocalRulestackResource list operation. - - All required parameters must be populated in order to send to Azure. - - :ivar value: The 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 - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[FqdnListLocalRulestackResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: List["_models.FqdnListLocalRulestackResource"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The 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 - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class FrontendSetting(_serialization.Model): - """Frontend setting for Firewall. - - All required parameters must be populated in order to send to Azure. - - :ivar name: Settings name. Required. - :vartype name: str - :ivar protocol: Protocol Type. Required. Known values are: "TCP" and "UDP". - :vartype protocol: str or ~azure.mgmt.paloaltonetworksngfw.models.ProtocolType - :ivar frontend_configuration: Frontend configurations. Required. - :vartype frontend_configuration: ~azure.mgmt.paloaltonetworksngfw.models.EndpointConfiguration - :ivar backend_configuration: Backend configurations. Required. - :vartype backend_configuration: ~azure.mgmt.paloaltonetworksngfw.models.EndpointConfiguration - """ - - _validation = { - "name": {"required": True}, - "protocol": {"required": True}, - "frontend_configuration": {"required": True}, - "backend_configuration": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "protocol": {"key": "protocol", "type": "str"}, - "frontend_configuration": {"key": "frontendConfiguration", "type": "EndpointConfiguration"}, - "backend_configuration": {"key": "backendConfiguration", "type": "EndpointConfiguration"}, - } - - def __init__( - self, - *, - name: str, - protocol: Union[str, "_models.ProtocolType"], - frontend_configuration: "_models.EndpointConfiguration", - backend_configuration: "_models.EndpointConfiguration", - **kwargs: Any - ) -> None: - """ - :keyword name: Settings name. Required. - :paramtype name: str - :keyword protocol: Protocol Type. Required. Known values are: "TCP" and "UDP". - :paramtype protocol: str or ~azure.mgmt.paloaltonetworksngfw.models.ProtocolType - :keyword frontend_configuration: Frontend configurations. Required. - :paramtype frontend_configuration: - ~azure.mgmt.paloaltonetworksngfw.models.EndpointConfiguration - :keyword backend_configuration: Backend configurations. Required. - :paramtype backend_configuration: ~azure.mgmt.paloaltonetworksngfw.models.EndpointConfiguration - """ - super().__init__(**kwargs) - self.name = name - self.protocol = protocol - self.frontend_configuration = frontend_configuration - self.backend_configuration = backend_configuration - - -class GlobalRulestackInfo(_serialization.Model): - """PAN Rulestack Describe Object. - - All required parameters must be populated in order to send to Azure. - - :ivar azure_id: rulestack description. Required. - :vartype azure_id: str - """ - - _validation = { - "azure_id": {"required": True}, - } - - _attribute_map = { - "azure_id": {"key": "azureId", "type": "str"}, - } - - def __init__(self, *, azure_id: str, **kwargs: Any) -> None: - """ - :keyword azure_id: rulestack description. Required. - :paramtype azure_id: str - """ - super().__init__(**kwargs) - self.azure_id = azure_id - - -class GlobalRulestackResource(ProxyResource): # pylint: disable=too-many-instance-attributes - """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. - - :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 location: Global Location. Required. - :vartype location: str - :ivar identity: The managed service identities assigned to this resource. - :vartype identity: - ~azure.mgmt.paloaltonetworksngfw.models.AzureResourceManagerManagedIdentityProperties - :ivar pan_etag: PanEtag info. - :vartype pan_etag: str - :ivar pan_location: Rulestack Location, Required for GlobalRulestacks, Not for LocalRulestacks. - :vartype pan_location: str - :ivar scope: Rulestack Type. Known values are: "LOCAL", "GLOBAL", and "GLOBAL". - :vartype scope: str or ~azure.mgmt.paloaltonetworksngfw.models.ScopeType - :ivar associated_subscriptions: subscription scope of global rulestack. - :vartype associated_subscriptions: list[str] - :ivar description: rulestack description. - :vartype description: str - :ivar default_mode: Mode for default rules creation. Known values are: "IPS", "FIREWALL", and - "NONE". - :vartype default_mode: str or ~azure.mgmt.paloaltonetworksngfw.models.DefaultMode - :ivar min_app_id_version: minimum version. - :vartype min_app_id_version: 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 - :ivar security_services: Security Profile. - :vartype security_services: ~azure.mgmt.paloaltonetworksngfw.models.SecurityServices - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"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"}, - "location": {"key": "location", "type": "str"}, - "identity": {"key": "identity", "type": "AzureResourceManagerManagedIdentityProperties"}, - "pan_etag": {"key": "properties.panEtag", "type": "str"}, - "pan_location": {"key": "properties.panLocation", "type": "str"}, - "scope": {"key": "properties.scope", "type": "str"}, - "associated_subscriptions": {"key": "properties.associatedSubscriptions", "type": "[str]"}, - "description": {"key": "properties.description", "type": "str"}, - "default_mode": {"key": "properties.defaultMode", "type": "str"}, - "min_app_id_version": {"key": "properties.minAppIdVersion", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "security_services": {"key": "properties.securityServices", "type": "SecurityServices"}, - } - - def __init__( - self, - *, - location: str, - 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, - description: Optional[str] = None, - default_mode: Optional[Union[str, "_models.DefaultMode"]] = None, - min_app_id_version: Optional[str] = None, - security_services: Optional["_models.SecurityServices"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Global Location. Required. - :paramtype location: str - :keyword identity: The managed service identities assigned to this resource. - :paramtype identity: - ~azure.mgmt.paloaltonetworksngfw.models.AzureResourceManagerManagedIdentityProperties - :keyword pan_etag: PanEtag info. - :paramtype pan_etag: str - :keyword pan_location: Rulestack Location, Required for GlobalRulestacks, Not for - LocalRulestacks. - :paramtype pan_location: str - :keyword scope: Rulestack Type. Known values are: "LOCAL", "GLOBAL", and "GLOBAL". - :paramtype scope: str or ~azure.mgmt.paloaltonetworksngfw.models.ScopeType - :keyword associated_subscriptions: subscription scope of global rulestack. - :paramtype associated_subscriptions: list[str] - :keyword description: rulestack description. - :paramtype description: str - :keyword default_mode: Mode for default rules creation. Known values are: "IPS", "FIREWALL", - and "NONE". - :paramtype default_mode: str or ~azure.mgmt.paloaltonetworksngfw.models.DefaultMode - :keyword min_app_id_version: minimum version. - :paramtype min_app_id_version: str - :keyword security_services: Security Profile. - :paramtype security_services: ~azure.mgmt.paloaltonetworksngfw.models.SecurityServices - """ - super().__init__(**kwargs) - self.location = location - self.identity = identity - self.pan_etag = pan_etag - self.pan_location = pan_location - self.scope = scope - self.associated_subscriptions = associated_subscriptions - self.description = description - self.default_mode = default_mode - self.min_app_id_version = min_app_id_version - self.provisioning_state = 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. - - :ivar value: The 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 - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[GlobalRulestackResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: List["_models.GlobalRulestackResource"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The 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 - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GlobalRulestackResourceUpdate(_serialization.Model): - """The type used for update operations of the GlobalRulestackResource. - - :ivar location: Global Location. - :vartype location: str - :ivar identity: The managed service identities assigned to this resource. - :vartype identity: - ~azure.mgmt.paloaltonetworksngfw.models.AzureResourceManagerManagedIdentityProperties - :ivar properties: The updatable properties of the GlobalRulestackResource. - :vartype properties: - ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResourceUpdateProperties - """ - - _attribute_map = { - "location": {"key": "location", "type": "str"}, - "identity": {"key": "identity", "type": "AzureResourceManagerManagedIdentityProperties"}, - "properties": {"key": "properties", "type": "GlobalRulestackResourceUpdateProperties"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - identity: Optional["_models.AzureResourceManagerManagedIdentityProperties"] = None, - properties: Optional["_models.GlobalRulestackResourceUpdateProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Global Location. - :paramtype location: str - :keyword identity: The managed service identities assigned to this resource. - :paramtype identity: - ~azure.mgmt.paloaltonetworksngfw.models.AzureResourceManagerManagedIdentityProperties - :keyword properties: The updatable properties of the GlobalRulestackResource. - :paramtype properties: - ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResourceUpdateProperties - """ - super().__init__(**kwargs) - self.location = location - self.identity = identity - self.properties = properties - - -class GlobalRulestackResourceUpdateProperties(_serialization.Model): - """The updatable properties of the GlobalRulestackResource. - - :ivar pan_etag: PanEtag info. - :vartype pan_etag: str - :ivar pan_location: Rulestack Location, Required for GlobalRulestacks, Not for LocalRulestacks. - :vartype pan_location: str - :ivar scope: Rulestack Type. Known values are: "LOCAL", "GLOBAL", and "GLOBAL". - :vartype scope: str or ~azure.mgmt.paloaltonetworksngfw.models.ScopeType - :ivar associated_subscriptions: subscription scope of global rulestack. - :vartype associated_subscriptions: list[str] - :ivar description: rulestack description. - :vartype description: str - :ivar default_mode: Mode for default rules creation. Known values are: "IPS", "FIREWALL", and - "NONE". - :vartype default_mode: str or ~azure.mgmt.paloaltonetworksngfw.models.DefaultMode - :ivar min_app_id_version: minimum version. - :vartype min_app_id_version: str - :ivar security_services: Security Profile. - :vartype security_services: ~azure.mgmt.paloaltonetworksngfw.models.SecurityServices - """ - - _attribute_map = { - "pan_etag": {"key": "panEtag", "type": "str"}, - "pan_location": {"key": "panLocation", "type": "str"}, - "scope": {"key": "scope", "type": "str"}, - "associated_subscriptions": {"key": "associatedSubscriptions", "type": "[str]"}, - "description": {"key": "description", "type": "str"}, - "default_mode": {"key": "defaultMode", "type": "str"}, - "min_app_id_version": {"key": "minAppIdVersion", "type": "str"}, - "security_services": {"key": "securityServices", "type": "SecurityServices"}, - } - - def __init__( - self, - *, - pan_etag: Optional[str] = None, - pan_location: Optional[str] = None, - scope: Optional[Union[str, "_models.ScopeType"]] = 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, - security_services: Optional["_models.SecurityServices"] = None, - **kwargs: Any - ) -> None: - """ - :keyword pan_etag: PanEtag info. - :paramtype pan_etag: str - :keyword pan_location: Rulestack Location, Required for GlobalRulestacks, Not for - LocalRulestacks. - :paramtype pan_location: str - :keyword scope: Rulestack Type. Known values are: "LOCAL", "GLOBAL", and "GLOBAL". - :paramtype scope: str or ~azure.mgmt.paloaltonetworksngfw.models.ScopeType - :keyword associated_subscriptions: subscription scope of global rulestack. - :paramtype associated_subscriptions: list[str] - :keyword description: rulestack description. - :paramtype description: str - :keyword default_mode: Mode for default rules creation. Known values are: "IPS", "FIREWALL", - and "NONE". - :paramtype default_mode: str or ~azure.mgmt.paloaltonetworksngfw.models.DefaultMode - :keyword min_app_id_version: minimum version. - :paramtype min_app_id_version: str - :keyword security_services: Security Profile. - :paramtype security_services: ~azure.mgmt.paloaltonetworksngfw.models.SecurityServices - """ - super().__init__(**kwargs) - self.pan_etag = pan_etag - self.pan_location = pan_location - self.scope = scope - self.associated_subscriptions = associated_subscriptions - self.description = description - self.default_mode = default_mode - self.min_app_id_version = min_app_id_version - self.security_services = security_services - - -class IPAddress(_serialization.Model): - """IP Address. - - :ivar resource_id: Resource Id. - :vartype resource_id: str - :ivar address: Address value. - :vartype address: str - """ - - _attribute_map = { - "resource_id": {"key": "resourceId", "type": "str"}, - "address": {"key": "address", "type": "str"}, - } - - def __init__(self, *, resource_id: Optional[str] = None, address: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id. - :paramtype resource_id: str - :keyword address: Address value. - :paramtype address: str - """ - super().__init__(**kwargs) - self.resource_id = resource_id - self.address = address - - -class IPAddressSpace(_serialization.Model): - """IP Address Space. - - :ivar resource_id: Resource Id. - :vartype resource_id: str - :ivar address_space: Address Space. - :vartype address_space: str - """ - - _attribute_map = { - "resource_id": {"key": "resourceId", "type": "str"}, - "address_space": {"key": "addressSpace", "type": "str"}, - } - - def __init__( - self, *, resource_id: Optional[str] = None, address_space: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword resource_id: Resource Id. - :paramtype resource_id: str - :keyword address_space: Address Space. - :paramtype address_space: str - """ - super().__init__(**kwargs) - self.resource_id = resource_id - self.address_space = address_space - - -class ListAppIdResponse(_serialization.Model): - """ListAppIdResponse. - - All required parameters must be populated in order to send to Azure. - - :ivar value: List of AppIds. Required. - :vartype value: list[str] - :ivar next_link: next Link. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[str]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List[str], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: List of AppIds. Required. - :paramtype value: list[str] - :keyword next_link: next Link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ListFirewallsResponse(_serialization.Model): - """List firewalls response. - - All required parameters must be populated in order to send to Azure. - - :ivar value: firewalls list. Required. - :vartype value: list[str] - :ivar next_link: next link. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[str]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List[str], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: firewalls list. Required. - :paramtype value: list[str] - :keyword next_link: next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class LocalRulesResource(ProxyResource): # pylint: disable=too-many-instance-attributes - """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. - - :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 etag: etag info. - :vartype etag: str - :ivar rule_name: rule name. Required. - :vartype rule_name: str - :ivar priority: - :vartype priority: int - :ivar description: rule description. - :vartype description: str - :ivar rule_state: state of this rule. Known values are: "DISABLED" and "ENABLED". - :vartype rule_state: str or ~azure.mgmt.paloaltonetworksngfw.models.StateEnum - :ivar source: source address. - :vartype source: ~azure.mgmt.paloaltonetworksngfw.models.SourceAddr - :ivar negate_source: cidr should not be 'any'. Known values are: "TRUE" and "FALSE". - :vartype negate_source: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum - :ivar destination: destination address. - :vartype destination: ~azure.mgmt.paloaltonetworksngfw.models.DestinationAddr - :ivar negate_destination: cidr should not be 'any'. Known values are: "TRUE" and "FALSE". - :vartype negate_destination: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum - :ivar applications: array of rule applications. - :vartype applications: list[str] - :ivar category: rule category. - :vartype category: ~azure.mgmt.paloaltonetworksngfw.models.Category - :ivar protocol: any, application-default, TCP:number, UDP:number. - :vartype protocol: str - :ivar protocol_port_list: prot port list. - :vartype protocol_port_list: list[str] - :ivar inbound_inspection_certificate: inbound Inspection Certificate. - :vartype inbound_inspection_certificate: str - :ivar audit_comment: rule comment. - :vartype audit_comment: str - :ivar action_type: rule action. Known values are: "Allow", "DenySilent", "DenyResetServer", and - "DenyResetBoth". - :vartype action_type: str or ~azure.mgmt.paloaltonetworksngfw.models.ActionEnum - :ivar enable_logging: enable or disable logging. Known values are: "DISABLED" and "ENABLED". - :vartype enable_logging: str or ~azure.mgmt.paloaltonetworksngfw.models.StateEnum - :ivar decryption_rule_type: enable or disable decryption. Known values are: - "SSLOutboundInspection", "SSLInboundInspection", and "None". - :vartype decryption_rule_type: str or - ~azure.mgmt.paloaltonetworksngfw.models.DecryptionRuleTypeEnum - :ivar tags: tag for rule. - :vartype tags: list[~azure.mgmt.paloaltonetworksngfw.models.TagInfo] - :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}, - "rule_name": {"required": True}, - "priority": {"readonly": 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"}, - "etag": {"key": "properties.etag", "type": "str"}, - "rule_name": {"key": "properties.ruleName", "type": "str"}, - "priority": {"key": "properties.priority", "type": "int"}, - "description": {"key": "properties.description", "type": "str"}, - "rule_state": {"key": "properties.ruleState", "type": "str"}, - "source": {"key": "properties.source", "type": "SourceAddr"}, - "negate_source": {"key": "properties.negateSource", "type": "str"}, - "destination": {"key": "properties.destination", "type": "DestinationAddr"}, - "negate_destination": {"key": "properties.negateDestination", "type": "str"}, - "applications": {"key": "properties.applications", "type": "[str]"}, - "category": {"key": "properties.category", "type": "Category"}, - "protocol": {"key": "properties.protocol", "type": "str"}, - "protocol_port_list": {"key": "properties.protocolPortList", "type": "[str]"}, - "inbound_inspection_certificate": {"key": "properties.inboundInspectionCertificate", "type": "str"}, - "audit_comment": {"key": "properties.auditComment", "type": "str"}, - "action_type": {"key": "properties.actionType", "type": "str"}, - "enable_logging": {"key": "properties.enableLogging", "type": "str"}, - "decryption_rule_type": {"key": "properties.decryptionRuleType", "type": "str"}, - "tags": {"key": "properties.tags", "type": "[TagInfo]"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - rule_name: str, - etag: Optional[str] = None, - description: Optional[str] = None, - rule_state: Optional[Union[str, "_models.StateEnum"]] = None, - source: Optional["_models.SourceAddr"] = None, - 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, - category: Optional["_models.Category"] = None, - protocol: str = "application-default", - 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, - **kwargs: Any - ) -> None: - """ - :keyword etag: etag info. - :paramtype etag: str - :keyword rule_name: rule name. Required. - :paramtype rule_name: str - :keyword description: rule description. - :paramtype description: str - :keyword rule_state: state of this rule. Known values are: "DISABLED" and "ENABLED". - :paramtype rule_state: str or ~azure.mgmt.paloaltonetworksngfw.models.StateEnum - :keyword source: source address. - :paramtype source: ~azure.mgmt.paloaltonetworksngfw.models.SourceAddr - :keyword negate_source: cidr should not be 'any'. Known values are: "TRUE" and "FALSE". - :paramtype negate_source: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum - :keyword destination: destination address. - :paramtype destination: ~azure.mgmt.paloaltonetworksngfw.models.DestinationAddr - :keyword negate_destination: cidr should not be 'any'. Known values are: "TRUE" and "FALSE". - :paramtype negate_destination: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum - :keyword applications: array of rule applications. - :paramtype applications: list[str] - :keyword category: rule category. - :paramtype category: ~azure.mgmt.paloaltonetworksngfw.models.Category - :keyword protocol: any, application-default, TCP:number, UDP:number. - :paramtype protocol: str - :keyword protocol_port_list: prot port list. - :paramtype protocol_port_list: list[str] - :keyword inbound_inspection_certificate: inbound Inspection Certificate. - :paramtype inbound_inspection_certificate: str - :keyword audit_comment: rule comment. - :paramtype audit_comment: str - :keyword action_type: rule action. Known values are: "Allow", "DenySilent", "DenyResetServer", - and "DenyResetBoth". - :paramtype action_type: str or ~azure.mgmt.paloaltonetworksngfw.models.ActionEnum - :keyword enable_logging: enable or disable logging. Known values are: "DISABLED" and "ENABLED". - :paramtype enable_logging: str or ~azure.mgmt.paloaltonetworksngfw.models.StateEnum - :keyword decryption_rule_type: enable or disable decryption. Known values are: - "SSLOutboundInspection", "SSLInboundInspection", and "None". - :paramtype decryption_rule_type: str or - ~azure.mgmt.paloaltonetworksngfw.models.DecryptionRuleTypeEnum - :keyword tags: tag for rule. - :paramtype tags: list[~azure.mgmt.paloaltonetworksngfw.models.TagInfo] - """ - super().__init__(**kwargs) - self.etag = etag - self.rule_name = rule_name - self.priority = None - self.description = description - self.rule_state = rule_state - self.source = source - self.negate_source = negate_source - self.destination = destination - self.negate_destination = negate_destination - self.applications = applications - self.category = category - self.protocol = protocol - self.protocol_port_list = protocol_port_list - self.inbound_inspection_certificate = inbound_inspection_certificate - self.audit_comment = audit_comment - self.action_type = action_type - self.enable_logging = enable_logging - self.decryption_rule_type = decryption_rule_type - self.tags = tags - self.provisioning_state = None - - -class LocalRulesResourceListResult(_serialization.Model): - """The response of a LocalRulesResource list operation. - - All required parameters must be populated in order to send to Azure. - - :ivar value: The 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 - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[LocalRulesResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: List["_models.LocalRulesResource"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The 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 - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class LocalRulestackResource(TrackedResource): # pylint: disable=too-many-instance-attributes - """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. - - :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 tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar identity: The managed service identities assigned to this resource. - :vartype identity: - ~azure.mgmt.paloaltonetworksngfw.models.AzureResourceManagerManagedIdentityProperties - :ivar pan_etag: PanEtag info. - :vartype pan_etag: str - :ivar pan_location: Rulestack Location, Required for GlobalRulestacks, Not for LocalRulestacks. - :vartype pan_location: str - :ivar scope: Rulestack Type. Known values are: "LOCAL", "GLOBAL", and "GLOBAL". - :vartype scope: str or ~azure.mgmt.paloaltonetworksngfw.models.ScopeType - :ivar associated_subscriptions: subscription scope of global rulestack. - :vartype associated_subscriptions: list[str] - :ivar description: rulestack description. - :vartype description: str - :ivar default_mode: Mode for default rules creation. Known values are: "IPS", "FIREWALL", and - "NONE". - :vartype default_mode: str or ~azure.mgmt.paloaltonetworksngfw.models.DefaultMode - :ivar min_app_id_version: minimum version. - :vartype min_app_id_version: 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 - :ivar security_services: Security Profile. - :vartype security_services: ~azure.mgmt.paloaltonetworksngfw.models.SecurityServices - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"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"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "identity": {"key": "identity", "type": "AzureResourceManagerManagedIdentityProperties"}, - "pan_etag": {"key": "properties.panEtag", "type": "str"}, - "pan_location": {"key": "properties.panLocation", "type": "str"}, - "scope": {"key": "properties.scope", "type": "str"}, - "associated_subscriptions": {"key": "properties.associatedSubscriptions", "type": "[str]"}, - "description": {"key": "properties.description", "type": "str"}, - "default_mode": {"key": "properties.defaultMode", "type": "str"}, - "min_app_id_version": {"key": "properties.minAppIdVersion", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "security_services": {"key": "properties.securityServices", "type": "SecurityServices"}, - } - - def __init__( - self, - *, - location: str, - 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, - description: Optional[str] = None, - default_mode: Optional[Union[str, "_models.DefaultMode"]] = None, - min_app_id_version: Optional[str] = None, - security_services: Optional["_models.SecurityServices"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword identity: The managed service identities assigned to this resource. - :paramtype identity: - ~azure.mgmt.paloaltonetworksngfw.models.AzureResourceManagerManagedIdentityProperties - :keyword pan_etag: PanEtag info. - :paramtype pan_etag: str - :keyword pan_location: Rulestack Location, Required for GlobalRulestacks, Not for - LocalRulestacks. - :paramtype pan_location: str - :keyword scope: Rulestack Type. Known values are: "LOCAL", "GLOBAL", and "GLOBAL". - :paramtype scope: str or ~azure.mgmt.paloaltonetworksngfw.models.ScopeType - :keyword associated_subscriptions: subscription scope of global rulestack. - :paramtype associated_subscriptions: list[str] - :keyword description: rulestack description. - :paramtype description: str - :keyword default_mode: Mode for default rules creation. Known values are: "IPS", "FIREWALL", - and "NONE". - :paramtype default_mode: str or ~azure.mgmt.paloaltonetworksngfw.models.DefaultMode - :keyword min_app_id_version: minimum version. - :paramtype min_app_id_version: str - :keyword security_services: Security Profile. - :paramtype security_services: ~azure.mgmt.paloaltonetworksngfw.models.SecurityServices - """ - super().__init__(tags=tags, location=location, **kwargs) - self.identity = identity - self.pan_etag = pan_etag - self.pan_location = pan_location - self.scope = scope - self.associated_subscriptions = associated_subscriptions - self.description = description - self.default_mode = default_mode - self.min_app_id_version = min_app_id_version - self.provisioning_state = 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. - - :ivar value: The 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 - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[LocalRulestackResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: List["_models.LocalRulestackResource"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The 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 - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class LocalRulestackResourceUpdate(_serialization.Model): - """The type used for update operations of the LocalRulestackResource. - - :ivar identity: The managed service identities assigned to this resource. - :vartype identity: - ~azure.mgmt.paloaltonetworksngfw.models.AzureResourceManagerManagedIdentityProperties - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar properties: The updatable properties of the LocalRulestackResource. - :vartype properties: - ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResourceUpdateProperties - """ - - _attribute_map = { - "identity": {"key": "identity", "type": "AzureResourceManagerManagedIdentityProperties"}, - "tags": {"key": "tags", "type": "{str}"}, - "properties": {"key": "properties", "type": "LocalRulestackResourceUpdateProperties"}, - } - - def __init__( - self, - *, - identity: Optional["_models.AzureResourceManagerManagedIdentityProperties"] = None, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.LocalRulestackResourceUpdateProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword identity: The managed service identities assigned to this resource. - :paramtype identity: - ~azure.mgmt.paloaltonetworksngfw.models.AzureResourceManagerManagedIdentityProperties - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword properties: The updatable properties of the LocalRulestackResource. - :paramtype properties: - ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResourceUpdateProperties - """ - super().__init__(**kwargs) - self.identity = identity - self.tags = tags - self.properties = properties - - -class LocalRulestackResourceUpdateProperties(_serialization.Model): - """The updatable properties of the LocalRulestackResource. - - :ivar pan_etag: PanEtag info. - :vartype pan_etag: str - :ivar pan_location: Rulestack Location, Required for GlobalRulestacks, Not for LocalRulestacks. - :vartype pan_location: str - :ivar scope: Rulestack Type. Known values are: "LOCAL", "GLOBAL", and "GLOBAL". - :vartype scope: str or ~azure.mgmt.paloaltonetworksngfw.models.ScopeType - :ivar associated_subscriptions: subscription scope of global rulestack. - :vartype associated_subscriptions: list[str] - :ivar description: rulestack description. - :vartype description: str - :ivar default_mode: Mode for default rules creation. Known values are: "IPS", "FIREWALL", and - "NONE". - :vartype default_mode: str or ~azure.mgmt.paloaltonetworksngfw.models.DefaultMode - :ivar min_app_id_version: minimum version. - :vartype min_app_id_version: str - :ivar security_services: Security Profile. - :vartype security_services: ~azure.mgmt.paloaltonetworksngfw.models.SecurityServices - """ - - _attribute_map = { - "pan_etag": {"key": "panEtag", "type": "str"}, - "pan_location": {"key": "panLocation", "type": "str"}, - "scope": {"key": "scope", "type": "str"}, - "associated_subscriptions": {"key": "associatedSubscriptions", "type": "[str]"}, - "description": {"key": "description", "type": "str"}, - "default_mode": {"key": "defaultMode", "type": "str"}, - "min_app_id_version": {"key": "minAppIdVersion", "type": "str"}, - "security_services": {"key": "securityServices", "type": "SecurityServices"}, - } - - def __init__( - self, - *, - pan_etag: Optional[str] = None, - pan_location: Optional[str] = None, - scope: Optional[Union[str, "_models.ScopeType"]] = 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, - security_services: Optional["_models.SecurityServices"] = None, - **kwargs: Any - ) -> None: - """ - :keyword pan_etag: PanEtag info. - :paramtype pan_etag: str - :keyword pan_location: Rulestack Location, Required for GlobalRulestacks, Not for - LocalRulestacks. - :paramtype pan_location: str - :keyword scope: Rulestack Type. Known values are: "LOCAL", "GLOBAL", and "GLOBAL". - :paramtype scope: str or ~azure.mgmt.paloaltonetworksngfw.models.ScopeType - :keyword associated_subscriptions: subscription scope of global rulestack. - :paramtype associated_subscriptions: list[str] - :keyword description: rulestack description. - :paramtype description: str - :keyword default_mode: Mode for default rules creation. Known values are: "IPS", "FIREWALL", - and "NONE". - :paramtype default_mode: str or ~azure.mgmt.paloaltonetworksngfw.models.DefaultMode - :keyword min_app_id_version: minimum version. - :paramtype min_app_id_version: str - :keyword security_services: Security Profile. - :paramtype security_services: ~azure.mgmt.paloaltonetworksngfw.models.SecurityServices - """ - super().__init__(**kwargs) - self.pan_etag = pan_etag - self.pan_location = pan_location - self.scope = scope - self.associated_subscriptions = associated_subscriptions - self.description = description - self.default_mode = default_mode - self.min_app_id_version = min_app_id_version - self.security_services = security_services - - -class LogDestination(_serialization.Model): - """Log Destination. - - :ivar storage_configurations: Storage account configurations. - :vartype storage_configurations: ~azure.mgmt.paloaltonetworksngfw.models.StorageAccount - :ivar event_hub_configurations: Event Hub configurations. - :vartype event_hub_configurations: ~azure.mgmt.paloaltonetworksngfw.models.EventHub - :ivar monitor_configurations: Monitor Log configurations. - :vartype monitor_configurations: ~azure.mgmt.paloaltonetworksngfw.models.MonitorLog - """ - - _attribute_map = { - "storage_configurations": {"key": "storageConfigurations", "type": "StorageAccount"}, - "event_hub_configurations": {"key": "eventHubConfigurations", "type": "EventHub"}, - "monitor_configurations": {"key": "monitorConfigurations", "type": "MonitorLog"}, - } - - def __init__( - self, - *, - storage_configurations: Optional["_models.StorageAccount"] = None, - event_hub_configurations: Optional["_models.EventHub"] = None, - monitor_configurations: Optional["_models.MonitorLog"] = None, - **kwargs: Any - ) -> None: - """ - :keyword storage_configurations: Storage account configurations. - :paramtype storage_configurations: ~azure.mgmt.paloaltonetworksngfw.models.StorageAccount - :keyword event_hub_configurations: Event Hub configurations. - :paramtype event_hub_configurations: ~azure.mgmt.paloaltonetworksngfw.models.EventHub - :keyword monitor_configurations: Monitor Log configurations. - :paramtype monitor_configurations: ~azure.mgmt.paloaltonetworksngfw.models.MonitorLog - """ - super().__init__(**kwargs) - self.storage_configurations = storage_configurations - self.event_hub_configurations = event_hub_configurations - self.monitor_configurations = monitor_configurations - - -class LogSettings(_serialization.Model): - """Log Settings for Firewall. - - :ivar log_type: One of possible log type. Known values are: "TRAFFIC", "THREAT", "DECRYPTION", - "WILDFIRE", "DLP", and "AUDIT". - :vartype log_type: str or ~azure.mgmt.paloaltonetworksngfw.models.LogType - :ivar log_option: Log option SAME/INDIVIDUAL. Known values are: "SAME_DESTINATION" and - "INDIVIDUAL_DESTINATION". - :vartype log_option: str or ~azure.mgmt.paloaltonetworksngfw.models.LogOption - :ivar application_insights: Application Insight details. - :vartype application_insights: ~azure.mgmt.paloaltonetworksngfw.models.ApplicationInsights - :ivar common_destination: Common destination configurations. - :vartype common_destination: ~azure.mgmt.paloaltonetworksngfw.models.LogDestination - :ivar traffic_log_destination: Traffic destination configurations. - :vartype traffic_log_destination: ~azure.mgmt.paloaltonetworksngfw.models.LogDestination - :ivar threat_log_destination: Threat destination configurations. - :vartype threat_log_destination: ~azure.mgmt.paloaltonetworksngfw.models.LogDestination - :ivar decrypt_log_destination: Decrypt destination configurations. - :vartype decrypt_log_destination: ~azure.mgmt.paloaltonetworksngfw.models.LogDestination - """ - - _attribute_map = { - "log_type": {"key": "logType", "type": "str"}, - "log_option": {"key": "logOption", "type": "str"}, - "application_insights": {"key": "applicationInsights", "type": "ApplicationInsights"}, - "common_destination": {"key": "commonDestination", "type": "LogDestination"}, - "traffic_log_destination": {"key": "trafficLogDestination", "type": "LogDestination"}, - "threat_log_destination": {"key": "threatLogDestination", "type": "LogDestination"}, - "decrypt_log_destination": {"key": "decryptLogDestination", "type": "LogDestination"}, - } - - def __init__( - self, - *, - log_type: Optional[Union[str, "_models.LogType"]] = None, - log_option: Optional[Union[str, "_models.LogOption"]] = None, - application_insights: Optional["_models.ApplicationInsights"] = None, - common_destination: Optional["_models.LogDestination"] = None, - traffic_log_destination: Optional["_models.LogDestination"] = None, - threat_log_destination: Optional["_models.LogDestination"] = None, - decrypt_log_destination: Optional["_models.LogDestination"] = None, - **kwargs: Any - ) -> None: - """ - :keyword log_type: One of possible log type. Known values are: "TRAFFIC", "THREAT", - "DECRYPTION", "WILDFIRE", "DLP", and "AUDIT". - :paramtype log_type: str or ~azure.mgmt.paloaltonetworksngfw.models.LogType - :keyword log_option: Log option SAME/INDIVIDUAL. Known values are: "SAME_DESTINATION" and - "INDIVIDUAL_DESTINATION". - :paramtype log_option: str or ~azure.mgmt.paloaltonetworksngfw.models.LogOption - :keyword application_insights: Application Insight details. - :paramtype application_insights: ~azure.mgmt.paloaltonetworksngfw.models.ApplicationInsights - :keyword common_destination: Common destination configurations. - :paramtype common_destination: ~azure.mgmt.paloaltonetworksngfw.models.LogDestination - :keyword traffic_log_destination: Traffic destination configurations. - :paramtype traffic_log_destination: ~azure.mgmt.paloaltonetworksngfw.models.LogDestination - :keyword threat_log_destination: Threat destination configurations. - :paramtype threat_log_destination: ~azure.mgmt.paloaltonetworksngfw.models.LogDestination - :keyword decrypt_log_destination: Decrypt destination configurations. - :paramtype decrypt_log_destination: ~azure.mgmt.paloaltonetworksngfw.models.LogDestination - """ - super().__init__(**kwargs) - self.log_type = log_type - self.log_option = log_option - self.application_insights = application_insights - self.common_destination = common_destination - self.traffic_log_destination = traffic_log_destination - self.threat_log_destination = threat_log_destination - self.decrypt_log_destination = decrypt_log_destination - - -class MarketplaceDetails(_serialization.Model): - """MarketplaceDetails of PAN Firewall 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. - - :ivar marketplace_subscription_id: Marketplace Subscription Id. - :vartype marketplace_subscription_id: str - :ivar offer_id: Offer Id. Required. - :vartype offer_id: str - :ivar publisher_id: Publisher Id. Required. - :vartype publisher_id: str - :ivar marketplace_subscription_status: Marketplace Subscription Status. Known values are: - "PendingFulfillmentStart", "Subscribed", "Suspended", "Unsubscribed", "NotStarted", and - "FulfillmentRequested". - :vartype marketplace_subscription_status: str or - ~azure.mgmt.paloaltonetworksngfw.models.MarketplaceSubscriptionStatus - """ - - _validation = { - "marketplace_subscription_id": {"readonly": True}, - "offer_id": {"required": True}, - "publisher_id": {"required": True}, - } - - _attribute_map = { - "marketplace_subscription_id": {"key": "marketplaceSubscriptionId", "type": "str"}, - "offer_id": {"key": "offerId", "type": "str"}, - "publisher_id": {"key": "publisherId", "type": "str"}, - "marketplace_subscription_status": {"key": "marketplaceSubscriptionStatus", "type": "str"}, - } - - def __init__( - self, - *, - offer_id: str, - publisher_id: str, - marketplace_subscription_status: Optional[Union[str, "_models.MarketplaceSubscriptionStatus"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword offer_id: Offer Id. Required. - :paramtype offer_id: str - :keyword publisher_id: Publisher Id. Required. - :paramtype publisher_id: str - :keyword marketplace_subscription_status: Marketplace Subscription Status. Known values are: - "PendingFulfillmentStart", "Subscribed", "Suspended", "Unsubscribed", "NotStarted", and - "FulfillmentRequested". - :paramtype marketplace_subscription_status: str or - ~azure.mgmt.paloaltonetworksngfw.models.MarketplaceSubscriptionStatus - """ - super().__init__(**kwargs) - self.marketplace_subscription_id = None - self.offer_id = offer_id - self.publisher_id = publisher_id - self.marketplace_subscription_status = marketplace_subscription_status - - -class MonitorLog(_serialization.Model): - """MonitorLog configurations. - - :ivar id: Resource ID of MonitorLog. - :vartype id: str - :ivar subscription_id: Subscription Id. - :vartype subscription_id: str - :ivar workspace: MonitorLog workspace. - :vartype workspace: str - :ivar primary_key: Primary Key value for Monitor. - :vartype primary_key: str - :ivar secondary_key: Secondary Key value for Monitor. - :vartype secondary_key: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "subscription_id": {"key": "subscriptionId", "type": "str"}, - "workspace": {"key": "workspace", "type": "str"}, - "primary_key": {"key": "primaryKey", "type": "str"}, - "secondary_key": {"key": "secondaryKey", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - subscription_id: Optional[str] = None, - workspace: Optional[str] = None, - primary_key: Optional[str] = None, - secondary_key: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Resource ID of MonitorLog. - :paramtype id: str - :keyword subscription_id: Subscription Id. - :paramtype subscription_id: str - :keyword workspace: MonitorLog workspace. - :paramtype workspace: str - :keyword primary_key: Primary Key value for Monitor. - :paramtype primary_key: str - :keyword secondary_key: Secondary Key value for Monitor. - :paramtype secondary_key: str - """ - super().__init__(**kwargs) - self.id = id - self.subscription_id = subscription_id - self.workspace = workspace - self.primary_key = primary_key - self.secondary_key = secondary_key - - -class NameDescriptionObject(_serialization.Model): - """object type info. - - All required parameters must be populated in order to send to Azure. - - :ivar name: name value. Required. - :vartype name: str - :ivar description: description value. - :vartype description: str - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__(self, *, name: str, description: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: name value. Required. - :paramtype name: str - :keyword description: description value. - :paramtype description: str - """ - super().__init__(**kwargs) - self.name = name - self.description = description - - -class NetworkProfile(_serialization.Model): - """Network settings for Firewall. - - All required parameters must be populated in order to send to Azure. - - :ivar vnet_configuration: Vnet configurations. - :vartype vnet_configuration: ~azure.mgmt.paloaltonetworksngfw.models.VnetConfiguration - :ivar vwan_configuration: Vwan configurations. - :vartype vwan_configuration: ~azure.mgmt.paloaltonetworksngfw.models.VwanConfiguration - :ivar network_type: vnet or vwan, cannot be updated. Required. Known values are: "VNET" and - "VWAN". - :vartype network_type: str or ~azure.mgmt.paloaltonetworksngfw.models.NetworkType - :ivar public_ips: List of IPs associated with the Firewall. Required. - :vartype public_ips: list[~azure.mgmt.paloaltonetworksngfw.models.IPAddress] - :ivar enable_egress_nat: Enable egress NAT, enabled by default. Required. Known values are: - "DISABLED" and "ENABLED". - :vartype enable_egress_nat: str or ~azure.mgmt.paloaltonetworksngfw.models.EgressNat - :ivar egress_nat_ip: Egress nat IP to use. - :vartype egress_nat_ip: list[~azure.mgmt.paloaltonetworksngfw.models.IPAddress] - :ivar trusted_ranges: Non-RFC 1918 address. - :vartype trusted_ranges: list[str] - """ - - _validation = { - "network_type": {"required": True}, - "public_ips": {"required": True}, - "enable_egress_nat": {"required": True}, - } - - _attribute_map = { - "vnet_configuration": {"key": "vnetConfiguration", "type": "VnetConfiguration"}, - "vwan_configuration": {"key": "vwanConfiguration", "type": "VwanConfiguration"}, - "network_type": {"key": "networkType", "type": "str"}, - "public_ips": {"key": "publicIps", "type": "[IPAddress]"}, - "enable_egress_nat": {"key": "enableEgressNat", "type": "str"}, - "egress_nat_ip": {"key": "egressNatIp", "type": "[IPAddress]"}, - "trusted_ranges": {"key": "trustedRanges", "type": "[str]"}, - } - - def __init__( - self, - *, - network_type: Union[str, "_models.NetworkType"], - 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, - **kwargs: Any - ) -> None: - """ - :keyword vnet_configuration: Vnet configurations. - :paramtype vnet_configuration: ~azure.mgmt.paloaltonetworksngfw.models.VnetConfiguration - :keyword vwan_configuration: Vwan configurations. - :paramtype vwan_configuration: ~azure.mgmt.paloaltonetworksngfw.models.VwanConfiguration - :keyword network_type: vnet or vwan, cannot be updated. Required. Known values are: "VNET" and - "VWAN". - :paramtype network_type: str or ~azure.mgmt.paloaltonetworksngfw.models.NetworkType - :keyword public_ips: List of IPs associated with the Firewall. Required. - :paramtype public_ips: list[~azure.mgmt.paloaltonetworksngfw.models.IPAddress] - :keyword enable_egress_nat: Enable egress NAT, enabled by default. Required. Known values are: - "DISABLED" and "ENABLED". - :paramtype enable_egress_nat: str or ~azure.mgmt.paloaltonetworksngfw.models.EgressNat - :keyword egress_nat_ip: Egress nat IP to use. - :paramtype egress_nat_ip: list[~azure.mgmt.paloaltonetworksngfw.models.IPAddress] - :keyword trusted_ranges: Non-RFC 1918 address. - :paramtype trusted_ranges: list[str] - """ - super().__init__(**kwargs) - self.vnet_configuration = vnet_configuration - self.vwan_configuration = vwan_configuration - self.network_type = network_type - self.public_ips = public_ips - self.enable_egress_nat = enable_egress_nat - self.egress_nat_ip = egress_nat_ip - self.trusted_ranges = trusted_ranges - - -class Operation(_serialization.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - :vartype name: str - :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for - data-plane operations and "false" for ARM/control-plane operations. - :vartype is_data_action: bool - :ivar display: Localized display information for this particular operation. - :vartype display: ~azure.mgmt.paloaltonetworksngfw.models.OperationDisplay - :ivar origin: The intended executor of the operation; as in Resource Based Access Control - (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", - and "user,system". - :vartype origin: str or ~azure.mgmt.paloaltonetworksngfw.models.Origin - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" - :vartype action_type: str or ~azure.mgmt.paloaltonetworksngfw.models.ActionType - """ - - _validation = { - "name": {"readonly": True}, - "is_data_action": {"readonly": True}, - "origin": {"readonly": True}, - "action_type": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - "display": {"key": "display", "type": "OperationDisplay"}, - "origin": {"key": "origin", "type": "str"}, - "action_type": {"key": "actionType", "type": "str"}, - } - - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: - """ - :keyword display: Localized display information for this particular operation. - :paramtype display: ~azure.mgmt.paloaltonetworksngfw.models.OperationDisplay - """ - super().__init__(**kwargs) - self.name = None - self.is_data_action = None - self.display = display - self.origin = None - self.action_type = None - - -class OperationDisplay(_serialization.Model): - """Localized display information for this particular operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft - Monitoring Insights" or "Microsoft Compute". - :vartype provider: str - :ivar resource: The localized friendly name of the resource type related to this operation. - E.g. "Virtual Machines" or "Job Schedule Collections". - :vartype resource: str - :ivar operation: The concise, localized friendly name for the operation; suitable for - dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - :vartype operation: str - :ivar description: The short, localized friendly description of the operation; suitable for - tool tips and detailed views. - :vartype description: str - """ - - _validation = { - "provider": {"readonly": True}, - "resource": {"readonly": True}, - "operation": {"readonly": True}, - "description": {"readonly": True}, - } - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None - self.description = None - - -class OperationListResult(_serialization.Model): - """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link - to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of operations supported by the resource provider. - :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.Operation] - :ivar next_link: URL to get the next set of operation list results (if there are any). - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - self.next_link = None - - -class PanoramaConfig(_serialization.Model): - """Panorama Config. - - 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. - - :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. - Required. - :vartype config_string: str - :ivar vm_auth_key: VM auth key for panorama connectivity. - :vartype vm_auth_key: str - :ivar panorama_server: Primary Panorama Server IP address value in dotted format for IPv4. - :vartype panorama_server: str - :ivar panorama_server2: Secondary Panorama Server IP address value in dotted format for IPv4. - :vartype panorama_server2: str - :ivar dg_name: Panorama Device Group to join. - :vartype dg_name: str - :ivar tpl_name: Panorama Template Stack to join - (Once configured we can not edit the value). - :vartype tpl_name: str - :ivar cg_name: Panorama Collector Group to join - (Once configured we can not edit the value). - :vartype cg_name: str - :ivar host_name: Resource name(may be unique) for PN admin. - :vartype host_name: str - """ - - _validation = { - "config_string": {"required": True}, - "vm_auth_key": {"readonly": True}, - "panorama_server": {"readonly": True}, - "panorama_server2": {"readonly": True}, - "dg_name": {"readonly": True}, - "tpl_name": {"readonly": True}, - "cg_name": {"readonly": True}, - "host_name": {"readonly": True}, - } - - _attribute_map = { - "config_string": {"key": "configString", "type": "str"}, - "vm_auth_key": {"key": "vmAuthKey", "type": "str"}, - "panorama_server": {"key": "panoramaServer", "type": "str"}, - "panorama_server2": {"key": "panoramaServer2", "type": "str"}, - "dg_name": {"key": "dgName", "type": "str"}, - "tpl_name": {"key": "tplName", "type": "str"}, - "cg_name": {"key": "cgName", "type": "str"}, - "host_name": {"key": "hostName", "type": "str"}, - } - - def __init__(self, *, config_string: str, **kwargs: Any) -> None: - """ - :keyword 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. - Required. - :paramtype config_string: str - """ - 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 - - -class PanoramaStatus(_serialization.Model): - """Panorama connectivity information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar panorama_server_status: Primary Panorama connection status. Known values are: "UP" and - "DOWN". - :vartype panorama_server_status: str or ~azure.mgmt.paloaltonetworksngfw.models.ServerStatus - :ivar panorama_server2_status: Secondary Panorama connection status. Known values are: "UP" and - "DOWN". - :vartype panorama_server2_status: str or ~azure.mgmt.paloaltonetworksngfw.models.ServerStatus - """ - - _validation = { - "panorama_server_status": {"readonly": True}, - "panorama_server2_status": {"readonly": True}, - } - - _attribute_map = { - "panorama_server_status": {"key": "panoramaServerStatus", "type": "str"}, - "panorama_server2_status": {"key": "panoramaServer2Status", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.panorama_server_status = None - self.panorama_server2_status = None - - -class PlanData(_serialization.Model): - """Billing plan information. - - 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. - - :ivar usage_type: different usage type like PAYG/COMMITTED. Known values are: "PAYG" and - "COMMITTED". - :vartype usage_type: str or ~azure.mgmt.paloaltonetworksngfw.models.UsageType - :ivar billing_cycle: different billing cycles like MONTHLY/WEEKLY. Required. Known values are: - "WEEKLY" and "MONTHLY". - :vartype billing_cycle: str or ~azure.mgmt.paloaltonetworksngfw.models.BillingCycle - :ivar plan_id: plan id as published by Liftr.PAN. Required. - :vartype plan_id: str - :ivar effective_date: date when plan was applied. - :vartype effective_date: ~datetime.datetime - """ - - _validation = { - "billing_cycle": {"required": True}, - "plan_id": {"required": True, "max_length": 50}, - "effective_date": {"readonly": True}, - } - - _attribute_map = { - "usage_type": {"key": "usageType", "type": "str"}, - "billing_cycle": {"key": "billingCycle", "type": "str"}, - "plan_id": {"key": "planId", "type": "str"}, - "effective_date": {"key": "effectiveDate", "type": "iso-8601"}, - } - - def __init__( - self, - *, - billing_cycle: Union[str, "_models.BillingCycle"], - plan_id: str, - usage_type: Optional[Union[str, "_models.UsageType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword usage_type: different usage type like PAYG/COMMITTED. Known values are: "PAYG" and - "COMMITTED". - :paramtype usage_type: str or ~azure.mgmt.paloaltonetworksngfw.models.UsageType - :keyword billing_cycle: different billing cycles like MONTHLY/WEEKLY. Required. Known values - are: "WEEKLY" and "MONTHLY". - :paramtype billing_cycle: str or ~azure.mgmt.paloaltonetworksngfw.models.BillingCycle - :keyword plan_id: plan id as published by Liftr.PAN. Required. - :paramtype plan_id: str - """ - super().__init__(**kwargs) - self.usage_type = usage_type - self.billing_cycle = billing_cycle - self.plan_id = plan_id - self.effective_date = None - - -class PostRulesResource(ProxyResource): # pylint: disable=too-many-instance-attributes - """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. - - :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 etag: etag info. - :vartype etag: str - :ivar rule_name: rule name. Required. - :vartype rule_name: str - :ivar priority: - :vartype priority: int - :ivar description: rule description. - :vartype description: str - :ivar rule_state: state of this rule. Known values are: "DISABLED" and "ENABLED". - :vartype rule_state: str or ~azure.mgmt.paloaltonetworksngfw.models.StateEnum - :ivar source: source address. - :vartype source: ~azure.mgmt.paloaltonetworksngfw.models.SourceAddr - :ivar negate_source: cidr should not be 'any'. Known values are: "TRUE" and "FALSE". - :vartype negate_source: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum - :ivar destination: destination address. - :vartype destination: ~azure.mgmt.paloaltonetworksngfw.models.DestinationAddr - :ivar negate_destination: cidr should not be 'any'. Known values are: "TRUE" and "FALSE". - :vartype negate_destination: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum - :ivar applications: array of rule applications. - :vartype applications: list[str] - :ivar category: rule category. - :vartype category: ~azure.mgmt.paloaltonetworksngfw.models.Category - :ivar protocol: any, application-default, TCP:number, UDP:number. - :vartype protocol: str - :ivar protocol_port_list: prot port list. - :vartype protocol_port_list: list[str] - :ivar inbound_inspection_certificate: inbound Inspection Certificate. - :vartype inbound_inspection_certificate: str - :ivar audit_comment: rule comment. - :vartype audit_comment: str - :ivar action_type: rule action. Known values are: "Allow", "DenySilent", "DenyResetServer", and - "DenyResetBoth". - :vartype action_type: str or ~azure.mgmt.paloaltonetworksngfw.models.ActionEnum - :ivar enable_logging: enable or disable logging. Known values are: "DISABLED" and "ENABLED". - :vartype enable_logging: str or ~azure.mgmt.paloaltonetworksngfw.models.StateEnum - :ivar decryption_rule_type: enable or disable decryption. Known values are: - "SSLOutboundInspection", "SSLInboundInspection", and "None". - :vartype decryption_rule_type: str or - ~azure.mgmt.paloaltonetworksngfw.models.DecryptionRuleTypeEnum - :ivar tags: tag for rule. - :vartype tags: list[~azure.mgmt.paloaltonetworksngfw.models.TagInfo] - :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}, - "rule_name": {"required": True}, - "priority": {"readonly": 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"}, - "etag": {"key": "properties.etag", "type": "str"}, - "rule_name": {"key": "properties.ruleName", "type": "str"}, - "priority": {"key": "properties.priority", "type": "int"}, - "description": {"key": "properties.description", "type": "str"}, - "rule_state": {"key": "properties.ruleState", "type": "str"}, - "source": {"key": "properties.source", "type": "SourceAddr"}, - "negate_source": {"key": "properties.negateSource", "type": "str"}, - "destination": {"key": "properties.destination", "type": "DestinationAddr"}, - "negate_destination": {"key": "properties.negateDestination", "type": "str"}, - "applications": {"key": "properties.applications", "type": "[str]"}, - "category": {"key": "properties.category", "type": "Category"}, - "protocol": {"key": "properties.protocol", "type": "str"}, - "protocol_port_list": {"key": "properties.protocolPortList", "type": "[str]"}, - "inbound_inspection_certificate": {"key": "properties.inboundInspectionCertificate", "type": "str"}, - "audit_comment": {"key": "properties.auditComment", "type": "str"}, - "action_type": {"key": "properties.actionType", "type": "str"}, - "enable_logging": {"key": "properties.enableLogging", "type": "str"}, - "decryption_rule_type": {"key": "properties.decryptionRuleType", "type": "str"}, - "tags": {"key": "properties.tags", "type": "[TagInfo]"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - rule_name: str, - etag: Optional[str] = None, - description: Optional[str] = None, - rule_state: Optional[Union[str, "_models.StateEnum"]] = None, - source: Optional["_models.SourceAddr"] = None, - 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, - category: Optional["_models.Category"] = None, - protocol: str = "application-default", - 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, - **kwargs: Any - ) -> None: - """ - :keyword etag: etag info. - :paramtype etag: str - :keyword rule_name: rule name. Required. - :paramtype rule_name: str - :keyword description: rule description. - :paramtype description: str - :keyword rule_state: state of this rule. Known values are: "DISABLED" and "ENABLED". - :paramtype rule_state: str or ~azure.mgmt.paloaltonetworksngfw.models.StateEnum - :keyword source: source address. - :paramtype source: ~azure.mgmt.paloaltonetworksngfw.models.SourceAddr - :keyword negate_source: cidr should not be 'any'. Known values are: "TRUE" and "FALSE". - :paramtype negate_source: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum - :keyword destination: destination address. - :paramtype destination: ~azure.mgmt.paloaltonetworksngfw.models.DestinationAddr - :keyword negate_destination: cidr should not be 'any'. Known values are: "TRUE" and "FALSE". - :paramtype negate_destination: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum - :keyword applications: array of rule applications. - :paramtype applications: list[str] - :keyword category: rule category. - :paramtype category: ~azure.mgmt.paloaltonetworksngfw.models.Category - :keyword protocol: any, application-default, TCP:number, UDP:number. - :paramtype protocol: str - :keyword protocol_port_list: prot port list. - :paramtype protocol_port_list: list[str] - :keyword inbound_inspection_certificate: inbound Inspection Certificate. - :paramtype inbound_inspection_certificate: str - :keyword audit_comment: rule comment. - :paramtype audit_comment: str - :keyword action_type: rule action. Known values are: "Allow", "DenySilent", "DenyResetServer", - and "DenyResetBoth". - :paramtype action_type: str or ~azure.mgmt.paloaltonetworksngfw.models.ActionEnum - :keyword enable_logging: enable or disable logging. Known values are: "DISABLED" and "ENABLED". - :paramtype enable_logging: str or ~azure.mgmt.paloaltonetworksngfw.models.StateEnum - :keyword decryption_rule_type: enable or disable decryption. Known values are: - "SSLOutboundInspection", "SSLInboundInspection", and "None". - :paramtype decryption_rule_type: str or - ~azure.mgmt.paloaltonetworksngfw.models.DecryptionRuleTypeEnum - :keyword tags: tag for rule. - :paramtype tags: list[~azure.mgmt.paloaltonetworksngfw.models.TagInfo] - """ - super().__init__(**kwargs) - self.etag = etag - self.rule_name = rule_name - self.priority = None - self.description = description - self.rule_state = rule_state - self.source = source - self.negate_source = negate_source - self.destination = destination - self.negate_destination = negate_destination - self.applications = applications - self.category = category - self.protocol = protocol - self.protocol_port_list = protocol_port_list - self.inbound_inspection_certificate = inbound_inspection_certificate - self.audit_comment = audit_comment - self.action_type = action_type - self.enable_logging = enable_logging - self.decryption_rule_type = decryption_rule_type - self.tags = tags - self.provisioning_state = None - - -class PostRulesResourceListResult(_serialization.Model): - """The response of a PostRulesResource list operation. - - All required parameters must be populated in order to send to Azure. - - :ivar value: The 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 - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[PostRulesResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: List["_models.PostRulesResource"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The 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 - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class PredefinedUrlCategoriesResponse(_serialization.Model): - """predefined url categories response. - - All required parameters must be populated in order to send to Azure. - - :ivar value: predefined url categories. Required. - :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.PredefinedUrlCategory] - :ivar next_link: next link. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[PredefinedUrlCategory]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: List["_models.PredefinedUrlCategory"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: predefined url categories. Required. - :paramtype value: list[~azure.mgmt.paloaltonetworksngfw.models.PredefinedUrlCategory] - :keyword next_link: next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class PredefinedUrlCategory(_serialization.Model): - """Predefined URL category object. - - All required parameters must be populated in order to send to Azure. - - :ivar action: Required. - :vartype action: str - :ivar name: Required. - :vartype name: str - """ - - _validation = { - "action": {"required": True}, - "name": {"required": True}, - } - - _attribute_map = { - "action": {"key": "action", "type": "str"}, - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, action: str, name: str, **kwargs: Any) -> None: - """ - :keyword action: Required. - :paramtype action: str - :keyword name: Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.action = action - self.name = name - - -class PrefixListGlobalRulestackResource(ProxyResource): - """GlobalRulestack prefixList. - - 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. - - :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 description: prefix description. - :vartype description: str - :ivar prefix_list: prefix list. Required. - :vartype prefix_list: list[str] - :ivar etag: etag info. - :vartype etag: str - :ivar audit_comment: comment for this object. - :vartype audit_comment: 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}, - "prefix_list": {"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"}, - "description": {"key": "properties.description", "type": "str"}, - "prefix_list": {"key": "properties.prefixList", "type": "[str]"}, - "etag": {"key": "properties.etag", "type": "str"}, - "audit_comment": {"key": "properties.auditComment", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( - self, - *, - prefix_list: List[str], - description: Optional[str] = None, - etag: Optional[str] = None, - audit_comment: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword description: prefix description. - :paramtype description: str - :keyword prefix_list: prefix list. Required. - :paramtype prefix_list: list[str] - :keyword etag: etag info. - :paramtype etag: str - :keyword audit_comment: comment for this object. - :paramtype audit_comment: str - """ - super().__init__(**kwargs) - self.description = description - self.prefix_list = prefix_list - self.etag = etag - self.audit_comment = audit_comment - self.provisioning_state = None - - -class PrefixListGlobalRulestackResourceListResult(_serialization.Model): - """The response of a PrefixListGlobalRulestackResource list operation. - - All required parameters must be populated in order to send to Azure. - - :ivar value: The 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 - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[PrefixListGlobalRulestackResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: List["_models.PrefixListGlobalRulestackResource"], - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The items on this page. Required. - :paramtype value: - list[~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource] - :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 PrefixListResource(ProxyResource): - """LocalRulestack prefixList. - - 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. - - :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 description: prefix description. - :vartype description: str - :ivar prefix_list: prefix list. Required. - :vartype prefix_list: list[str] - :ivar etag: etag info. - :vartype etag: str - :ivar audit_comment: comment for this object. - :vartype audit_comment: 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}, - "prefix_list": {"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"}, - "description": {"key": "properties.description", "type": "str"}, - "prefix_list": {"key": "properties.prefixList", "type": "[str]"}, - "etag": {"key": "properties.etag", "type": "str"}, - "audit_comment": {"key": "properties.auditComment", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( - self, - *, - prefix_list: List[str], - description: Optional[str] = None, - etag: Optional[str] = None, - audit_comment: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword description: prefix description. - :paramtype description: str - :keyword prefix_list: prefix list. Required. - :paramtype prefix_list: list[str] - :keyword etag: etag info. - :paramtype etag: str - :keyword audit_comment: comment for this object. - :paramtype audit_comment: str - """ - super().__init__(**kwargs) - self.description = description - self.prefix_list = prefix_list - self.etag = etag - self.audit_comment = audit_comment - self.provisioning_state = None - - -class PrefixListResourceListResult(_serialization.Model): - """The response of a PrefixListResource list operation. - - All required parameters must be populated in order to send to Azure. - - :ivar value: The 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 - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[PrefixListResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: List["_models.PrefixListResource"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The 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 - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class PreRulesResource(ProxyResource): # pylint: disable=too-many-instance-attributes - """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. - - :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 etag: etag info. - :vartype etag: str - :ivar rule_name: rule name. Required. - :vartype rule_name: str - :ivar priority: - :vartype priority: int - :ivar description: rule description. - :vartype description: str - :ivar rule_state: state of this rule. Known values are: "DISABLED" and "ENABLED". - :vartype rule_state: str or ~azure.mgmt.paloaltonetworksngfw.models.StateEnum - :ivar source: source address. - :vartype source: ~azure.mgmt.paloaltonetworksngfw.models.SourceAddr - :ivar negate_source: cidr should not be 'any'. Known values are: "TRUE" and "FALSE". - :vartype negate_source: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum - :ivar destination: destination address. - :vartype destination: ~azure.mgmt.paloaltonetworksngfw.models.DestinationAddr - :ivar negate_destination: cidr should not be 'any'. Known values are: "TRUE" and "FALSE". - :vartype negate_destination: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum - :ivar applications: array of rule applications. - :vartype applications: list[str] - :ivar category: rule category. - :vartype category: ~azure.mgmt.paloaltonetworksngfw.models.Category - :ivar protocol: any, application-default, TCP:number, UDP:number. - :vartype protocol: str - :ivar protocol_port_list: prot port list. - :vartype protocol_port_list: list[str] - :ivar inbound_inspection_certificate: inbound Inspection Certificate. - :vartype inbound_inspection_certificate: str - :ivar audit_comment: rule comment. - :vartype audit_comment: str - :ivar action_type: rule action. Known values are: "Allow", "DenySilent", "DenyResetServer", and - "DenyResetBoth". - :vartype action_type: str or ~azure.mgmt.paloaltonetworksngfw.models.ActionEnum - :ivar enable_logging: enable or disable logging. Known values are: "DISABLED" and "ENABLED". - :vartype enable_logging: str or ~azure.mgmt.paloaltonetworksngfw.models.StateEnum - :ivar decryption_rule_type: enable or disable decryption. Known values are: - "SSLOutboundInspection", "SSLInboundInspection", and "None". - :vartype decryption_rule_type: str or - ~azure.mgmt.paloaltonetworksngfw.models.DecryptionRuleTypeEnum - :ivar tags: tag for rule. - :vartype tags: list[~azure.mgmt.paloaltonetworksngfw.models.TagInfo] - :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}, - "rule_name": {"required": True}, - "priority": {"readonly": 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"}, - "etag": {"key": "properties.etag", "type": "str"}, - "rule_name": {"key": "properties.ruleName", "type": "str"}, - "priority": {"key": "properties.priority", "type": "int"}, - "description": {"key": "properties.description", "type": "str"}, - "rule_state": {"key": "properties.ruleState", "type": "str"}, - "source": {"key": "properties.source", "type": "SourceAddr"}, - "negate_source": {"key": "properties.negateSource", "type": "str"}, - "destination": {"key": "properties.destination", "type": "DestinationAddr"}, - "negate_destination": {"key": "properties.negateDestination", "type": "str"}, - "applications": {"key": "properties.applications", "type": "[str]"}, - "category": {"key": "properties.category", "type": "Category"}, - "protocol": {"key": "properties.protocol", "type": "str"}, - "protocol_port_list": {"key": "properties.protocolPortList", "type": "[str]"}, - "inbound_inspection_certificate": {"key": "properties.inboundInspectionCertificate", "type": "str"}, - "audit_comment": {"key": "properties.auditComment", "type": "str"}, - "action_type": {"key": "properties.actionType", "type": "str"}, - "enable_logging": {"key": "properties.enableLogging", "type": "str"}, - "decryption_rule_type": {"key": "properties.decryptionRuleType", "type": "str"}, - "tags": {"key": "properties.tags", "type": "[TagInfo]"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - rule_name: str, - etag: Optional[str] = None, - description: Optional[str] = None, - rule_state: Optional[Union[str, "_models.StateEnum"]] = None, - source: Optional["_models.SourceAddr"] = None, - 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, - category: Optional["_models.Category"] = None, - protocol: str = "application-default", - 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, - **kwargs: Any - ) -> None: - """ - :keyword etag: etag info. - :paramtype etag: str - :keyword rule_name: rule name. Required. - :paramtype rule_name: str - :keyword description: rule description. - :paramtype description: str - :keyword rule_state: state of this rule. Known values are: "DISABLED" and "ENABLED". - :paramtype rule_state: str or ~azure.mgmt.paloaltonetworksngfw.models.StateEnum - :keyword source: source address. - :paramtype source: ~azure.mgmt.paloaltonetworksngfw.models.SourceAddr - :keyword negate_source: cidr should not be 'any'. Known values are: "TRUE" and "FALSE". - :paramtype negate_source: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum - :keyword destination: destination address. - :paramtype destination: ~azure.mgmt.paloaltonetworksngfw.models.DestinationAddr - :keyword negate_destination: cidr should not be 'any'. Known values are: "TRUE" and "FALSE". - :paramtype negate_destination: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum - :keyword applications: array of rule applications. - :paramtype applications: list[str] - :keyword category: rule category. - :paramtype category: ~azure.mgmt.paloaltonetworksngfw.models.Category - :keyword protocol: any, application-default, TCP:number, UDP:number. - :paramtype protocol: str - :keyword protocol_port_list: prot port list. - :paramtype protocol_port_list: list[str] - :keyword inbound_inspection_certificate: inbound Inspection Certificate. - :paramtype inbound_inspection_certificate: str - :keyword audit_comment: rule comment. - :paramtype audit_comment: str - :keyword action_type: rule action. Known values are: "Allow", "DenySilent", "DenyResetServer", - and "DenyResetBoth". - :paramtype action_type: str or ~azure.mgmt.paloaltonetworksngfw.models.ActionEnum - :keyword enable_logging: enable or disable logging. Known values are: "DISABLED" and "ENABLED". - :paramtype enable_logging: str or ~azure.mgmt.paloaltonetworksngfw.models.StateEnum - :keyword decryption_rule_type: enable or disable decryption. Known values are: - "SSLOutboundInspection", "SSLInboundInspection", and "None". - :paramtype decryption_rule_type: str or - ~azure.mgmt.paloaltonetworksngfw.models.DecryptionRuleTypeEnum - :keyword tags: tag for rule. - :paramtype tags: list[~azure.mgmt.paloaltonetworksngfw.models.TagInfo] - """ - super().__init__(**kwargs) - self.etag = etag - self.rule_name = rule_name - self.priority = None - self.description = description - self.rule_state = rule_state - self.source = source - self.negate_source = negate_source - self.destination = destination - self.negate_destination = negate_destination - self.applications = applications - self.category = category - self.protocol = protocol - self.protocol_port_list = protocol_port_list - self.inbound_inspection_certificate = inbound_inspection_certificate - self.audit_comment = audit_comment - self.action_type = action_type - self.enable_logging = enable_logging - self.decryption_rule_type = decryption_rule_type - self.tags = tags - self.provisioning_state = None - - -class PreRulesResourceListResult(_serialization.Model): - """The response of a PreRulesResource list operation. - - All required parameters must be populated in order to send to Azure. - - :ivar value: The 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 - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[PreRulesResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: List["_models.PreRulesResource"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The 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 - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class RuleCounter(_serialization.Model): - """Rule counter. - - All required parameters must be populated in order to send to Azure. - - :ivar priority: priority number. Required. - :vartype priority: str - :ivar rule_stack_name: rule Stack Name. - :vartype rule_stack_name: str - :ivar rule_list_name: rule list name. - :vartype rule_list_name: str - :ivar firewall_name: firewall name. - :vartype firewall_name: str - :ivar rule_name: rule name. Required. - :vartype rule_name: str - :ivar hit_count: hit count. - :vartype hit_count: int - :ivar app_seen: apps seen. - :vartype app_seen: ~azure.mgmt.paloaltonetworksngfw.models.AppSeenData - :ivar timestamp: timestamp of response. - :vartype timestamp: ~datetime.datetime - :ivar request_timestamp: timestamp of request. - :vartype request_timestamp: ~datetime.datetime - :ivar last_updated_timestamp: last updated timestamp. - :vartype last_updated_timestamp: ~datetime.datetime - """ - - _validation = { - "priority": {"required": True}, - "rule_name": {"required": True}, - } - - _attribute_map = { - "priority": {"key": "priority", "type": "str"}, - "rule_stack_name": {"key": "ruleStackName", "type": "str"}, - "rule_list_name": {"key": "ruleListName", "type": "str"}, - "firewall_name": {"key": "firewallName", "type": "str"}, - "rule_name": {"key": "ruleName", "type": "str"}, - "hit_count": {"key": "hitCount", "type": "int"}, - "app_seen": {"key": "appSeen", "type": "AppSeenData"}, - "timestamp": {"key": "timestamp", "type": "iso-8601"}, - "request_timestamp": {"key": "requestTimestamp", "type": "iso-8601"}, - "last_updated_timestamp": {"key": "lastUpdatedTimestamp", "type": "iso-8601"}, - } - - def __init__( - self, - *, - priority: str, - rule_name: str, - rule_stack_name: Optional[str] = None, - rule_list_name: Optional[str] = None, - firewall_name: Optional[str] = None, - hit_count: Optional[int] = None, - app_seen: Optional["_models.AppSeenData"] = None, - timestamp: Optional[datetime.datetime] = None, - request_timestamp: Optional[datetime.datetime] = None, - last_updated_timestamp: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword priority: priority number. Required. - :paramtype priority: str - :keyword rule_stack_name: rule Stack Name. - :paramtype rule_stack_name: str - :keyword rule_list_name: rule list name. - :paramtype rule_list_name: str - :keyword firewall_name: firewall name. - :paramtype firewall_name: str - :keyword rule_name: rule name. Required. - :paramtype rule_name: str - :keyword hit_count: hit count. - :paramtype hit_count: int - :keyword app_seen: apps seen. - :paramtype app_seen: ~azure.mgmt.paloaltonetworksngfw.models.AppSeenData - :keyword timestamp: timestamp of response. - :paramtype timestamp: ~datetime.datetime - :keyword request_timestamp: timestamp of request. - :paramtype request_timestamp: ~datetime.datetime - :keyword last_updated_timestamp: last updated timestamp. - :paramtype last_updated_timestamp: ~datetime.datetime - """ - super().__init__(**kwargs) - self.priority = priority - self.rule_stack_name = rule_stack_name - self.rule_list_name = rule_list_name - self.firewall_name = firewall_name - self.rule_name = rule_name - self.hit_count = hit_count - self.app_seen = app_seen - self.timestamp = timestamp - self.request_timestamp = request_timestamp - self.last_updated_timestamp = last_updated_timestamp - - -class RuleCounterReset(_serialization.Model): - """Rule counter reset. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar priority: priority number. - :vartype priority: str - :ivar rule_stack_name: rule Stack Name. - :vartype rule_stack_name: str - :ivar rule_list_name: rule list name. - :vartype rule_list_name: str - :ivar firewall_name: firewall name. - :vartype firewall_name: str - :ivar rule_name: rule name. - :vartype rule_name: str - """ - - _validation = { - "priority": {"readonly": True}, - } - - _attribute_map = { - "priority": {"key": "priority", "type": "str"}, - "rule_stack_name": {"key": "ruleStackName", "type": "str"}, - "rule_list_name": {"key": "ruleListName", "type": "str"}, - "firewall_name": {"key": "firewallName", "type": "str"}, - "rule_name": {"key": "ruleName", "type": "str"}, - } - - def __init__( - self, - *, - rule_stack_name: Optional[str] = None, - rule_list_name: Optional[str] = None, - firewall_name: Optional[str] = None, - rule_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword rule_stack_name: rule Stack Name. - :paramtype rule_stack_name: str - :keyword rule_list_name: rule list name. - :paramtype rule_list_name: str - :keyword firewall_name: firewall name. - :paramtype firewall_name: str - :keyword rule_name: rule name. - :paramtype rule_name: str - """ - super().__init__(**kwargs) - self.priority = None - self.rule_stack_name = rule_stack_name - self.rule_list_name = rule_list_name - self.firewall_name = firewall_name - self.rule_name = rule_name - - -class RulestackDetails(_serialization.Model): - """Associated rulestack details. - - :ivar resource_id: Resource Id. - :vartype resource_id: str - :ivar rulestack_id: Associated rulestack Id. - :vartype rulestack_id: str - :ivar location: Rulestack location. - :vartype location: str - """ - - _attribute_map = { - "resource_id": {"key": "resourceId", "type": "str"}, - "rulestack_id": {"key": "rulestackId", "type": "str"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__( - self, - *, - resource_id: Optional[str] = None, - rulestack_id: Optional[str] = None, - location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword resource_id: Resource Id. - :paramtype resource_id: str - :keyword rulestack_id: Associated rulestack Id. - :paramtype rulestack_id: str - :keyword location: Rulestack location. - :paramtype location: str - """ - super().__init__(**kwargs) - self.resource_id = resource_id - self.rulestack_id = rulestack_id - self.location = location - - -class SecurityServices(_serialization.Model): - """security services. - - :ivar vulnerability_profile: IPs Vulnerability Profile Data. - :vartype vulnerability_profile: str - :ivar anti_spyware_profile: Anti spyware Profile data. - :vartype anti_spyware_profile: str - :ivar anti_virus_profile: anti virus profile data. - :vartype anti_virus_profile: str - :ivar url_filtering_profile: URL filtering profile data. - :vartype url_filtering_profile: str - :ivar file_blocking_profile: File blocking profile data. - :vartype file_blocking_profile: str - :ivar dns_subscription: DNS Subscription profile data. - :vartype dns_subscription: str - :ivar outbound_un_trust_certificate: Untrusted Egress Decryption profile data. - :vartype outbound_un_trust_certificate: str - :ivar outbound_trust_certificate: Trusted Egress Decryption profile data. - :vartype outbound_trust_certificate: str - """ - - _attribute_map = { - "vulnerability_profile": {"key": "vulnerabilityProfile", "type": "str"}, - "anti_spyware_profile": {"key": "antiSpywareProfile", "type": "str"}, - "anti_virus_profile": {"key": "antiVirusProfile", "type": "str"}, - "url_filtering_profile": {"key": "urlFilteringProfile", "type": "str"}, - "file_blocking_profile": {"key": "fileBlockingProfile", "type": "str"}, - "dns_subscription": {"key": "dnsSubscription", "type": "str"}, - "outbound_un_trust_certificate": {"key": "outboundUnTrustCertificate", "type": "str"}, - "outbound_trust_certificate": {"key": "outboundTrustCertificate", "type": "str"}, - } - - def __init__( - self, - *, - vulnerability_profile: Optional[str] = None, - anti_spyware_profile: Optional[str] = None, - anti_virus_profile: Optional[str] = None, - url_filtering_profile: Optional[str] = None, - file_blocking_profile: Optional[str] = None, - dns_subscription: Optional[str] = None, - outbound_un_trust_certificate: Optional[str] = None, - outbound_trust_certificate: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword vulnerability_profile: IPs Vulnerability Profile Data. - :paramtype vulnerability_profile: str - :keyword anti_spyware_profile: Anti spyware Profile data. - :paramtype anti_spyware_profile: str - :keyword anti_virus_profile: anti virus profile data. - :paramtype anti_virus_profile: str - :keyword url_filtering_profile: URL filtering profile data. - :paramtype url_filtering_profile: str - :keyword file_blocking_profile: File blocking profile data. - :paramtype file_blocking_profile: str - :keyword dns_subscription: DNS Subscription profile data. - :paramtype dns_subscription: str - :keyword outbound_un_trust_certificate: Untrusted Egress Decryption profile data. - :paramtype outbound_un_trust_certificate: str - :keyword outbound_trust_certificate: Trusted Egress Decryption profile data. - :paramtype outbound_trust_certificate: str - """ - super().__init__(**kwargs) - self.vulnerability_profile = vulnerability_profile - self.anti_spyware_profile = anti_spyware_profile - self.anti_virus_profile = anti_virus_profile - self.url_filtering_profile = url_filtering_profile - self.file_blocking_profile = file_blocking_profile - self.dns_subscription = dns_subscription - self.outbound_un_trust_certificate = outbound_un_trust_certificate - self.outbound_trust_certificate = outbound_trust_certificate - - -class SecurityServicesResponse(_serialization.Model): - """Security services list response. - - All required parameters must be populated in order to send to Azure. - - :ivar value: response value. Required. - :vartype value: ~azure.mgmt.paloaltonetworksngfw.models.SecurityServicesTypeList - :ivar next_link: next link. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "SecurityServicesTypeList"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: "_models.SecurityServicesTypeList", next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: response value. Required. - :paramtype value: ~azure.mgmt.paloaltonetworksngfw.models.SecurityServicesTypeList - :keyword next_link: next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SecurityServicesTypeList(_serialization.Model): - """Security services type list. - - All required parameters must be populated in order to send to Azure. - - :ivar type: security services type. - :vartype type: str - :ivar entry: list. Required. - :vartype entry: list[~azure.mgmt.paloaltonetworksngfw.models.NameDescriptionObject] - """ - - _validation = { - "entry": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "entry": {"key": "entry", "type": "[NameDescriptionObject]"}, - } - - def __init__( - self, *, entry: List["_models.NameDescriptionObject"], type: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword type: security services type. - :paramtype type: str - :keyword entry: list. Required. - :paramtype entry: list[~azure.mgmt.paloaltonetworksngfw.models.NameDescriptionObject] - """ - super().__init__(**kwargs) - self.type = type - self.entry = entry - - -class SourceAddr(_serialization.Model): - """Address properties. - - :ivar cidrs: special value 'any'. - :vartype cidrs: list[str] - :ivar countries: list of countries. - :vartype countries: list[str] - :ivar feeds: list of feeds. - :vartype feeds: list[str] - :ivar prefix_lists: prefix list. - :vartype prefix_lists: list[str] - """ - - _attribute_map = { - "cidrs": {"key": "cidrs", "type": "[str]"}, - "countries": {"key": "countries", "type": "[str]"}, - "feeds": {"key": "feeds", "type": "[str]"}, - "prefix_lists": {"key": "prefixLists", "type": "[str]"}, - } - - def __init__( - self, - *, - cidrs: Optional[List[str]] = None, - countries: Optional[List[str]] = None, - feeds: Optional[List[str]] = None, - prefix_lists: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword cidrs: special value 'any'. - :paramtype cidrs: list[str] - :keyword countries: list of countries. - :paramtype countries: list[str] - :keyword feeds: list of feeds. - :paramtype feeds: list[str] - :keyword prefix_lists: prefix list. - :paramtype prefix_lists: list[str] - """ - super().__init__(**kwargs) - self.cidrs = cidrs - self.countries = countries - self.feeds = feeds - self.prefix_lists = prefix_lists - - -class StorageAccount(_serialization.Model): - """Storage Account configurations. - - :ivar id: Resource ID of storage account. - :vartype id: str - :ivar subscription_id: Subscription Id. - :vartype subscription_id: str - :ivar account_name: Storage account name. - :vartype account_name: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "subscription_id": {"key": "subscriptionId", "type": "str"}, - "account_name": {"key": "accountName", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - subscription_id: Optional[str] = None, - account_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Resource ID of storage account. - :paramtype id: str - :keyword subscription_id: Subscription Id. - :paramtype subscription_id: str - :keyword account_name: Storage account name. - :paramtype account_name: str - """ - super().__init__(**kwargs) - self.id = id - self.subscription_id = subscription_id - self.account_name = account_name - - -class SupportInfo(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Support information for the resource. - - :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_registered: account registered in Customer Support Portal. Known values are: - "TRUE" and "FALSE". - :vartype account_registered: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum - :ivar account_id: Support account associated with given resource. - :vartype account_id: str - :ivar user_domain_supported: user domain is supported in Customer Support Portal. Known values - are: "TRUE" and "FALSE". - :vartype user_domain_supported: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum - :ivar user_registered: user registered in Customer Support Portal. Known values are: "TRUE" and - "FALSE". - :vartype user_registered: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum - :ivar free_trial: Product usage is in free trial period. Known values are: "TRUE" and "FALSE". - :vartype free_trial: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum - :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 - """ - - _attribute_map = { - "product_sku": {"key": "productSku", "type": "str"}, - "product_serial": {"key": "productSerial", "type": "str"}, - "account_registered": {"key": "accountRegistered", "type": "str"}, - "account_id": {"key": "accountId", "type": "str"}, - "user_domain_supported": {"key": "userDomainSupported", "type": "str"}, - "user_registered": {"key": "userRegistered", "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"}, - } - - def __init__( - self, - *, - product_sku: Optional[str] = None, - product_serial: Optional[str] = None, - account_registered: Optional[Union[str, "_models.BooleanEnum"]] = None, - account_id: Optional[str] = None, - user_domain_supported: Optional[Union[str, "_models.BooleanEnum"]] = None, - user_registered: Optional[Union[str, "_models.BooleanEnum"]] = None, - free_trial: Optional[Union[str, "_models.BooleanEnum"]] = 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, - **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_registered: account registered in Customer Support Portal. Known values are: - "TRUE" and "FALSE". - :paramtype account_registered: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum - :keyword account_id: Support account associated with given resource. - :paramtype account_id: str - :keyword user_domain_supported: user domain is supported in Customer Support Portal. Known - values are: "TRUE" and "FALSE". - :paramtype user_domain_supported: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum - :keyword user_registered: user registered in Customer Support Portal. Known values are: "TRUE" - and "FALSE". - :paramtype user_registered: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum - :keyword free_trial: Product usage is in free trial period. Known values are: "TRUE" and - "FALSE". - :paramtype free_trial: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum - :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 - """ - super().__init__(**kwargs) - self.product_sku = product_sku - self.product_serial = product_serial - self.account_registered = account_registered - self.account_id = account_id - self.user_domain_supported = user_domain_supported - self.user_registered = user_registered - 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 - - -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.mgmt.paloaltonetworksngfw.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or ~azure.mgmt.paloaltonetworksngfw.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or ~azure.mgmt.paloaltonetworksngfw.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or ~azure.mgmt.paloaltonetworksngfw.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__(**kwargs) - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at - - -class TagInfo(_serialization.Model): - """Tag. - - All required parameters must be populated in order to send to Azure. - - :ivar key: tag name. Required. - :vartype key: str - :ivar value: tag value. Required. - :vartype value: str - """ - - _validation = { - "key": {"required": True}, - "value": {"required": True}, - } - - _attribute_map = { - "key": {"key": "key", "type": "str"}, - "value": {"key": "value", "type": "str"}, - } - - def __init__(self, *, key: str, value: str, **kwargs: Any) -> None: - """ - :keyword key: tag name. Required. - :paramtype key: str - :keyword value: tag value. Required. - :paramtype value: str - """ - super().__init__(**kwargs) - self.key = key - self.value = value - - -class VnetConfiguration(_serialization.Model): - """VnetInfo for Firewall Networking. - - All required parameters must be populated in order to send to Azure. - - :ivar vnet: Azure Virtual Network. Required. - :vartype vnet: ~azure.mgmt.paloaltonetworksngfw.models.IPAddressSpace - :ivar trust_subnet: Trust Subnet. Required. - :vartype trust_subnet: ~azure.mgmt.paloaltonetworksngfw.models.IPAddressSpace - :ivar un_trust_subnet: Untrust Subnet. Required. - :vartype un_trust_subnet: ~azure.mgmt.paloaltonetworksngfw.models.IPAddressSpace - :ivar ip_of_trust_subnet_for_udr: IP of trust subnet for UDR. - :vartype ip_of_trust_subnet_for_udr: ~azure.mgmt.paloaltonetworksngfw.models.IPAddress - """ - - _validation = { - "vnet": {"required": True}, - "trust_subnet": {"required": True}, - "un_trust_subnet": {"required": True}, - } - - _attribute_map = { - "vnet": {"key": "vnet", "type": "IPAddressSpace"}, - "trust_subnet": {"key": "trustSubnet", "type": "IPAddressSpace"}, - "un_trust_subnet": {"key": "unTrustSubnet", "type": "IPAddressSpace"}, - "ip_of_trust_subnet_for_udr": {"key": "ipOfTrustSubnetForUdr", "type": "IPAddress"}, - } - - def __init__( - self, - *, - vnet: "_models.IPAddressSpace", - trust_subnet: "_models.IPAddressSpace", - un_trust_subnet: "_models.IPAddressSpace", - ip_of_trust_subnet_for_udr: Optional["_models.IPAddress"] = None, - **kwargs: Any - ) -> None: - """ - :keyword vnet: Azure Virtual Network. Required. - :paramtype vnet: ~azure.mgmt.paloaltonetworksngfw.models.IPAddressSpace - :keyword trust_subnet: Trust Subnet. Required. - :paramtype trust_subnet: ~azure.mgmt.paloaltonetworksngfw.models.IPAddressSpace - :keyword un_trust_subnet: Untrust Subnet. Required. - :paramtype un_trust_subnet: ~azure.mgmt.paloaltonetworksngfw.models.IPAddressSpace - :keyword ip_of_trust_subnet_for_udr: IP of trust subnet for UDR. - :paramtype ip_of_trust_subnet_for_udr: ~azure.mgmt.paloaltonetworksngfw.models.IPAddress - """ - super().__init__(**kwargs) - self.vnet = vnet - self.trust_subnet = trust_subnet - self.un_trust_subnet = un_trust_subnet - self.ip_of_trust_subnet_for_udr = ip_of_trust_subnet_for_udr - - -class VwanConfiguration(_serialization.Model): - """VwanInfo for Firewall Networking. - - All required parameters must be populated in order to send to Azure. - - :ivar network_virtual_appliance_id: Network Virtual Appliance resource ID. - :vartype network_virtual_appliance_id: str - :ivar v_hub: vHub Address. Required. - :vartype v_hub: ~azure.mgmt.paloaltonetworksngfw.models.IPAddressSpace - :ivar trust_subnet: Trust Subnet. - :vartype trust_subnet: ~azure.mgmt.paloaltonetworksngfw.models.IPAddressSpace - :ivar un_trust_subnet: Untrust Subnet. - :vartype un_trust_subnet: ~azure.mgmt.paloaltonetworksngfw.models.IPAddressSpace - :ivar ip_of_trust_subnet_for_udr: IP of trust subnet for UDR. - :vartype ip_of_trust_subnet_for_udr: ~azure.mgmt.paloaltonetworksngfw.models.IPAddress - """ - - _validation = { - "v_hub": {"required": True}, - } - - _attribute_map = { - "network_virtual_appliance_id": {"key": "networkVirtualApplianceId", "type": "str"}, - "v_hub": {"key": "vHub", "type": "IPAddressSpace"}, - "trust_subnet": {"key": "trustSubnet", "type": "IPAddressSpace"}, - "un_trust_subnet": {"key": "unTrustSubnet", "type": "IPAddressSpace"}, - "ip_of_trust_subnet_for_udr": {"key": "ipOfTrustSubnetForUdr", "type": "IPAddress"}, - } - - def __init__( - self, - *, - v_hub: "_models.IPAddressSpace", - network_virtual_appliance_id: Optional[str] = None, - trust_subnet: Optional["_models.IPAddressSpace"] = None, - un_trust_subnet: Optional["_models.IPAddressSpace"] = None, - ip_of_trust_subnet_for_udr: Optional["_models.IPAddress"] = None, - **kwargs: Any - ) -> None: - """ - :keyword network_virtual_appliance_id: Network Virtual Appliance resource ID. - :paramtype network_virtual_appliance_id: str - :keyword v_hub: vHub Address. Required. - :paramtype v_hub: ~azure.mgmt.paloaltonetworksngfw.models.IPAddressSpace - :keyword trust_subnet: Trust Subnet. - :paramtype trust_subnet: ~azure.mgmt.paloaltonetworksngfw.models.IPAddressSpace - :keyword un_trust_subnet: Untrust Subnet. - :paramtype un_trust_subnet: ~azure.mgmt.paloaltonetworksngfw.models.IPAddressSpace - :keyword ip_of_trust_subnet_for_udr: IP of trust subnet for UDR. - :paramtype ip_of_trust_subnet_for_udr: ~azure.mgmt.paloaltonetworksngfw.models.IPAddress - """ - super().__init__(**kwargs) - self.network_virtual_appliance_id = network_virtual_appliance_id - self.v_hub = v_hub - self.trust_subnet = trust_subnet - self.un_trust_subnet = un_trust_subnet - self.ip_of_trust_subnet_for_udr = ip_of_trust_subnet_for_udr 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..7e2c41f3f85e 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 @@ -2,44 +2,54 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -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 ._operations import Operations # type: ignore +from ._operations import GlobalRulestackOperations # type: ignore +from ._operations import CertificateObjectGlobalRulestackOperations # type: ignore +from ._operations import FqdnListGlobalRulestackOperations # type: ignore +from ._operations import PostRulesOperations # type: ignore +from ._operations import PrefixListGlobalRulestackOperations # type: ignore +from ._operations import PreRulesOperations # type: ignore +from ._operations import FirewallsOperations # type: ignore +from ._operations import LocalRulestacksOperations # type: ignore +from ._operations import MetricsObjectFirewallOperations # type: ignore +from ._operations import FirewallStatusOperations # type: ignore +from ._operations import CertificateObjectLocalRulestackOperations # type: ignore +from ._operations import FqdnListLocalRulestackOperations # type: ignore +from ._operations import LocalRulesOperations # type: ignore +from ._operations import PrefixListLocalRulestackOperations # type: ignore +from ._operations import PaloAltoNetworksCloudngfwOperationsOperations # 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__ = [ + "Operations", "GlobalRulestackOperations", "CertificateObjectGlobalRulestackOperations", "FqdnListGlobalRulestackOperations", "PostRulesOperations", "PrefixListGlobalRulestackOperations", "PreRulesOperations", - "Operations", "FirewallsOperations", "LocalRulestacksOperations", + "MetricsObjectFirewallOperations", "FirewallStatusOperations", "CertificateObjectLocalRulestackOperations", "FqdnListLocalRulestackOperations", "LocalRulesOperations", "PrefixListLocalRulestackOperations", + "PaloAltoNetworksCloudngfwOperationsOperations", ] -__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 deleted file mode 100644 index 037b6f643848..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_certificate_object_global_rulestack_operations.py +++ /dev/null @@ -1,663 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import 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 azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(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")) - 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"), - } - - _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(global_rulestack_name: str, 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")) - 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"), - } - - _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(global_rulestack_name: str, 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")) - 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}/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"), - } - - _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(global_rulestack_name: str, 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")) - 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"), - } - - _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 CertificateObjectGlobalRulestackOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient`'s - :attr:`certificate_object_global_rulestack` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, global_rulestack_name: str, **kwargs: Any - ) -> Iterable["_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: - ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource] - :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.CertificateObjectGlobalRulestackResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - 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) - - 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 = _convert_request(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) - 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) - - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates"} - - @distributed_trace - def get( - self, global_rulestack_name: str, name: str, **kwargs: Any - ) -> _models.CertificateObjectGlobalRulestackResource: - """Get a CertificateObjectGlobalRulestackResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :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 = { - 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.CertificateObjectGlobalRulestackResource] = kwargs.pop("cls", None) - - 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) - - _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("CertificateObjectGlobalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}" - } - - def _create_or_update_initial( - self, - global_rulestack_name: str, - name: str, - resource: Union[_models.CertificateObjectGlobalRulestackResource, IO], - **kwargs: Any - ) -> _models.CertificateObjectGlobalRulestackResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateObjectGlobalRulestackResource] = 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, "CertificateObjectGlobalRulestackResource") - - 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) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("CertificateObjectGlobalRulestackResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("CertificateObjectGlobalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # 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, - global_rulestack_name: str, - name: str, - resource: _models.CertificateObjectGlobalRulestackResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CertificateObjectGlobalRulestackResource]: - """Create a CertificateObjectGlobalRulestackResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param name: certificate name. Required. - :type name: str - :param resource: Resource create parameters. Required. - :type resource: - ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource - :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: - ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - global_rulestack_name: str, - name: str, - resource: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CertificateObjectGlobalRulestackResource]: - """Create a CertificateObjectGlobalRulestackResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param name: certificate name. Required. - :type name: str - :param resource: Resource create parameters. Required. - :type resource: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :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: - ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - global_rulestack_name: str, - name: str, - resource: Union[_models.CertificateObjectGlobalRulestackResource, IO], - **kwargs: Any - ) -> LROPoller[_models.CertificateObjectGlobalRulestackResource]: - """Create a CertificateObjectGlobalRulestackResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param name: certificate name. Required. - :type name: str - :param resource: Resource create parameters. Is either a - CertificateObjectGlobalRulestackResource type or a IO 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. - :return: An instance of LROPoller that returns either CertificateObjectGlobalRulestackResource - or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource] - :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.CertificateObjectGlobalRulestackResource] = 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( - global_rulestack_name=global_rulestack_name, - name=name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateObjectGlobalRulestackResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - 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) - - _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, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}" - } - - @distributed_trace - def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> LROPoller[None]: - """Delete a CertificateObjectGlobalRulestackResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :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: - """ - _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( # type: ignore - global_rulestack_name=global_rulestack_name, - name=name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - 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.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}" - } 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 deleted file mode 100644 index b911c687fa3d..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_certificate_object_local_rulestack_operations.py +++ /dev/null @@ -1,723 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import 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 azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_local_rulestacks_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")) - 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( - "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") - - # 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, local_rulestack_name: str, 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")) - 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( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), - "name": _SERIALIZER.url("name", name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, local_rulestack_name: str, 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")) - 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/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( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), - "name": _SERIALIZER.url("name", name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, local_rulestack_name: str, 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")) - 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( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), - "name": _SERIALIZER.url("name", name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class CertificateObjectLocalRulestackOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient`'s - :attr:`certificate_object_local_rulestack` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_local_rulestacks( - self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> Iterable["_models.CertificateObjectLocalRulestackResource"]: - """List CertificateObjectLocalRulestackResource resources by LocalRulestacks. - - :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 - :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: - ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource] - :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.CertificateObjectLocalRulestackResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 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_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) - - 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 = _convert_request(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) - 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) - - 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 - ) -> _models.CertificateObjectLocalRulestackResource: - """Get a CertificateObjectLocalRulestackResource. - - :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 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 = { - 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.CertificateObjectLocalRulestackResource] = kwargs.pop("cls", None) - - 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) - - _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("CertificateObjectLocalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}" - } - - def _create_or_update_initial( - self, - resource_group_name: str, - local_rulestack_name: str, - name: str, - resource: Union[_models.CertificateObjectLocalRulestackResource, IO], - **kwargs: Any - ) -> _models.CertificateObjectLocalRulestackResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateObjectLocalRulestackResource] = 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, "CertificateObjectLocalRulestackResource") - - request = build_create_or_update_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, - 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) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("CertificateObjectLocalRulestackResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("CertificateObjectLocalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # 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, - resource_group_name: str, - local_rulestack_name: str, - name: str, - resource: _models.CertificateObjectLocalRulestackResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CertificateObjectLocalRulestackResource]: - """Create a CertificateObjectLocalRulestackResource. - - :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 name: certificate name. Required. - :type name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource - :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: - ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - local_rulestack_name: str, - name: str, - resource: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CertificateObjectLocalRulestackResource]: - """Create a CertificateObjectLocalRulestackResource. - - :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 name: certificate name. Required. - :type name: str - :param resource: Resource create parameters. Required. - :type resource: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :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: - ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - local_rulestack_name: str, - name: str, - resource: Union[_models.CertificateObjectLocalRulestackResource, IO], - **kwargs: Any - ) -> LROPoller[_models.CertificateObjectLocalRulestackResource]: - """Create a CertificateObjectLocalRulestackResource. - - :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 name: certificate name. Required. - :type name: str - :param resource: Resource create parameters. Is either a - CertificateObjectLocalRulestackResource type or a IO 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. - :return: An instance of LROPoller that returns either CertificateObjectLocalRulestackResource - or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource] - :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.CertificateObjectLocalRulestackResource] = 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, - local_rulestack_name=local_rulestack_name, - name=name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateObjectLocalRulestackResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - 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) - - _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, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}" - } - - @distributed_trace - def begin_delete( - self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a CertificateObjectLocalRulestackResource. - - :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 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: - """ - _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( # type: ignore - resource_group_name=resource_group_name, - local_rulestack_name=local_rulestack_name, - name=name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - 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.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}" - } 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 deleted file mode 100644 index 606fad16f2a0..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_firewall_status_operations.py +++ /dev/null @@ -1,277 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import 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 .._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_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", "2023-09-01")) - 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"), - } - - _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", "2023-09-01")) - 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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class FirewallStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient`'s - :attr:`firewall_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_firewalls( - self, resource_group_name: str, firewall_name: str, **kwargs: Any - ) -> Iterable["_models.FirewallStatusResource"]: - """List FirewallStatusResource 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 - :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: - ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.FirewallStatusResource] - :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.FirewallStatusResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 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, - template_url=self.list_by_firewalls.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(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) - 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) - - 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. - - :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 - :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 = { - 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.FirewallStatusResource] = 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, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FirewallStatusResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/statuses/default" - } 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 deleted file mode 100644 index adf8749a7356..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_firewalls_operations.py +++ /dev/null @@ -1,1433 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import 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 azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_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", "2023-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/firewalls") - 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="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) - 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( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, 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", "2023-09-01")) - 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"), - } - - _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", "2023-09-01")) - 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}", - ) # 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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, 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", "2023-09-01")) - 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}", - ) # 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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, 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", "2023-09-01")) - 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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_global_rulestack_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", "2023-09-01")) - 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"), - } - - _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_get_log_profile_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", "2023-09-01")) - 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"), - } - - _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_get_support_info_request( - resource_group_name: str, firewall_name: str, subscription_id: str, *, email: Optional[str] = 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")) - 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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if email is not None: - _params["email"] = _SERIALIZER.query("email", email, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_save_log_profile_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", "2023-09-01")) - 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}/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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class FirewallsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient`'s - :attr:`firewalls` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_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: - """ - _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.FirewallResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 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_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) - - 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 = _convert_request(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) - 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) - - 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"]: - """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: - """ - _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.FirewallResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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) - - 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 = _convert_request(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) - 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) - - 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. - - :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 - :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 = { - 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.FirewallResource] = 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, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FirewallResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" - } - - def _create_or_update_initial( - self, resource_group_name: str, firewall_name: str, resource: Union[_models.FirewallResource, IO], **kwargs: Any - ) -> _models.FirewallResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FirewallResource] = 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, "FirewallResource") - - 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, - 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) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("FirewallResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FirewallResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # 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, - resource_group_name: str, - firewall_name: str, - resource: _models.FirewallResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FirewallResource]: - """Create a FirewallResource. - - :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.FirewallResource - :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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - firewall_name: str, - resource: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FirewallResource]: - """Create a FirewallResource. - - :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 - :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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, resource_group_name: str, firewall_name: str, resource: Union[_models.FirewallResource, IO], **kwargs: Any - ) -> LROPoller[_models.FirewallResource]: - """Create a FirewallResource. - - :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 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. - :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] - :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.FirewallResource] = 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 - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FirewallResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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}" - } - - @overload - def update( - self, - resource_group_name: str, - firewall_name: str, - properties: _models.FirewallResourceUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.FirewallResource: - """Update a FirewallResource. - - :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 properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResourceUpdate - :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: - """ - - @overload - def update( - self, - resource_group_name: str, - firewall_name: str, - properties: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.FirewallResource: - """Update a FirewallResource. - - :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 properties: The resource properties to be updated. Required. - :type properties: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: FirewallResource or the result of cls(response) - :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - firewall_name: str, - properties: Union[_models.FirewallResourceUpdate, IO], - **kwargs: Any - ) -> _models.FirewallResource: - """Update a FirewallResource. - - :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 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 - :return: FirewallResource or the result of cls(response) - :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FirewallResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "FirewallResourceUpdate") - - request = build_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, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FirewallResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, firewall_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - 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) - - _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, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" - } - - @distributed_trace - def begin_delete(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> LROPoller[None]: - """Delete a FirewallResource. - - :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 - :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: - """ - _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( # type: ignore - 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 - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - 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.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}" - } - - @distributed_trace - def get_global_rulestack( - self, resource_group_name: str, firewall_name: str, **kwargs: Any - ) -> _models.GlobalRulestackInfo: - """Get Global Rulestack associated with the Firewall. - - :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 - :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 = { - 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.GlobalRulestackInfo] = kwargs.pop("cls", None) - - 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) - - _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("GlobalRulestackInfo", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_global_rulestack.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/getGlobalRulestack" - } - - @distributed_trace - def get_log_profile(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _models.LogSettings: - """Log Profile for Firewall. - - :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 - :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 = { - 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.LogSettings] = kwargs.pop("cls", None) - - 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) - - _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("LogSettings", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_log_profile.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/getLogProfile" - } - - @distributed_trace - def get_support_info( - self, resource_group_name: str, firewall_name: str, email: Optional[str] = None, **kwargs: Any - ) -> _models.SupportInfo: - """support info for firewall. - - :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 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 = { - 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.SupportInfo] = kwargs.pop("cls", None) - - 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) - - _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("SupportInfo", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_support_info.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/getSupportInfo" - } - - @overload - def save_log_profile( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - firewall_name: str, - log_settings: Optional[_models.LogSettings] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Log Profile for Firewall. - - :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 log_settings: Default value is None. - :type log_settings: ~azure.mgmt.paloaltonetworksngfw.models.LogSettings - :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 - self, - resource_group_name: str, - firewall_name: str, - log_settings: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Log Profile for Firewall. - - :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 log_settings: Default value is None. - :type log_settings: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - 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, - **kwargs: Any - ) -> None: - """Log Profile for Firewall. - - :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 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 - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(log_settings, (IOBase, bytes)): - _content = log_settings - else: - if log_settings is not None: - _json = self._serialize.body(log_settings, "LogSettings") - else: - _json = None - - request = build_save_log_profile_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, - template_url=self.save_log_profile.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - save_log_profile.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/saveLogProfile" - } 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 deleted file mode 100644 index 80ba3005d964..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_fqdn_list_global_rulestack_operations.py +++ /dev/null @@ -1,654 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import 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 azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(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")) - 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"), - } - - _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(global_rulestack_name: str, 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")) - 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"), - } - - _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(global_rulestack_name: str, 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")) - 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"), - } - - _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(global_rulestack_name: str, 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")) - 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"), - } - - _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 FqdnListGlobalRulestackOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient`'s - :attr:`fqdn_list_global_rulestack` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, global_rulestack_name: str, **kwargs: Any) -> Iterable["_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: - ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource] - :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.FqdnListGlobalRulestackResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - 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) - - 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 = _convert_request(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) - 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) - - 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. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :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 = { - 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.FqdnListGlobalRulestackResource] = kwargs.pop("cls", None) - - 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) - - _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("FqdnListGlobalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" - } - - def _create_or_update_initial( - self, - global_rulestack_name: str, - name: str, - resource: Union[_models.FqdnListGlobalRulestackResource, IO], - **kwargs: Any - ) -> _models.FqdnListGlobalRulestackResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FqdnListGlobalRulestackResource] = 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, "FqdnListGlobalRulestackResource") - - 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) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("FqdnListGlobalRulestackResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FqdnListGlobalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # 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, - global_rulestack_name: str, - name: str, - resource: _models.FqdnListGlobalRulestackResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FqdnListGlobalRulestackResource]: - """Create a FqdnListGlobalRulestackResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param name: fqdn list name. Required. - :type name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource - :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: - ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - global_rulestack_name: str, - name: str, - resource: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FqdnListGlobalRulestackResource]: - """Create a FqdnListGlobalRulestackResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param name: fqdn list name. Required. - :type name: str - :param resource: Resource create parameters. Required. - :type resource: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :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: - ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - global_rulestack_name: str, - name: str, - resource: Union[_models.FqdnListGlobalRulestackResource, IO], - **kwargs: Any - ) -> LROPoller[_models.FqdnListGlobalRulestackResource]: - """Create a FqdnListGlobalRulestackResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :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. - :return: An instance of LROPoller that returns either FqdnListGlobalRulestackResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource] - :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.FqdnListGlobalRulestackResource] = 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( - global_rulestack_name=global_rulestack_name, - name=name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FqdnListGlobalRulestackResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - 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) - - _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, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" - } - - @distributed_trace - def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> LROPoller[None]: - """Delete a FqdnListGlobalRulestackResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :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: - """ - _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( # type: ignore - global_rulestack_name=global_rulestack_name, - name=name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - 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.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}" - } 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 deleted file mode 100644 index d44277f52f8b..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_fqdn_list_local_rulestack_operations.py +++ /dev/null @@ -1,722 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import 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 azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_local_rulestacks_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")) - 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( - "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") - - # 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, local_rulestack_name: str, 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")) - 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( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), - "name": _SERIALIZER.url("name", name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, local_rulestack_name: str, 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")) - 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/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( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), - "name": _SERIALIZER.url("name", name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, local_rulestack_name: str, 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")) - 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( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), - "name": _SERIALIZER.url("name", name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class FqdnListLocalRulestackOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient`'s - :attr:`fqdn_list_local_rulestack` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_local_rulestacks( - self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> Iterable["_models.FqdnListLocalRulestackResource"]: - """List FqdnListLocalRulestackResource resources by LocalRulestacks. - - :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 - :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: - ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource] - :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.FqdnListLocalRulestackResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 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_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) - - 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 = _convert_request(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) - 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) - - 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 - ) -> _models.FqdnListLocalRulestackResource: - """Get a FqdnListLocalRulestackResource. - - :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 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 = { - 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.FqdnListLocalRulestackResource] = kwargs.pop("cls", None) - - 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) - - _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("FqdnListLocalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}" - } - - def _create_or_update_initial( - self, - resource_group_name: str, - local_rulestack_name: str, - name: str, - resource: Union[_models.FqdnListLocalRulestackResource, IO], - **kwargs: Any - ) -> _models.FqdnListLocalRulestackResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FqdnListLocalRulestackResource] = 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, "FqdnListLocalRulestackResource") - - request = build_create_or_update_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, - 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) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("FqdnListLocalRulestackResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FqdnListLocalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # 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, - resource_group_name: str, - local_rulestack_name: str, - name: str, - resource: _models.FqdnListLocalRulestackResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FqdnListLocalRulestackResource]: - """Create a FqdnListLocalRulestackResource. - - :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 name: fqdn list name. Required. - :type name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource - :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: - ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - local_rulestack_name: str, - name: str, - resource: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FqdnListLocalRulestackResource]: - """Create a FqdnListLocalRulestackResource. - - :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 name: fqdn list name. Required. - :type name: str - :param resource: Resource create parameters. Required. - :type resource: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :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: - ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - local_rulestack_name: str, - name: str, - resource: Union[_models.FqdnListLocalRulestackResource, IO], - **kwargs: Any - ) -> LROPoller[_models.FqdnListLocalRulestackResource]: - """Create a FqdnListLocalRulestackResource. - - :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 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. - :return: An instance of LROPoller that returns either FqdnListLocalRulestackResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource] - :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.FqdnListLocalRulestackResource] = 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, - local_rulestack_name=local_rulestack_name, - name=name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FqdnListLocalRulestackResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - 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) - - _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, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}" - } - - @distributed_trace - def begin_delete( - self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a FqdnListLocalRulestackResource. - - :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 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: - """ - _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( # type: ignore - resource_group_name=resource_group_name, - local_rulestack_name=local_rulestack_name, - name=name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - 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.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}" - } 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 deleted file mode 100644 index 005c272705f0..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_global_rulestack_operations.py +++ /dev/null @@ -1,1671 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import 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 azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(**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")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks") - - # 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(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")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}") - path_format_arguments = { - "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_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")) - 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}") - path_format_arguments = { - "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_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")) - 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}") - path_format_arguments = { - "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_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")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}") - path_format_arguments = { - "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_commit_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")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/commit" - ) - path_format_arguments = { - "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_change_log_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")) - 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"), - } - - _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_advanced_security_objects_request( - global_rulestack_name: str, - *, - type: Union[str, _models.AdvSecurityObjectTypeEnum], - 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")) - 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"), - } - - _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") - _params["type"] = _SERIALIZER.query("type", type, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_app_ids_request( - global_rulestack_name: 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", "2023-09-01")) - 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"), - } - - _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( - 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")) - 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"), - } - - _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(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")) - 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"), - } - - _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_predefined_url_categories_request( - 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")) - 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"), - } - - _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( - global_rulestack_name: str, - *, - type: Union[str, _models.SecurityServicesTypeEnum], - 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")) - 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"), - } - - _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") - _params["type"] = _SERIALIZER.query("type", type, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_revert_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")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/revert" - ) - path_format_arguments = { - "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class GlobalRulestackOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient`'s - :attr:`global_rulestack` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_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: - ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource] - :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.GlobalRulestackResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - 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) - - 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 = _convert_request(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) - 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) - - 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 = { - 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.GlobalRulestackResource] = kwargs.pop("cls", None) - - 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) - - _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("GlobalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}"} - - def _create_or_update_initial( - self, global_rulestack_name: str, resource: Union[_models.GlobalRulestackResource, IO], **kwargs: Any - ) -> _models.GlobalRulestackResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GlobalRulestackResource] = 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, "GlobalRulestackResource") - - 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) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("GlobalRulestackResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("GlobalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}" - } - - @overload - def begin_create_or_update( - self, - global_rulestack_name: str, - resource: _models.GlobalRulestackResource, - *, - 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: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource - :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: - ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, global_rulestack_name: str, resource: IO, *, 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 - :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: - ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, global_rulestack_name: str, resource: Union[_models.GlobalRulestackResource, IO], **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. - :return: An instance of LROPoller that returns either GlobalRulestackResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource] - :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.GlobalRulestackResource] = 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( - global_rulestack_name=global_rulestack_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GlobalRulestackResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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}" - } - - @overload - def update( - self, - global_rulestack_name: str, - properties: _models.GlobalRulestackResourceUpdate, - *, - 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: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResourceUpdate - :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: - """ - - @overload - def update( - self, global_rulestack_name: str, properties: IO, *, 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 - :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: - """ - - @distributed_trace - def update( - self, global_rulestack_name: str, properties: Union[_models.GlobalRulestackResourceUpdate, IO], **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 - :return: GlobalRulestackResource or the result of cls(response) - :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GlobalRulestackResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "GlobalRulestackResourceUpdate") - - 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) - - _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("GlobalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - update.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}"} - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - 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) - - _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, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}"} - - @distributed_trace - def begin_delete(self, global_rulestack_name: str, **kwargs: Any) -> LROPoller[None]: - """Delete 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 - :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: - """ - _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( # type: ignore - global_rulestack_name=global_rulestack_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - 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.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}"} - - def _commit_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_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) - - _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 [202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _commit_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/commit" - } - - @distributed_trace - def begin_commit(self, global_rulestack_name: str, **kwargs: Any) -> LROPoller[None]: - """Commit 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 - :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: - """ - _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._commit_initial( # type: ignore - global_rulestack_name=global_rulestack_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.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" - } - - @distributed_trace - def get_change_log(self, global_rulestack_name: str, **kwargs: Any) -> _models.Changelog: - """Get changelog. - - :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 = { - 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.Changelog] = kwargs.pop("cls", None) - - 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) - - _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("Changelog", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_change_log.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/getChangeLog" - } - - @distributed_trace - def list_advanced_security_objects( - self, - global_rulestack_name: str, - type: Union[str, _models.AdvSecurityObjectTypeEnum], - skip: Optional[str] = None, - top: Optional[int] = None, - **kwargs: Any - ) -> _models.AdvSecurityObjectListResponse: - """Get the list of advanced security objects. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param type: Known values are: "urlCustom" and "feeds". Required. - :type type: str or ~azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectTypeEnum - :param skip: Default value is None. - :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 = { - 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.AdvSecurityObjectListResponse] = kwargs.pop("cls", None) - - 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) - - _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("AdvSecurityObjectListResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_advanced_security_objects.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listAdvancedSecurityObjects" - } - - @distributed_trace - def list_app_ids( - self, - global_rulestack_name: str, - app_id_version: Optional[str] = None, - app_prefix: Optional[str] = None, - skip: Optional[str] = None, - top: Optional[int] = None, - **kwargs: Any - ) -> _models.ListAppIdResponse: - """List of AppIds for GlobalRulestack ApiVersion. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_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 - :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 = { - 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.ListAppIdResponse] = kwargs.pop("cls", None) - - 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) - - _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("ListAppIdResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_app_ids.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listAppIds" - } - - @distributed_trace - def list_countries( - self, global_rulestack_name: str, skip: Optional[str] = None, top: Optional[int] = None, **kwargs: Any - ) -> _models.CountriesResponse: - """List of countries for Rulestack. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param skip: Default value is None. - :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 = { - 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.CountriesResponse] = kwargs.pop("cls", None) - - 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) - - _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("CountriesResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_countries.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listCountries" - } - - @distributed_trace - def list_firewalls(self, global_rulestack_name: str, **kwargs: Any) -> _models.ListFirewallsResponse: - """List of Firewalls associated with Rulestack. - - :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 = { - 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.ListFirewallsResponse] = kwargs.pop("cls", None) - - 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) - - _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("ListFirewallsResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_firewalls.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listFirewalls" - } - - @distributed_trace - def list_predefined_url_categories( - self, global_rulestack_name: str, skip: Optional[str] = None, top: Optional[int] = None, **kwargs: Any - ) -> _models.PredefinedUrlCategoriesResponse: - """List predefined URL categories for rulestack. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param skip: Default value is None. - :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 = { - 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.PredefinedUrlCategoriesResponse] = kwargs.pop("cls", None) - - 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) - - _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("PredefinedUrlCategoriesResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_predefined_url_categories.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listPredefinedUrlCategories" - } - - @distributed_trace - def list_security_services( - self, - global_rulestack_name: str, - type: Union[str, _models.SecurityServicesTypeEnum], - skip: Optional[str] = None, - top: Optional[int] = None, - **kwargs: Any - ) -> _models.SecurityServicesResponse: - """List the security services for rulestack. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param type: Known values are: "antiSpyware", "antiVirus", "ipsVulnerability", "urlFiltering", - "fileBlocking", and "dnsSubscription". Required. - :type type: str or ~azure.mgmt.paloaltonetworksngfw.models.SecurityServicesTypeEnum - :param skip: Default value is None. - :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 = { - 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.SecurityServicesResponse] = kwargs.pop("cls", None) - - 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) - - _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("SecurityServicesResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_security_services.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listSecurityServices" - } - - @distributed_trace - def revert( # pylint: disable=inconsistent-return-statements - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_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) - - _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 [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - revert.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/revert"} 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 deleted file mode 100644 index 66ce2c4250d2..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_local_rules_operations.py +++ /dev/null @@ -1,1071 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import 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 azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_local_rulestacks_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")) - 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( - "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") - - # 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, local_rulestack_name: str, priority: 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")) - 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( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), - "priority": _SERIALIZER.url("priority", priority, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, local_rulestack_name: str, priority: 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")) - 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/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( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), - "priority": _SERIALIZER.url("priority", priority, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, local_rulestack_name: str, priority: 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")) - 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( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), - "priority": _SERIALIZER.url("priority", priority, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_counters_request( - resource_group_name: str, - local_rulestack_name: str, - priority: str, - subscription_id: str, - *, - firewall_name: Optional[str] = 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")) - 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( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), - "priority": _SERIALIZER.url("priority", priority, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if firewall_name is not None: - _params["firewallName"] = _SERIALIZER.query("firewall_name", firewall_name, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_refresh_counters_request( - resource_group_name: str, - local_rulestack_name: str, - priority: str, - subscription_id: str, - *, - firewall_name: Optional[str] = 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")) - 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( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), - "priority": _SERIALIZER.url("priority", priority, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if firewall_name is not None: - _params["firewallName"] = _SERIALIZER.query("firewall_name", firewall_name, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_reset_counters_request( - resource_group_name: str, - local_rulestack_name: str, - priority: str, - subscription_id: str, - *, - firewall_name: Optional[str] = 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")) - 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( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), - "priority": _SERIALIZER.url("priority", priority, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if firewall_name is not None: - _params["firewallName"] = _SERIALIZER.query("firewall_name", firewall_name, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class LocalRulesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient`'s - :attr:`local_rules` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_local_rulestacks( - self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> Iterable["_models.LocalRulesResource"]: - """List LocalRulesResource resources by LocalRulestacks. - - :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 - :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] - :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.LocalRulesResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 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_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) - - 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 = _convert_request(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) - 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) - - 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 - ) -> _models.LocalRulesResource: - """Get a LocalRulesResource. - - :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 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 = { - 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.LocalRulesResource] = kwargs.pop("cls", None) - - 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) - - _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("LocalRulesResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}" - } - - def _create_or_update_initial( - self, - resource_group_name: str, - local_rulestack_name: str, - priority: str, - resource: Union[_models.LocalRulesResource, IO], - **kwargs: Any - ) -> _models.LocalRulesResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LocalRulesResource] = 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, "LocalRulesResource") - - request = build_create_or_update_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, - 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) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("LocalRulesResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("LocalRulesResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # 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, - resource_group_name: str, - local_rulestack_name: str, - priority: str, - resource: _models.LocalRulesResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.LocalRulesResource]: - """Create a LocalRulesResource. - - :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 priority: Local Rule priority. Required. - :type priority: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource - :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: - ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - local_rulestack_name: str, - priority: str, - resource: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.LocalRulesResource]: - """Create a LocalRulesResource. - - :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 priority: Local Rule priority. Required. - :type priority: str - :param resource: Resource create parameters. Required. - :type resource: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :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: - ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - local_rulestack_name: str, - priority: str, - resource: Union[_models.LocalRulesResource, IO], - **kwargs: Any - ) -> LROPoller[_models.LocalRulesResource]: - """Create a LocalRulesResource. - - :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 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. - :return: An instance of LROPoller that returns either LocalRulesResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource] - :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.LocalRulesResource] = 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, - local_rulestack_name=local_rulestack_name, - priority=priority, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("LocalRulesResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, local_rulestack_name: str, priority: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - 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) - - _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, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}" - } - - @distributed_trace - def begin_delete( - self, resource_group_name: str, local_rulestack_name: str, priority: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a LocalRulesResource. - - :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 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: - """ - _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( # type: ignore - resource_group_name=resource_group_name, - local_rulestack_name=local_rulestack_name, - priority=priority, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - 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.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}" - } - - @distributed_trace - def get_counters( - self, - resource_group_name: str, - local_rulestack_name: str, - priority: str, - firewall_name: Optional[str] = None, - **kwargs: Any - ) -> _models.RuleCounter: - """Get counters. - - :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 priority: Local Rule priority. Required. - :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 = { - 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.RuleCounter] = kwargs.pop("cls", None) - - 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) - - _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("RuleCounter", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_counters.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}/getCounters" - } - - @distributed_trace - def refresh_counters( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - local_rulestack_name: str, - priority: str, - firewall_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """Refresh counters. - - :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 priority: Local Rule priority. Required. - :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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_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) - - _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 [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - refresh_counters.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}/refreshCounters" - } - - @distributed_trace - def reset_counters( - self, - resource_group_name: str, - local_rulestack_name: str, - priority: str, - firewall_name: Optional[str] = None, - **kwargs: Any - ) -> _models.RuleCounterReset: - """Reset counters. - - :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 priority: Local Rule priority. Required. - :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 = { - 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.RuleCounterReset] = kwargs.pop("cls", None) - - 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) - - _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("RuleCounterReset", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - reset_counters.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}/resetCounters" - } 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 deleted file mode 100644 index 465af4ad9ac9..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_local_rulestacks_operations.py +++ /dev/null @@ -1,1774 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import 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 azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_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", "2023-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks" - ) - 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="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) - 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( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, 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")) - 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( - "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") - - # 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, 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")) - 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/localRulestacks/{localRulestackName}", - ) # 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 - ), - "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") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, 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")) - 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/localRulestacks/{localRulestackName}", - ) # 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 - ), - "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") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, 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")) - 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( - "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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_commit_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")) - 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( - "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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_change_log_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")) - 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( - "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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_support_info_request( - resource_group_name: str, - local_rulestack_name: str, - subscription_id: str, - *, - email: Optional[str] = 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")) - 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( - "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 email is not None: - _params["email"] = _SERIALIZER.query("email", email, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_advanced_security_objects_request( - resource_group_name: str, - local_rulestack_name: str, - subscription_id: str, - *, - type: Union[str, _models.AdvSecurityObjectTypeEnum], - 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")) - 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( - "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") - _params["type"] = _SERIALIZER.query("type", type, "str") - - # 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")) - 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( - "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") - - # 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, - subscription_id: str, - *, - type: Union[str, _models.SecurityServicesTypeEnum], - 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")) - 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( - "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") - _params["type"] = _SERIALIZER.query("type", type, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_revert_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")) - 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( - "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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class LocalRulestacksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient`'s - :attr:`local_rulestacks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_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: - ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource] - :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.LocalRulestackResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 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_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) - - 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 = _convert_request(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) - 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) - - 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"]: - """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: - ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource] - :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.LocalRulestackResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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) - - 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 = _convert_request(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) - 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) - - 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. - - :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 - :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 = { - 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.LocalRulestackResource] = kwargs.pop("cls", None) - - 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) - - _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("LocalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" - } - - def _create_or_update_initial( - self, - resource_group_name: str, - local_rulestack_name: str, - resource: Union[_models.LocalRulestackResource, IO], - **kwargs: Any - ) -> _models.LocalRulestackResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LocalRulestackResource] = 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, "LocalRulestackResource") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - local_rulestack_name=local_rulestack_name, - subscription_id=self._config.subscription_id, - 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) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("LocalRulestackResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("LocalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # 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, - resource_group_name: str, - local_rulestack_name: str, - resource: _models.LocalRulestackResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.LocalRulestackResource]: - """Create a LocalRulestackResource. - - :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 resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource - :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: - ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - local_rulestack_name: str, - resource: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.LocalRulestackResource]: - """Create a LocalRulestackResource. - - :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 resource: Resource create parameters. Required. - :type resource: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :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: - ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - local_rulestack_name: str, - resource: Union[_models.LocalRulestackResource, IO], - **kwargs: Any - ) -> LROPoller[_models.LocalRulestackResource]: - """Create a LocalRulestackResource. - - :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 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. - :return: An instance of LROPoller that returns either LocalRulestackResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource] - :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.LocalRulestackResource] = 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, - local_rulestack_name=local_rulestack_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("LocalRulestackResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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}" - } - - @overload - def update( - self, - resource_group_name: str, - local_rulestack_name: str, - properties: _models.LocalRulestackResourceUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.LocalRulestackResource: - """Update a LocalRulestackResource. - - :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 properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResourceUpdate - :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: - """ - - @overload - def update( - self, - resource_group_name: str, - local_rulestack_name: str, - properties: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.LocalRulestackResource: - """Update a LocalRulestackResource. - - :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 properties: The resource properties to be updated. Required. - :type properties: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LocalRulestackResource or the result of cls(response) - :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - local_rulestack_name: str, - properties: Union[_models.LocalRulestackResourceUpdate, IO], - **kwargs: Any - ) -> _models.LocalRulestackResource: - """Update a LocalRulestackResource. - - :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 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 - :return: LocalRulestackResource or the result of cls(response) - :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LocalRulestackResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "LocalRulestackResourceUpdate") - - request = build_update_request( - resource_group_name=resource_group_name, - local_rulestack_name=local_rulestack_name, - subscription_id=self._config.subscription_id, - 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) - - _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("LocalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - 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) - - _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, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" - } - - @distributed_trace - def begin_delete(self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any) -> LROPoller[None]: - """Delete a LocalRulestackResource. - - :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 - :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: - """ - _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( # type: ignore - resource_group_name=resource_group_name, - local_rulestack_name=local_rulestack_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - 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.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}" - } - - def _commit_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_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) - - _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 [202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _commit_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/commit" - } - - @distributed_trace - def begin_commit(self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any) -> LROPoller[None]: - """Commit rulestack configuration. - - :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 - :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: - """ - _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._commit_initial( # type: ignore - resource_group_name=resource_group_name, - local_rulestack_name=local_rulestack_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.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" - } - - @distributed_trace - def get_change_log(self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any) -> _models.Changelog: - """Get changelog. - - :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 - :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 = { - 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.Changelog] = kwargs.pop("cls", None) - - 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) - - _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("Changelog", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_change_log.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/getChangeLog" - } - - @distributed_trace - def get_support_info( - self, resource_group_name: str, local_rulestack_name: str, email: Optional[str] = None, **kwargs: Any - ) -> _models.SupportInfo: - """support info 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 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 = { - 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.SupportInfo] = kwargs.pop("cls", None) - - 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) - - _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("SupportInfo", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_support_info.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/getSupportInfo" - } - - @distributed_trace - def list_advanced_security_objects( - self, - resource_group_name: str, - local_rulestack_name: str, - type: Union[str, _models.AdvSecurityObjectTypeEnum], - skip: Optional[str] = None, - top: Optional[int] = None, - **kwargs: Any - ) -> _models.AdvSecurityObjectListResponse: - """Get the list of advanced security objects. - - :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 type: Known values are: "urlCustom" and "feeds". Required. - :type type: str or ~azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectTypeEnum - :param skip: Default value is None. - :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 = { - 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.AdvSecurityObjectListResponse] = kwargs.pop("cls", None) - - 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, - 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) - - _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("AdvSecurityObjectListResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_advanced_security_objects.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listAdvancedSecurityObjects" - } - - @distributed_trace - def list_firewalls( - self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> _models.ListFirewallsResponse: - """List of Firewalls associated with 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 - :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 = { - 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.ListFirewallsResponse] = kwargs.pop("cls", None) - - 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) - - _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("ListFirewallsResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_firewalls.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listFirewalls" - } - - @distributed_trace - def list_security_services( - self, - resource_group_name: str, - local_rulestack_name: str, - type: Union[str, _models.SecurityServicesTypeEnum], - skip: Optional[str] = None, - top: Optional[int] = None, - **kwargs: Any - ) -> _models.SecurityServicesResponse: - """List the security services 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 type: Known values are: "antiSpyware", "antiVirus", "ipsVulnerability", "urlFiltering", - "fileBlocking", and "dnsSubscription". Required. - :type type: str or ~azure.mgmt.paloaltonetworksngfw.models.SecurityServicesTypeEnum - :param skip: Default value is None. - :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 = { - 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.SecurityServicesResponse] = kwargs.pop("cls", None) - - request = build_list_security_services_request( - resource_group_name=resource_group_name, - local_rulestack_name=local_rulestack_name, - subscription_id=self._config.subscription_id, - 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) - - _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("SecurityServicesResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_security_services.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listSecurityServices" - } - - @distributed_trace - def revert( # pylint: disable=inconsistent-return-statements - 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. - Required. - :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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_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) - - _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 [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - revert.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/revert" - } 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..602d128423d9 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,50 +1,60 @@ -# 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. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +from collections.abc import MutableMapping +from io import IOBase +import json +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient 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.rest import HttpRequest +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 .._serialization import Serializer -from .._vendor import _convert_request +from .._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration +from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +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]] +JSON = MutableMapping[str, Any] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request(**kwargs: Any) -> HttpRequest: +def build_operations_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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/operations") + _url = "/providers/PaloAltoNetworks.Cloudngfw/operations" # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -55,6 +65,2658 @@ def build_list_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_global_rulestack_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", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_global_rulestack_create_or_update_request( # pylint: disable=name-too-long + global_rulestack_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_global_rulestack_update_request(global_rulestack_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_global_rulestack_delete_request(global_rulestack_name: str, **kwargs: Any) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_global_rulestack_list_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks" + + # 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_global_rulestack_commit_request(global_rulestack_name: str, **kwargs: Any) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/commit" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_global_rulestack_get_change_log_request( # pylint: disable=name-too-long + 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", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/getChangeLog" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_global_rulestack_list_advanced_security_objects_request( # pylint: disable=name-too-long + global_rulestack_name: str, + *, + type: Union[str, _models.AdvSecurityObjectTypeEnum], + 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 = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listAdvancedSecurityObjects" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_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") + _params["type"] = _SERIALIZER.query("type", type, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_global_rulestack_list_app_ids_request( # pylint: disable=name-too-long + global_rulestack_name: 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 = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listAppIds" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_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_global_rulestack_list_countries_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", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listCountries" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_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_global_rulestack_list_firewalls_request( # pylint: disable=name-too-long + 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", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listFirewalls" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_global_rulestack_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", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listPredefinedUrlCategories" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_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_global_rulestack_list_security_services_request( # pylint: disable=name-too-long + global_rulestack_name: str, + *, + type: Union[str, _models.SecurityServicesTypeEnum], + 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 = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listSecurityServices" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_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") + _params["type"] = _SERIALIZER.query("type", type, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_global_rulestack_revert_request(global_rulestack_name: str, **kwargs: Any) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/revert" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_certificate_object_global_rulestack_get_request( # pylint: disable=name-too-long + global_rulestack_name: str, 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", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_certificate_object_global_rulestack_create_or_update_request( # pylint: disable=name-too-long + global_rulestack_name: str, name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_certificate_object_global_rulestack_delete_request( # pylint: disable=name-too-long + global_rulestack_name: str, name: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_certificate_object_global_rulestack_list_request( # pylint: disable=name-too-long + 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", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_fqdn_list_global_rulestack_get_request( # pylint: disable=name-too-long + global_rulestack_name: str, 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", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_fqdn_list_global_rulestack_create_or_update_request( # pylint: disable=name-too-long + global_rulestack_name: str, name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_fqdn_list_global_rulestack_delete_request( # pylint: disable=name-too-long + global_rulestack_name: str, name: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_fqdn_list_global_rulestack_list_request( # pylint: disable=name-too-long + 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", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_post_rules_get_request(global_rulestack_name: str, priority: 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 = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + "priority": _SERIALIZER.url("priority", priority, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_post_rules_create_or_update_request( # pylint: disable=name-too-long + global_rulestack_name: str, priority: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + "priority": _SERIALIZER.url("priority", priority, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_post_rules_delete_request(global_rulestack_name: str, priority: str, **kwargs: Any) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + "priority": _SERIALIZER.url("priority", priority, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_post_rules_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", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_post_rules_get_counters_request( + global_rulestack_name: str, priority: str, *, firewall_name: Optional[str] = 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 = ( + "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}/getCounters" + ) + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + "priority": _SERIALIZER.url("priority", priority, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if firewall_name is not None: + _params["firewallName"] = _SERIALIZER.query("firewall_name", firewall_name, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_post_rules_refresh_counters_request( # pylint: disable=name-too-long + global_rulestack_name: str, priority: str, *, firewall_name: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}/refreshCounters" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + "priority": _SERIALIZER.url("priority", priority, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if firewall_name is not None: + _params["firewallName"] = _SERIALIZER.query("firewall_name", firewall_name, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_post_rules_reset_counters_request( + global_rulestack_name: str, priority: str, *, firewall_name: Optional[str] = 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 = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}/resetCounters" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + "priority": _SERIALIZER.url("priority", priority, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if firewall_name is not None: + _params["firewallName"] = _SERIALIZER.query("firewall_name", firewall_name, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_prefix_list_global_rulestack_get_request( # pylint: disable=name-too-long + global_rulestack_name: str, 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", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_prefix_list_global_rulestack_create_or_update_request( # pylint: disable=name-too-long + global_rulestack_name: str, name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_prefix_list_global_rulestack_delete_request( # pylint: disable=name-too-long + global_rulestack_name: str, name: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_prefix_list_global_rulestack_list_request( # pylint: disable=name-too-long + 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", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_pre_rules_get_request(global_rulestack_name: str, priority: 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 = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + "priority": _SERIALIZER.url("priority", priority, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_pre_rules_create_or_update_request(global_rulestack_name: str, priority: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + "priority": _SERIALIZER.url("priority", priority, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_pre_rules_delete_request(global_rulestack_name: str, priority: str, **kwargs: Any) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + "priority": _SERIALIZER.url("priority", priority, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_pre_rules_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", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_pre_rules_get_counters_request( + global_rulestack_name: str, priority: str, *, firewall_name: Optional[str] = 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 = ( + "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}/getCounters" + ) + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + "priority": _SERIALIZER.url("priority", priority, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if firewall_name is not None: + _params["firewallName"] = _SERIALIZER.query("firewall_name", firewall_name, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_pre_rules_refresh_counters_request( + global_rulestack_name: str, priority: str, *, firewall_name: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + # Construct URL + _url = "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}/refreshCounters" + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + "priority": _SERIALIZER.url("priority", priority, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if firewall_name is not None: + _params["firewallName"] = _SERIALIZER.query("firewall_name", firewall_name, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_pre_rules_reset_counters_request( + global_rulestack_name: str, priority: str, *, firewall_name: Optional[str] = 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 = ( + "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}/resetCounters" + ) + path_format_arguments = { + "globalRulestackName": _SERIALIZER.url("global_rulestack_name", global_rulestack_name, "str"), + "priority": _SERIALIZER.url("priority", priority, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if firewall_name is not None: + _params["firewallName"] = _SERIALIZER.query("firewall_name", firewall_name, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_firewalls_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 = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "firewallName": _SERIALIZER.url("firewall_name", firewall_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_firewalls_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "firewallName": _SERIALIZER.url("firewall_name", firewall_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_firewalls_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "firewallName": _SERIALIZER.url("firewall_name", firewall_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_firewalls_delete_request( + resource_group_name: str, firewall_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "firewallName": _SERIALIZER.url("firewall_name", firewall_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_firewalls_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_firewalls_list_by_subscription_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 = "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/firewalls" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_firewalls_get_global_rulestack_request( # pylint: disable=name-too-long + 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 = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/getGlobalRulestack" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "firewallName": _SERIALIZER.url("firewall_name", firewall_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_firewalls_get_log_profile_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 = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/getLogProfile" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "firewallName": _SERIALIZER.url("firewall_name", firewall_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_firewalls_get_support_info_request( + resource_group_name: str, firewall_name: str, subscription_id: str, *, email: Optional[str] = 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 = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/getSupportInfo" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "firewallName": _SERIALIZER.url("firewall_name", firewall_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if email is not None: + _params["email"] = _SERIALIZER.query("email", email, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_firewalls_save_log_profile_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/saveLogProfile" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "firewallName": _SERIALIZER.url("firewall_name", firewall_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_local_rulestacks_get_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", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_local_rulestacks_create_or_update_request( # pylint: disable=name-too-long + 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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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") + + # 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_local_rulestacks_update_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_local_rulestacks_delete_request( + resource_group_name: str, local_rulestack_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_local_rulestacks_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_local_rulestacks_list_by_subscription_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 = "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_local_rulestacks_commit_request( + resource_group_name: str, local_rulestack_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/commit" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_local_rulestacks_get_change_log_request( # pylint: disable=name-too-long + 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", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/getChangeLog" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_local_rulestacks_get_support_info_request( # pylint: disable=name-too-long + resource_group_name: str, + local_rulestack_name: str, + subscription_id: str, + *, + email: Optional[str] = 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 = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/getSupportInfo" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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 email is not None: + _params["email"] = _SERIALIZER.query("email", email, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_local_rulestacks_list_advanced_security_objects_request( # pylint: disable=name-too-long + resource_group_name: str, + local_rulestack_name: str, + subscription_id: str, + *, + type: Union[str, _models.AdvSecurityObjectTypeEnum], + 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 = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listAdvancedSecurityObjects" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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") + _params["type"] = _SERIALIZER.query("type", type, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_local_rulestacks_list_app_ids_request( # pylint: disable=name-too-long + 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 = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listAppIds" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_local_rulestacks_list_countries_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 = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listCountries" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_local_rulestacks_list_firewalls_request( # pylint: disable=name-too-long + 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", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listFirewalls" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_local_rulestacks_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 = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listPredefinedUrlCategories" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_local_rulestacks_list_security_services_request( # pylint: disable=name-too-long + resource_group_name: str, + local_rulestack_name: str, + subscription_id: str, + *, + type: Union[str, _models.SecurityServicesTypeEnum], + 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 = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listSecurityServices" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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") + _params["type"] = _SERIALIZER.query("type", type, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_local_rulestacks_revert_request( + resource_group_name: str, local_rulestack_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/revert" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_metrics_object_firewall_get_request( # pylint: disable=name-too-long + 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 = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/metrics/default" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "firewallName": _SERIALIZER.url("firewall_name", firewall_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_metrics_object_firewall_create_or_update_request( # pylint: disable=name-too-long + 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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/metrics/default" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "firewallName": _SERIALIZER.url("firewall_name", firewall_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_metrics_object_firewall_delete_request( # pylint: disable=name-too-long + resource_group_name: str, firewall_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/metrics/default" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "firewallName": _SERIALIZER.url("firewall_name", firewall_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_metrics_object_firewall_list_by_firewalls_request( # pylint: disable=name-too-long + 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 = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/metrics" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "firewallName": _SERIALIZER.url("firewall_name", firewall_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_firewall_status_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 = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/statuses/default" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "firewallName": _SERIALIZER.url("firewall_name", firewall_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_firewall_status_list_by_firewalls_request( # pylint: disable=name-too-long + 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 = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/statuses" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "firewallName": _SERIALIZER.url("firewall_name", firewall_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_certificate_object_local_rulestack_get_request( # pylint: disable=name-too-long + resource_group_name: str, local_rulestack_name: str, 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 = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_certificate_object_local_rulestack_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, local_rulestack_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_certificate_object_local_rulestack_delete_request( # pylint: disable=name-too-long + resource_group_name: str, local_rulestack_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_certificate_object_local_rulestack_list_by_local_rulestacks_request( # pylint: disable=name-too-long + 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", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_fqdn_list_local_rulestack_get_request( # pylint: disable=name-too-long + resource_group_name: str, local_rulestack_name: str, 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 = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_fqdn_list_local_rulestack_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, local_rulestack_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_fqdn_list_local_rulestack_delete_request( # pylint: disable=name-too-long + resource_group_name: str, local_rulestack_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_fqdn_list_local_rulestack_list_by_local_rulestacks_request( # pylint: disable=name-too-long + 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", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_local_rules_get_request( + resource_group_name: str, local_rulestack_name: str, priority: 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 = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), + "priority": _SERIALIZER.url("priority", priority, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_local_rules_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, local_rulestack_name: str, priority: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), + "priority": _SERIALIZER.url("priority", priority, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_local_rules_delete_request( + resource_group_name: str, local_rulestack_name: str, priority: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), + "priority": _SERIALIZER.url("priority", priority, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_local_rules_list_by_local_rulestacks_request( # pylint: disable=name-too-long + 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", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_local_rules_get_counters_request( + resource_group_name: str, + local_rulestack_name: str, + priority: str, + subscription_id: str, + *, + firewall_name: Optional[str] = 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 = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}/getCounters" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), + "priority": _SERIALIZER.url("priority", priority, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if firewall_name is not None: + _params["firewallName"] = _SERIALIZER.query("firewall_name", firewall_name, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_local_rules_refresh_counters_request( # pylint: disable=name-too-long + resource_group_name: str, + local_rulestack_name: str, + priority: str, + subscription_id: str, + *, + firewall_name: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}/refreshCounters" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), + "priority": _SERIALIZER.url("priority", priority, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if firewall_name is not None: + _params["firewallName"] = _SERIALIZER.query("firewall_name", firewall_name, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_local_rules_reset_counters_request( + resource_group_name: str, + local_rulestack_name: str, + priority: str, + subscription_id: str, + *, + firewall_name: Optional[str] = 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 = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}/resetCounters" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), + "priority": _SERIALIZER.url("priority", priority, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if firewall_name is not None: + _params["firewallName"] = _SERIALIZER.query("firewall_name", firewall_name, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_prefix_list_local_rulestack_get_request( # pylint: disable=name-too-long + resource_group_name: str, local_rulestack_name: str, 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 = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_prefix_list_local_rulestack_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, local_rulestack_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_prefix_list_local_rulestack_delete_request( # pylint: disable=name-too-long + resource_group_name: str, local_rulestack_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-10-08")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_prefix_list_local_rulestack_list_by_local_rulestacks_request( # pylint: disable=name-too-long + 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", "2025-10-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_palo_alto_networks_cloudngfw_operations_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 = "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/createProductSerialNumber" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_palo_alto_networks_cloudngfw_operations_list_cloud_manager_tenants_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 = "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/listCloudManagerTenants" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_palo_alto_networks_cloudngfw_operations_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 = "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/listProductSerialNumberStatus" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_palo_alto_networks_cloudngfw_operations_list_support_info_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 = "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/listSupportInfo" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + class Operations: """ .. warning:: @@ -62,34 +2724,10512 @@ class Operations: Instead, you should access the following operations through :class:`~azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient`'s - :attr:`operations` attribute. + :attr:`operations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: 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) -> ItemPaged["_models.Operation"]: + """List the operations for the provider. + + :return: An iterator like instance of Operation + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Operation], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class GlobalRulestackOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient`'s + :attr:`global_rulestack` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: 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 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 + :return: GlobalRulestackResource. The GlobalRulestackResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GlobalRulestackResource] = kwargs.pop("cls", None) + + _request = build_global_rulestack_get_request( + global_rulestack_name=global_rulestack_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.GlobalRulestackResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + global_rulestack_name: str, + resource: Union[_models.GlobalRulestackResource, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_global_rulestack_create_or_update_request( + global_rulestack_name=global_rulestack_name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + global_rulestack_name: str, + resource: _models.GlobalRulestackResource, + *, + 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: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource + :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 GlobalRulestackResource. The + GlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, global_rulestack_name: str, resource: JSON, *, 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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns GlobalRulestackResource. The + GlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + 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[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 GlobalRulestackResource. The + GlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + global_rulestack_name: str, + resource: Union[_models.GlobalRulestackResource, JSON, 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 one of the following types: + GlobalRulestackResource, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource or JSON or + IO[bytes] + :return: An instance of LROPoller that returns GlobalRulestackResource. The + GlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GlobalRulestackResource] = 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( + global_rulestack_name=global_rulestack_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.GlobalRulestackResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.GlobalRulestackResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.GlobalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def update( + self, + global_rulestack_name: str, + properties: _models.GlobalRulestackResourceUpdate, + *, + 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: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResourceUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: GlobalRulestackResource. The GlobalRulestackResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, global_rulestack_name: str, properties: JSON, *, 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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: GlobalRulestackResource. The GlobalRulestackResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + 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[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: GlobalRulestackResource. The GlobalRulestackResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + global_rulestack_name: str, + properties: Union[_models.GlobalRulestackResourceUpdate, JSON, 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 one of the following types: + GlobalRulestackResourceUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResourceUpdate or JSON + or IO[bytes] + :return: GlobalRulestackResource. The GlobalRulestackResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GlobalRulestackResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_global_rulestack_update_request( + global_rulestack_name=global_rulestack_name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.GlobalRulestackResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial(self, global_rulestack_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_global_rulestack_delete_request( + global_rulestack_name=global_rulestack_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, global_rulestack_name: str, **kwargs: Any) -> LROPoller[None]: + """Delete a GlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + global_rulestack_name=global_rulestack_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.GlobalRulestackResource"]: + """List GlobalRulestackResource resources by Tenant. + + :return: An iterator like instance of GlobalRulestackResource + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GlobalRulestackResource]] = 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_global_rulestack_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.GlobalRulestackResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _commit_initial(self, global_rulestack_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_global_rulestack_commit_request( + global_rulestack_name=global_rulestack_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_commit(self, global_rulestack_name: str, **kwargs: Any) -> LROPoller[None]: + """Commit rulestack configuration. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._commit_initial( + global_rulestack_name=global_rulestack_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get_change_log(self, global_rulestack_name: str, **kwargs: Any) -> _models.Changelog: + """Get changelog. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :return: Changelog. The Changelog is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.Changelog + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Changelog] = kwargs.pop("cls", None) + + _request = build_global_rulestack_get_change_log_request( + global_rulestack_name=global_rulestack_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Changelog, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_advanced_security_objects( + self, + global_rulestack_name: str, + *, + type: Union[str, _models.AdvSecurityObjectTypeEnum], + skip: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> _models.AdvSecurityObjectListResponse: + """Get the list of advanced security objects. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :keyword type: Known values are: "urlCustom" and "feeds". Required. + :paramtype type: str or ~azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectTypeEnum + :keyword skip: Default value is None. + :paramtype skip: str + :keyword top: Default value is None. + :paramtype top: int + :return: AdvSecurityObjectListResponse. The AdvSecurityObjectListResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectListResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AdvSecurityObjectListResponse] = kwargs.pop("cls", None) + + _request = build_global_rulestack_list_advanced_security_objects_request( + global_rulestack_name=global_rulestack_name, + type=type, + skip=skip, + top=top, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AdvSecurityObjectListResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_app_ids( + self, + global_rulestack_name: str, + *, + app_id_version: Optional[str] = None, + app_prefix: Optional[str] = None, + skip: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> _models.ListAppIdResponse: + """List of AppIds for GlobalRulestack ApiVersion. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :keyword app_id_version: Default value is None. + :paramtype app_id_version: str + :keyword app_prefix: Default value is None. + :paramtype app_prefix: str + :keyword skip: Default value is None. + :paramtype skip: str + :keyword top: Default value is None. + :paramtype top: int + :return: ListAppIdResponse. The ListAppIdResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.ListAppIdResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ListAppIdResponse] = kwargs.pop("cls", None) + + _request = build_global_rulestack_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ListAppIdResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_countries( + self, global_rulestack_name: str, *, skip: Optional[str] = None, top: Optional[int] = None, **kwargs: Any + ) -> _models.CountriesResponse: + """List of countries for Rulestack. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :keyword skip: Default value is None. + :paramtype skip: str + :keyword top: Default value is None. + :paramtype top: int + :return: CountriesResponse. The CountriesResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.CountriesResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CountriesResponse] = kwargs.pop("cls", None) + + _request = build_global_rulestack_list_countries_request( + global_rulestack_name=global_rulestack_name, + skip=skip, + top=top, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CountriesResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_firewalls(self, global_rulestack_name: str, **kwargs: Any) -> _models.ListFirewallsResponse: + """List of Firewalls associated with Rulestack. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :return: ListFirewallsResponse. The ListFirewallsResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.ListFirewallsResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ListFirewallsResponse] = kwargs.pop("cls", None) + + _request = build_global_rulestack_list_firewalls_request( + global_rulestack_name=global_rulestack_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ListFirewallsResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_predefined_url_categories( + self, global_rulestack_name: str, *, skip: Optional[str] = None, top: Optional[int] = None, **kwargs: Any + ) -> _models.PredefinedUrlCategoriesResponse: + """List predefined URL categories for rulestack. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :keyword skip: Default value is None. + :paramtype skip: str + :keyword top: Default value is None. + :paramtype top: int + :return: PredefinedUrlCategoriesResponse. The PredefinedUrlCategoriesResponse is compatible + with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.PredefinedUrlCategoriesResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PredefinedUrlCategoriesResponse] = kwargs.pop("cls", None) + + _request = build_global_rulestack_list_predefined_url_categories_request( + global_rulestack_name=global_rulestack_name, + skip=skip, + top=top, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PredefinedUrlCategoriesResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_security_services( + self, + global_rulestack_name: str, + *, + type: Union[str, _models.SecurityServicesTypeEnum], + skip: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> _models.SecurityServicesResponse: + """List the security services for rulestack. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :keyword type: Known values are: "antiSpyware", "antiVirus", "ipsVulnerability", + "urlFiltering", "fileBlocking", and "dnsSubscription". Required. + :paramtype type: str or ~azure.mgmt.paloaltonetworksngfw.models.SecurityServicesTypeEnum + :keyword skip: Default value is None. + :paramtype skip: str + :keyword top: Default value is None. + :paramtype top: int + :return: SecurityServicesResponse. The SecurityServicesResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SecurityServicesResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SecurityServicesResponse] = kwargs.pop("cls", None) + + _request = build_global_rulestack_list_security_services_request( + global_rulestack_name=global_rulestack_name, + type=type, + skip=skip, + top=top, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SecurityServicesResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def revert( # pylint: disable=inconsistent-return-statements + self, global_rulestack_name: str, **kwargs: Any + ) -> None: + """Revert rulestack configuration. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_global_rulestack_revert_request( + global_rulestack_name=global_rulestack_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class CertificateObjectGlobalRulestackOperations: # 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:`certificate_object_global_rulestack` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: 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 get( + self, global_rulestack_name: str, name: str, **kwargs: Any + ) -> _models.CertificateObjectGlobalRulestackResource: + """Get a CertificateObjectGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: certificate name. Required. + :type name: str + :return: CertificateObjectGlobalRulestackResource. The CertificateObjectGlobalRulestackResource + is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CertificateObjectGlobalRulestackResource] = kwargs.pop("cls", None) + + _request = build_certificate_object_global_rulestack_get_request( + global_rulestack_name=global_rulestack_name, + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CertificateObjectGlobalRulestackResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + global_rulestack_name: str, + name: str, + resource: Union[_models.CertificateObjectGlobalRulestackResource, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_certificate_object_global_rulestack_create_or_update_request( + global_rulestack_name=global_rulestack_name, + name=name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + global_rulestack_name: str, + name: str, + resource: _models.CertificateObjectGlobalRulestackResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CertificateObjectGlobalRulestackResource]: + """Create a CertificateObjectGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: certificate name. Required. + :type name: str + :param resource: Resource create parameters. Required. + :type resource: + ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource + :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 CertificateObjectGlobalRulestackResource. The + CertificateObjectGlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + global_rulestack_name: str, + name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CertificateObjectGlobalRulestackResource]: + """Create a CertificateObjectGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: certificate name. Required. + :type name: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns CertificateObjectGlobalRulestackResource. The + CertificateObjectGlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + global_rulestack_name: str, + name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CertificateObjectGlobalRulestackResource]: + """Create a CertificateObjectGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: certificate name. Required. + :type 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 CertificateObjectGlobalRulestackResource. The + CertificateObjectGlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + global_rulestack_name: str, + name: str, + resource: Union[_models.CertificateObjectGlobalRulestackResource, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.CertificateObjectGlobalRulestackResource]: + """Create a CertificateObjectGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: certificate name. Required. + :type name: str + :param resource: Resource create parameters. Is one of the following types: + CertificateObjectGlobalRulestackResource, JSON, IO[bytes] Required. + :type resource: + ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource or JSON or + IO[bytes] + :return: An instance of LROPoller that returns CertificateObjectGlobalRulestackResource. The + CertificateObjectGlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateObjectGlobalRulestackResource] = 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( + global_rulestack_name=global_rulestack_name, + name=name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CertificateObjectGlobalRulestackResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CertificateObjectGlobalRulestackResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CertificateObjectGlobalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, global_rulestack_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_certificate_object_global_rulestack_delete_request( + global_rulestack_name=global_rulestack_name, + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> LROPoller[None]: + """Delete a CertificateObjectGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: certificate name. Required. + :type name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + global_rulestack_name=global_rulestack_name, + name=name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, global_rulestack_name: str, **kwargs: Any + ) -> ItemPaged["_models.CertificateObjectGlobalRulestackResource"]: + """List CertificateObjectGlobalRulestackResource resources by Tenant. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :return: An iterator like instance of CertificateObjectGlobalRulestackResource + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CertificateObjectGlobalRulestackResource]] = 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_certificate_object_global_rulestack_list_request( + global_rulestack_name=global_rulestack_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.CertificateObjectGlobalRulestackResource], deserialized.get("value", []) + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class FqdnListGlobalRulestackOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient`'s + :attr:`fqdn_list_global_rulestack` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: 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 get(self, global_rulestack_name: str, name: str, **kwargs: Any) -> _models.FqdnListGlobalRulestackResource: + """Get a FqdnListGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: fqdn list name. Required. + :type name: str + :return: FqdnListGlobalRulestackResource. The FqdnListGlobalRulestackResource is compatible + with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.FqdnListGlobalRulestackResource] = kwargs.pop("cls", None) + + _request = build_fqdn_list_global_rulestack_get_request( + global_rulestack_name=global_rulestack_name, + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.FqdnListGlobalRulestackResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + global_rulestack_name: str, + name: str, + resource: Union[_models.FqdnListGlobalRulestackResource, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_fqdn_list_global_rulestack_create_or_update_request( + global_rulestack_name=global_rulestack_name, + name=name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + global_rulestack_name: str, + name: str, + resource: _models.FqdnListGlobalRulestackResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FqdnListGlobalRulestackResource]: + """Create a FqdnListGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: fqdn list name. Required. + :type name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource + :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 FqdnListGlobalRulestackResource. The + FqdnListGlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + global_rulestack_name: str, + name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FqdnListGlobalRulestackResource]: + """Create a FqdnListGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: fqdn list name. Required. + :type name: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns FqdnListGlobalRulestackResource. The + FqdnListGlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + global_rulestack_name: str, + name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FqdnListGlobalRulestackResource]: + """Create a FqdnListGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: fqdn list name. Required. + :type 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 FqdnListGlobalRulestackResource. The + FqdnListGlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + global_rulestack_name: str, + name: str, + resource: Union[_models.FqdnListGlobalRulestackResource, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.FqdnListGlobalRulestackResource]: + """Create a FqdnListGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: fqdn list name. Required. + :type name: str + :param resource: Resource create parameters. Is one of the following types: + FqdnListGlobalRulestackResource, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource or JSON + or IO[bytes] + :return: An instance of LROPoller that returns FqdnListGlobalRulestackResource. The + FqdnListGlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FqdnListGlobalRulestackResource] = 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( + global_rulestack_name=global_rulestack_name, + name=name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.FqdnListGlobalRulestackResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.FqdnListGlobalRulestackResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.FqdnListGlobalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, global_rulestack_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_fqdn_list_global_rulestack_delete_request( + global_rulestack_name=global_rulestack_name, + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> LROPoller[None]: + """Delete a FqdnListGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: fqdn list name. Required. + :type name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + global_rulestack_name=global_rulestack_name, + name=name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list(self, 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 + :return: An iterator like instance of FqdnListGlobalRulestackResource + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.FqdnListGlobalRulestackResource]] = 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_fqdn_list_global_rulestack_list_request( + global_rulestack_name=global_rulestack_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.FqdnListGlobalRulestackResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class PostRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient`'s + :attr:`post_rules` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: 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 get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> _models.PostRulesResource: + """Get a PostRulesResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Post Rule priority. Required. + :type priority: str + :return: PostRulesResource. The PostRulesResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PostRulesResource] = kwargs.pop("cls", None) + + _request = build_post_rules_get_request( + global_rulestack_name=global_rulestack_name, + priority=priority, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PostRulesResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + global_rulestack_name: str, + priority: str, + resource: Union[_models.PostRulesResource, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_post_rules_create_or_update_request( + global_rulestack_name=global_rulestack_name, + priority=priority, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + global_rulestack_name: str, + priority: str, + resource: _models.PostRulesResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PostRulesResource]: + """Create a PostRulesResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Post Rule priority. Required. + :type priority: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource + :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 PostRulesResource. The PostRulesResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + global_rulestack_name: str, + priority: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PostRulesResource]: + """Create a PostRulesResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Post Rule priority. Required. + :type priority: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns PostRulesResource. The PostRulesResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + global_rulestack_name: str, + priority: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PostRulesResource]: + """Create a PostRulesResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Post Rule priority. Required. + :type priority: 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 PostRulesResource. The PostRulesResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + global_rulestack_name: str, + priority: str, + resource: Union[_models.PostRulesResource, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.PostRulesResource]: + """Create a PostRulesResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Post Rule priority. Required. + :type priority: str + :param resource: Resource create parameters. Is one of the following types: PostRulesResource, + JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource or JSON or IO[bytes] + :return: An instance of LROPoller that returns PostRulesResource. The PostRulesResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PostRulesResource] = 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( + global_rulestack_name=global_rulestack_name, + priority=priority, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PostRulesResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.PostRulesResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.PostRulesResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_post_rules_delete_request( + global_rulestack_name=global_rulestack_name, + priority=priority, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> LROPoller[None]: + """Delete a PostRulesResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Post Rule priority. Required. + :type priority: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + global_rulestack_name=global_rulestack_name, + priority=priority, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list(self, 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 + :return: An iterator like instance of PostRulesResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PostRulesResource]] = 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_post_rules_list_request( + global_rulestack_name=global_rulestack_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PostRulesResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_counters( + self, global_rulestack_name: str, priority: str, *, firewall_name: Optional[str] = None, **kwargs: Any + ) -> _models.RuleCounter: + """Get counters. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Post Rule priority. Required. + :type priority: str + :keyword firewall_name: Default value is None. + :paramtype firewall_name: str + :return: RuleCounter. The RuleCounter is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounter + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RuleCounter] = kwargs.pop("cls", None) + + _request = build_post_rules_get_counters_request( + global_rulestack_name=global_rulestack_name, + priority=priority, + firewall_name=firewall_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RuleCounter, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def refresh_counters( # pylint: disable=inconsistent-return-statements + self, global_rulestack_name: str, priority: str, *, firewall_name: Optional[str] = None, **kwargs: Any + ) -> None: + """Refresh counters. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Post Rule priority. Required. + :type priority: str + :keyword firewall_name: Default value is None. + :paramtype firewall_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_post_rules_refresh_counters_request( + global_rulestack_name=global_rulestack_name, + priority=priority, + firewall_name=firewall_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def reset_counters( + self, global_rulestack_name: str, priority: str, *, firewall_name: Optional[str] = None, **kwargs: Any + ) -> _models.RuleCounterReset: + """Reset counters. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Post Rule priority. Required. + :type priority: str + :keyword firewall_name: Default value is None. + :paramtype firewall_name: str + :return: RuleCounterReset. The RuleCounterReset is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounterReset + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RuleCounterReset] = kwargs.pop("cls", None) + + _request = build_post_rules_reset_counters_request( + global_rulestack_name=global_rulestack_name, + priority=priority, + firewall_name=firewall_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RuleCounterReset, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class PrefixListGlobalRulestackOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient`'s + :attr:`prefix_list_global_rulestack` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: 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 get(self, global_rulestack_name: str, name: str, **kwargs: Any) -> _models.PrefixListGlobalRulestackResource: + """Get a PrefixListGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: Local Rule priority. Required. + :type name: str + :return: PrefixListGlobalRulestackResource. The PrefixListGlobalRulestackResource is compatible + with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrefixListGlobalRulestackResource] = kwargs.pop("cls", None) + + _request = build_prefix_list_global_rulestack_get_request( + global_rulestack_name=global_rulestack_name, + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrefixListGlobalRulestackResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + global_rulestack_name: str, + name: str, + resource: Union[_models.PrefixListGlobalRulestackResource, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_prefix_list_global_rulestack_create_or_update_request( + global_rulestack_name=global_rulestack_name, + name=name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + global_rulestack_name: str, + name: str, + resource: _models.PrefixListGlobalRulestackResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrefixListGlobalRulestackResource]: + """Create a PrefixListGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: Local Rule priority. Required. + :type name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource + :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 PrefixListGlobalRulestackResource. The + PrefixListGlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + global_rulestack_name: str, + name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrefixListGlobalRulestackResource]: + """Create a PrefixListGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: Local Rule priority. Required. + :type name: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns PrefixListGlobalRulestackResource. The + PrefixListGlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + global_rulestack_name: str, + name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrefixListGlobalRulestackResource]: + """Create a PrefixListGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: Local Rule priority. Required. + :type 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 PrefixListGlobalRulestackResource. The + PrefixListGlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + global_rulestack_name: str, + name: str, + resource: Union[_models.PrefixListGlobalRulestackResource, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.PrefixListGlobalRulestackResource]: + """Create a PrefixListGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: Local Rule priority. Required. + :type name: str + :param resource: Resource create parameters. Is one of the following types: + PrefixListGlobalRulestackResource, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource or + JSON or IO[bytes] + :return: An instance of LROPoller that returns PrefixListGlobalRulestackResource. The + PrefixListGlobalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrefixListGlobalRulestackResource] = 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( + global_rulestack_name=global_rulestack_name, + name=name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PrefixListGlobalRulestackResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.PrefixListGlobalRulestackResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.PrefixListGlobalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, global_rulestack_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_prefix_list_global_rulestack_delete_request( + global_rulestack_name=global_rulestack_name, + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> LROPoller[None]: + """Delete a PrefixListGlobalRulestackResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param name: Local Rule priority. Required. + :type name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + global_rulestack_name=global_rulestack_name, + name=name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list(self, 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 + :return: An iterator like instance of PrefixListGlobalRulestackResource + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrefixListGlobalRulestackResource]] = 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_prefix_list_global_rulestack_list_request( + global_rulestack_name=global_rulestack_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PrefixListGlobalRulestackResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class PreRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient`'s + :attr:`pre_rules` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: 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 get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> _models.PreRulesResource: + """Get a PreRulesResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Pre Rule priority. Required. + :type priority: str + :return: PreRulesResource. The PreRulesResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PreRulesResource] = kwargs.pop("cls", None) + + _request = build_pre_rules_get_request( + global_rulestack_name=global_rulestack_name, + priority=priority, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PreRulesResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + global_rulestack_name: str, + priority: str, + resource: Union[_models.PreRulesResource, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_pre_rules_create_or_update_request( + global_rulestack_name=global_rulestack_name, + priority=priority, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + global_rulestack_name: str, + priority: str, + resource: _models.PreRulesResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PreRulesResource]: + """Create a PreRulesResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Pre Rule priority. Required. + :type priority: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource + :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 PreRulesResource. The PreRulesResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + global_rulestack_name: str, + priority: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PreRulesResource]: + """Create a PreRulesResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Pre Rule priority. Required. + :type priority: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns PreRulesResource. The PreRulesResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + global_rulestack_name: str, + priority: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PreRulesResource]: + """Create a PreRulesResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Pre Rule priority. Required. + :type priority: 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 PreRulesResource. The PreRulesResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + global_rulestack_name: str, + priority: str, + resource: Union[_models.PreRulesResource, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.PreRulesResource]: + """Create a PreRulesResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Pre Rule priority. Required. + :type priority: str + :param resource: Resource create parameters. Is one of the following types: PreRulesResource, + JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource or JSON or IO[bytes] + :return: An instance of LROPoller that returns PreRulesResource. The PreRulesResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PreRulesResource] = 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( + global_rulestack_name=global_rulestack_name, + priority=priority, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PreRulesResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.PreRulesResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.PreRulesResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_pre_rules_delete_request( + global_rulestack_name=global_rulestack_name, + priority=priority, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> LROPoller[None]: + """Delete a PreRulesResource. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Pre Rule priority. Required. + :type priority: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + global_rulestack_name=global_rulestack_name, + priority=priority, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list(self, 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 + :return: An iterator like instance of PreRulesResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PreRulesResource]] = 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_pre_rules_list_request( + global_rulestack_name=global_rulestack_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PreRulesResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_counters( + self, global_rulestack_name: str, priority: str, *, firewall_name: Optional[str] = None, **kwargs: Any + ) -> _models.RuleCounter: + """Get counters. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Pre Rule priority. Required. + :type priority: str + :keyword firewall_name: Default value is None. + :paramtype firewall_name: str + :return: RuleCounter. The RuleCounter is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounter + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RuleCounter] = kwargs.pop("cls", None) + + _request = build_pre_rules_get_counters_request( + global_rulestack_name=global_rulestack_name, + priority=priority, + firewall_name=firewall_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RuleCounter, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def refresh_counters( # pylint: disable=inconsistent-return-statements + self, global_rulestack_name: str, priority: str, *, firewall_name: Optional[str] = None, **kwargs: Any + ) -> None: + """Refresh counters. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Pre Rule priority. Required. + :type priority: str + :keyword firewall_name: Default value is None. + :paramtype firewall_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_pre_rules_refresh_counters_request( + global_rulestack_name=global_rulestack_name, + priority=priority, + firewall_name=firewall_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def reset_counters( + self, global_rulestack_name: str, priority: str, *, firewall_name: Optional[str] = None, **kwargs: Any + ) -> _models.RuleCounterReset: + """Reset counters. + + :param global_rulestack_name: GlobalRulestack resource name. Required. + :type global_rulestack_name: str + :param priority: Pre Rule priority. Required. + :type priority: str + :keyword firewall_name: Default value is None. + :paramtype firewall_name: str + :return: RuleCounterReset. The RuleCounterReset is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounterReset + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RuleCounterReset] = kwargs.pop("cls", None) + + _request = build_pre_rules_reset_counters_request( + global_rulestack_name=global_rulestack_name, + priority=priority, + firewall_name=firewall_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RuleCounterReset, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class FirewallsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient`'s + :attr:`firewalls` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: 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 get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _models.FirewallResource: + """Get a FirewallResource. + + :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: FirewallResource. The FirewallResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.FirewallResource] = kwargs.pop("cls", None) + + _request = build_firewalls_get_request( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.FirewallResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + firewall_name: str, + resource: Union[_models.FirewallResource, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_firewalls_create_or_update_request( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if 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.FirewallResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FirewallResource]: + """Create a FirewallResource. + + :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.FirewallResource + :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 FirewallResource. The FirewallResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + firewall_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FirewallResource]: + """Create a FirewallResource. + + :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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns FirewallResource. The FirewallResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] + :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.FirewallResource]: + """Create a FirewallResource. + + :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 FirewallResource. The FirewallResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + firewall_name: str, + resource: Union[_models.FirewallResource, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.FirewallResource]: + """Create a FirewallResource. + + :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 one of the following types: FirewallResource, + JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource or JSON or IO[bytes] + :return: An instance of LROPoller that returns FirewallResource. The FirewallResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FirewallResource] = 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.FirewallResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.FirewallResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.FirewallResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def update( + self, + resource_group_name: str, + firewall_name: str, + properties: _models.FirewallResourceUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FirewallResource: + """Update a FirewallResource. + + :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 properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResourceUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: FirewallResource. The FirewallResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + firewall_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FirewallResource: + """Update a FirewallResource. + + :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 properties: The resource properties to be updated. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: FirewallResource. The FirewallResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + firewall_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FirewallResource: + """Update a FirewallResource. + + :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 properties: The resource properties to be updated. Required. + :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 + :return: FirewallResource. The FirewallResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + firewall_name: str, + properties: Union[_models.FirewallResourceUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.FirewallResource: + """Update a FirewallResource. + + :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 properties: The resource properties to be updated. Is one of the following types: + FirewallResourceUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResourceUpdate or JSON or + IO[bytes] + :return: FirewallResource. The FirewallResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FirewallResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_firewalls_update_request( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.FirewallResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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 = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_firewalls_delete_request( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if 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 FirewallResource. + + :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 None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.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 + :return: An iterator like instance of FirewallResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.FirewallResource]] = 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_firewalls_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.FirewallResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.FirewallResource"]: + """List FirewallResource resources by subscription ID. + + :return: An iterator like instance of FirewallResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.FirewallResource]] = 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_firewalls_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.FirewallResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_global_rulestack( + self, resource_group_name: str, firewall_name: str, **kwargs: Any + ) -> _models.GlobalRulestackInfo: + """Get Global Rulestack associated with the Firewall. + + :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: GlobalRulestackInfo. The GlobalRulestackInfo is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackInfo + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GlobalRulestackInfo] = kwargs.pop("cls", None) + + _request = build_firewalls_get_global_rulestack_request( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.GlobalRulestackInfo, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_log_profile(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _models.LogSettings: + """Log Profile for Firewall. + + :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: LogSettings. The LogSettings is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LogSettings + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.LogSettings] = kwargs.pop("cls", None) + + _request = build_firewalls_get_log_profile_request( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.LogSettings, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_support_info( + self, resource_group_name: str, firewall_name: str, *, email: Optional[str] = None, **kwargs: Any + ) -> _models.SupportInfo: + """support info for firewall. + + :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 + :keyword email: email address on behalf of which this API called. Default value is None. + :paramtype email: str + :return: SupportInfo. The SupportInfo is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SupportInfo + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SupportInfo] = kwargs.pop("cls", None) + + _request = build_firewalls_get_support_info_request( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + subscription_id=self._config.subscription_id, + email=email, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SupportInfo, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def save_log_profile( + self, + resource_group_name: str, + firewall_name: str, + log_settings: Optional[_models.LogSettings] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Log Profile for Firewall. + + :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 log_settings: Default value is None. + :type log_settings: ~azure.mgmt.paloaltonetworksngfw.models.LogSettings + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def save_log_profile( + self, + resource_group_name: str, + firewall_name: str, + log_settings: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Log Profile for Firewall. + + :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 log_settings: Default value is None. + :type log_settings: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def save_log_profile( + self, + resource_group_name: str, + firewall_name: str, + log_settings: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Log Profile for Firewall. + + :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 log_settings: Default value is None. + :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 + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def save_log_profile( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + firewall_name: str, + log_settings: Optional[Union[_models.LogSettings, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> None: + """Log Profile for Firewall. + + :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 log_settings: Is one of the following types: LogSettings, JSON, IO[bytes] Default value + is None. + :type log_settings: ~azure.mgmt.paloaltonetworksngfw.models.LogSettings or JSON or IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if log_settings else None + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if log_settings else None + _content = None + if isinstance(log_settings, (IOBase, bytes)): + _content = log_settings + else: + if log_settings is not None: + _content = json.dumps(log_settings, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_firewalls_save_log_profile_request( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class LocalRulestacksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient`'s + :attr:`local_rulestacks` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: 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 get(self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any) -> _models.LocalRulestackResource: + """Get a LocalRulestackResource. + + :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 + :return: LocalRulestackResource. The LocalRulestackResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.LocalRulestackResource] = kwargs.pop("cls", None) + + _request = build_local_rulestacks_get_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.LocalRulestackResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + local_rulestack_name: str, + resource: Union[_models.LocalRulestackResource, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_local_rulestacks_create_or_update_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if 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, + local_rulestack_name: str, + resource: _models.LocalRulestackResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.LocalRulestackResource]: + """Create a LocalRulestackResource. + + :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 resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource + :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 LocalRulestackResource. The + LocalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + local_rulestack_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.LocalRulestackResource]: + """Create a LocalRulestackResource. + + :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 resource: Resource create parameters. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns LocalRulestackResource. The + LocalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + local_rulestack_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.LocalRulestackResource]: + """Create a LocalRulestackResource. + + :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 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 LocalRulestackResource. The + LocalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + local_rulestack_name: str, + resource: Union[_models.LocalRulestackResource, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.LocalRulestackResource]: + """Create a LocalRulestackResource. + + :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 resource: Resource create parameters. Is one of the following types: + LocalRulestackResource, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource or JSON or + IO[bytes] + :return: An instance of LROPoller that returns LocalRulestackResource. The + LocalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LocalRulestackResource] = 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, + local_rulestack_name=local_rulestack_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.LocalRulestackResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.LocalRulestackResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.LocalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def update( + self, + resource_group_name: str, + local_rulestack_name: str, + properties: _models.LocalRulestackResourceUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LocalRulestackResource: + """Update a LocalRulestackResource. + + :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 properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResourceUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: LocalRulestackResource. The LocalRulestackResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + local_rulestack_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LocalRulestackResource: + """Update a LocalRulestackResource. + + :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 properties: The resource properties to be updated. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: LocalRulestackResource. The LocalRulestackResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + local_rulestack_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LocalRulestackResource: + """Update a LocalRulestackResource. + + :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 properties: The resource properties to be updated. Required. + :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 + :return: LocalRulestackResource. The LocalRulestackResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + local_rulestack_name: str, + properties: Union[_models.LocalRulestackResourceUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.LocalRulestackResource: + """Update a LocalRulestackResource. + + :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 properties: The resource properties to be updated. Is one of the following types: + LocalRulestackResourceUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResourceUpdate or JSON + or IO[bytes] + :return: LocalRulestackResource. The LocalRulestackResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LocalRulestackResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_local_rulestacks_update_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.LocalRulestackResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + 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, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_local_rulestacks_delete_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any) -> LROPoller[None]: + """Delete a LocalRulestackResource. + + :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 + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> ItemPaged["_models.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 + :return: An iterator like instance of LocalRulestackResource + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.LocalRulestackResource]] = 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_local_rulestacks_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.LocalRulestackResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.LocalRulestackResource"]: + """List LocalRulestackResource resources by subscription ID. + + :return: An iterator like instance of LocalRulestackResource + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.LocalRulestackResource]] = 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_local_rulestacks_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.LocalRulestackResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + 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, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_local_rulestacks_commit_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_commit(self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any) -> LROPoller[None]: + """Commit rulestack configuration. + + :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 + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._commit_initial( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get_change_log(self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any) -> _models.Changelog: + """Get changelog. + + :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 + :return: Changelog. The Changelog is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.Changelog + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Changelog] = kwargs.pop("cls", None) + + _request = build_local_rulestacks_get_change_log_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Changelog, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_support_info( + self, resource_group_name: str, local_rulestack_name: str, *, email: Optional[str] = None, **kwargs: Any + ) -> _models.SupportInfo: + """support info 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 + :keyword email: email address on behalf of which this API called. Default value is None. + :paramtype email: str + :return: SupportInfo. The SupportInfo is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SupportInfo + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SupportInfo] = kwargs.pop("cls", None) + + _request = build_local_rulestacks_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SupportInfo, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_advanced_security_objects( + self, + resource_group_name: str, + local_rulestack_name: str, + *, + type: Union[str, _models.AdvSecurityObjectTypeEnum], + skip: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> _models.AdvSecurityObjectListResponse: + """Get the list of advanced security objects. + + :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 + :keyword type: Known values are: "urlCustom" and "feeds". Required. + :paramtype type: str or ~azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectTypeEnum + :keyword skip: Default value is None. + :paramtype skip: str + :keyword top: Default value is None. + :paramtype top: int + :return: AdvSecurityObjectListResponse. The AdvSecurityObjectListResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectListResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AdvSecurityObjectListResponse] = kwargs.pop("cls", None) + + _request = build_local_rulestacks_list_advanced_security_objects_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + subscription_id=self._config.subscription_id, + type=type, + skip=skip, + top=top, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AdvSecurityObjectListResponse, response.json()) + + if cls: + 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 + ) -> 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 + :keyword app_id_version: Default value is None. + :paramtype app_id_version: str + :keyword app_prefix: Default value is None. + :paramtype app_prefix: str + :keyword skip: Default value is None. + :paramtype skip: str + :keyword top: Default value is None. + :paramtype top: int + :return: An iterator like instance of str + :rtype: ~azure.core.paging.ItemPaged[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[str]] = 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_local_rulestacks_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[str], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_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 + :keyword skip: Default value is None. + :paramtype skip: str + :keyword top: Default value is None. + :paramtype top: int + :return: An iterator like instance of Country + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.Country] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Country]] = 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_local_rulestacks_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Country], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_firewalls( + self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any + ) -> _models.ListFirewallsResponse: + """List of Firewalls associated with 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 + :return: ListFirewallsResponse. The ListFirewallsResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.ListFirewallsResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ListFirewallsResponse] = kwargs.pop("cls", None) + + _request = build_local_rulestacks_list_firewalls_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ListFirewallsResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @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 + :keyword skip: Default value is None. + :paramtype skip: str + :keyword top: Default value is None. + :paramtype top: int + :return: An iterator like instance of PredefinedUrlCategory + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.PredefinedUrlCategory] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PredefinedUrlCategory]] = 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_local_rulestacks_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PredefinedUrlCategory], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_security_services( + self, + resource_group_name: str, + local_rulestack_name: str, + *, + type: Union[str, _models.SecurityServicesTypeEnum], + skip: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> _models.SecurityServicesResponse: + """List the security services 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 + :keyword type: Known values are: "antiSpyware", "antiVirus", "ipsVulnerability", + "urlFiltering", "fileBlocking", and "dnsSubscription". Required. + :paramtype type: str or ~azure.mgmt.paloaltonetworksngfw.models.SecurityServicesTypeEnum + :keyword skip: Default value is None. + :paramtype skip: str + :keyword top: Default value is None. + :paramtype top: int + :return: SecurityServicesResponse. The SecurityServicesResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SecurityServicesResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SecurityServicesResponse] = kwargs.pop("cls", None) + + _request = build_local_rulestacks_list_security_services_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + subscription_id=self._config.subscription_id, + type=type, + skip=skip, + top=top, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SecurityServicesResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def revert( # pylint: disable=inconsistent-return-statements + 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. + Required. + :type resource_group_name: str + :param local_rulestack_name: LocalRulestack resource name. Required. + :type local_rulestack_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_local_rulestacks_revert_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +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. + """ + + 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 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. The MetricsObjectFirewallResource is compatible with + MutableMapping + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.MetricsObjectFirewallResource] = kwargs.pop("cls", None) + + _request = build_metrics_object_firewall_get_request( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.MetricsObjectFirewallResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + firewall_name: str, + resource: Union[_models.MetricsObjectFirewallResource, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_metrics_object_firewall_create_or_update_request( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if 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 MetricsObjectFirewallResource. The + MetricsObjectFirewallResource is compatible with MutableMapping + :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: JSON, + *, + 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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns MetricsObjectFirewallResource. The + MetricsObjectFirewallResource is compatible with MutableMapping + :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 MetricsObjectFirewallResource. The + MetricsObjectFirewallResource is compatible with MutableMapping + :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, JSON, 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 one of the following types: + MetricsObjectFirewallResource, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.MetricsObjectFirewallResource or JSON + or IO[bytes] + :return: An instance of LROPoller that returns MetricsObjectFirewallResource. The + MetricsObjectFirewallResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.MetricsObjectFirewallResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.MetricsObjectFirewallResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.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 = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_metrics_object_firewall_delete_request( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if 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 None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_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 MetricsObjectFirewallResource + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.MetricsObjectFirewallResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.MetricsObjectFirewallResource]] = 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_metrics_object_firewall_list_by_firewalls_request( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.MetricsObjectFirewallResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class FirewallStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient`'s + :attr:`firewall_status` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: 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 get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _models.FirewallStatusResource: + """Get a FirewallStatusResource. + + :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: FirewallStatusResource. The FirewallStatusResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallStatusResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.FirewallStatusResource] = kwargs.pop("cls", None) + + _request = build_firewall_status_get_request( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.FirewallStatusResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_firewalls( + self, resource_group_name: str, firewall_name: str, **kwargs: Any + ) -> ItemPaged["_models.FirewallStatusResource"]: + """List FirewallStatusResource 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 FirewallStatusResource + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.FirewallStatusResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.FirewallStatusResource]] = 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_firewall_status_list_by_firewalls_request( + resource_group_name=resource_group_name, + firewall_name=firewall_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.FirewallStatusResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class CertificateObjectLocalRulestackOperations: # 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:`certificate_object_local_rulestack` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: 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 get( + self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any + ) -> _models.CertificateObjectLocalRulestackResource: + """Get a CertificateObjectLocalRulestackResource. + + :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 name: certificate name. Required. + :type name: str + :return: CertificateObjectLocalRulestackResource. The CertificateObjectLocalRulestackResource + is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CertificateObjectLocalRulestackResource] = kwargs.pop("cls", None) + + _request = build_certificate_object_local_rulestack_get_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CertificateObjectLocalRulestackResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + local_rulestack_name: str, + name: str, + resource: Union[_models.CertificateObjectLocalRulestackResource, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_certificate_object_local_rulestack_create_or_update_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if 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, + local_rulestack_name: str, + name: str, + resource: _models.CertificateObjectLocalRulestackResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CertificateObjectLocalRulestackResource]: + """Create a CertificateObjectLocalRulestackResource. + + :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 name: certificate name. Required. + :type name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource + :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 CertificateObjectLocalRulestackResource. The + CertificateObjectLocalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + local_rulestack_name: str, + name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CertificateObjectLocalRulestackResource]: + """Create a CertificateObjectLocalRulestackResource. + + :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 name: certificate name. Required. + :type name: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns CertificateObjectLocalRulestackResource. The + CertificateObjectLocalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + local_rulestack_name: str, + name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CertificateObjectLocalRulestackResource]: + """Create a CertificateObjectLocalRulestackResource. + + :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 name: certificate name. Required. + :type 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 CertificateObjectLocalRulestackResource. The + CertificateObjectLocalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + local_rulestack_name: str, + name: str, + resource: Union[_models.CertificateObjectLocalRulestackResource, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.CertificateObjectLocalRulestackResource]: + """Create a CertificateObjectLocalRulestackResource. + + :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 name: certificate name. Required. + :type name: str + :param resource: Resource create parameters. Is one of the following types: + CertificateObjectLocalRulestackResource, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource + or JSON or IO[bytes] + :return: An instance of LROPoller that returns CertificateObjectLocalRulestackResource. The + CertificateObjectLocalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateObjectLocalRulestackResource] = 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, + local_rulestack_name=local_rulestack_name, + name=name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CertificateObjectLocalRulestackResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CertificateObjectLocalRulestackResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CertificateObjectLocalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_certificate_object_local_rulestack_delete_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a CertificateObjectLocalRulestackResource. + + :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 name: certificate name. Required. + :type name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + name=name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_local_rulestacks( + self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any + ) -> ItemPaged["_models.CertificateObjectLocalRulestackResource"]: + """List CertificateObjectLocalRulestackResource resources by LocalRulestacks. + + :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 + :return: An iterator like instance of CertificateObjectLocalRulestackResource + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CertificateObjectLocalRulestackResource]] = 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_certificate_object_local_rulestack_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.CertificateObjectLocalRulestackResource], deserialized.get("value", []) + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class FqdnListLocalRulestackOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient`'s + :attr:`fqdn_list_local_rulestack` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: 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 get( + self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any + ) -> _models.FqdnListLocalRulestackResource: + """Get a FqdnListLocalRulestackResource. + + :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 name: fqdn list name. Required. + :type name: str + :return: FqdnListLocalRulestackResource. The FqdnListLocalRulestackResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.FqdnListLocalRulestackResource] = kwargs.pop("cls", None) + + _request = build_fqdn_list_local_rulestack_get_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.FqdnListLocalRulestackResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + local_rulestack_name: str, + name: str, + resource: Union[_models.FqdnListLocalRulestackResource, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_fqdn_list_local_rulestack_create_or_update_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if 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, + local_rulestack_name: str, + name: str, + resource: _models.FqdnListLocalRulestackResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FqdnListLocalRulestackResource]: + """Create a FqdnListLocalRulestackResource. + + :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 name: fqdn list name. Required. + :type name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource + :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 FqdnListLocalRulestackResource. The + FqdnListLocalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + local_rulestack_name: str, + name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FqdnListLocalRulestackResource]: + """Create a FqdnListLocalRulestackResource. + + :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 name: fqdn list name. Required. + :type name: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns FqdnListLocalRulestackResource. The + FqdnListLocalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + local_rulestack_name: str, + name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FqdnListLocalRulestackResource]: + """Create a FqdnListLocalRulestackResource. + + :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 name: fqdn list name. Required. + :type 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 FqdnListLocalRulestackResource. The + FqdnListLocalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + local_rulestack_name: str, + name: str, + resource: Union[_models.FqdnListLocalRulestackResource, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.FqdnListLocalRulestackResource]: + """Create a FqdnListLocalRulestackResource. + + :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 name: fqdn list name. Required. + :type name: str + :param resource: Resource create parameters. Is one of the following types: + FqdnListLocalRulestackResource, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource or JSON + or IO[bytes] + :return: An instance of LROPoller that returns FqdnListLocalRulestackResource. The + FqdnListLocalRulestackResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FqdnListLocalRulestackResource] = 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, + local_rulestack_name=local_rulestack_name, + name=name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.FqdnListLocalRulestackResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.FqdnListLocalRulestackResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.FqdnListLocalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_fqdn_list_local_rulestack_delete_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a FqdnListLocalRulestackResource. + + :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 name: fqdn list name. Required. + :type name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + name=name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_local_rulestacks( + self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any + ) -> ItemPaged["_models.FqdnListLocalRulestackResource"]: + """List FqdnListLocalRulestackResource resources by LocalRulestacks. + + :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 + :return: An iterator like instance of FqdnListLocalRulestackResource + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.FqdnListLocalRulestackResource]] = 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_fqdn_list_local_rulestack_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.FqdnListLocalRulestackResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class LocalRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient`'s + :attr:`local_rules` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: 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 get( + self, resource_group_name: str, local_rulestack_name: str, priority: str, **kwargs: Any + ) -> _models.LocalRulesResource: + """Get a LocalRulesResource. + + :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 priority: Local Rule priority. Required. + :type priority: str + :return: LocalRulesResource. The LocalRulesResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.LocalRulesResource] = kwargs.pop("cls", None) + + _request = build_local_rules_get_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + priority=priority, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.LocalRulesResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + local_rulestack_name: str, + priority: str, + resource: Union[_models.LocalRulesResource, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_local_rules_create_or_update_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + priority=priority, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if 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, + local_rulestack_name: str, + priority: str, + resource: _models.LocalRulesResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.LocalRulesResource]: + """Create a LocalRulesResource. + + :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 priority: Local Rule priority. Required. + :type priority: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource + :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 LocalRulesResource. The LocalRulesResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + local_rulestack_name: str, + priority: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.LocalRulesResource]: + """Create a LocalRulesResource. + + :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 priority: Local Rule priority. Required. + :type priority: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns LocalRulesResource. The LocalRulesResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + local_rulestack_name: str, + priority: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.LocalRulesResource]: + """Create a LocalRulesResource. + + :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 priority: Local Rule priority. Required. + :type priority: 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 LocalRulesResource. The LocalRulesResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + local_rulestack_name: str, + priority: str, + resource: Union[_models.LocalRulesResource, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.LocalRulesResource]: + """Create a LocalRulesResource. + + :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 priority: Local Rule priority. Required. + :type priority: str + :param resource: Resource create parameters. Is one of the following types: LocalRulesResource, + JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource or JSON or IO[bytes] + :return: An instance of LROPoller that returns LocalRulesResource. The LocalRulesResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LocalRulesResource] = 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, + local_rulestack_name=local_rulestack_name, + priority=priority, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.LocalRulesResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.LocalRulesResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.LocalRulesResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, local_rulestack_name: str, priority: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_local_rules_delete_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + priority=priority, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, local_rulestack_name: str, priority: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a LocalRulesResource. + + :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 priority: Local Rule priority. Required. + :type priority: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + priority=priority, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_local_rulestacks( + self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any + ) -> ItemPaged["_models.LocalRulesResource"]: + """List LocalRulesResource resources by LocalRulestacks. + + :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 + :return: An iterator like instance of LocalRulesResource + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.LocalRulesResource]] = 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_local_rules_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.LocalRulesResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_counters( + self, + resource_group_name: str, + local_rulestack_name: str, + priority: str, + *, + firewall_name: Optional[str] = None, + **kwargs: Any + ) -> _models.RuleCounter: + """Get counters. + + :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 priority: Local Rule priority. Required. + :type priority: str + :keyword firewall_name: Default value is None. + :paramtype firewall_name: str + :return: RuleCounter. The RuleCounter is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounter + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RuleCounter] = kwargs.pop("cls", None) + + _request = build_local_rules_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RuleCounter, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def refresh_counters( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + local_rulestack_name: str, + priority: str, + *, + firewall_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """Refresh counters. + + :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 priority: Local Rule priority. Required. + :type priority: str + :keyword firewall_name: Default value is None. + :paramtype firewall_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_local_rules_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def reset_counters( + self, + resource_group_name: str, + local_rulestack_name: str, + priority: str, + *, + firewall_name: Optional[str] = None, + **kwargs: Any + ) -> _models.RuleCounterReset: + """Reset counters. + + :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 priority: Local Rule priority. Required. + :type priority: str + :keyword firewall_name: Default value is None. + :paramtype firewall_name: str + :return: RuleCounterReset. The RuleCounterReset is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounterReset + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RuleCounterReset] = kwargs.pop("cls", None) + + _request = build_local_rules_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RuleCounterReset, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class PrefixListLocalRulestackOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient`'s + :attr:`prefix_list_local_rulestack` attribute. """ - 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"]: - """List the operations for the provider. + def get( + self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any + ) -> _models.PrefixListResource: + """Get a PrefixListResource. - :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] + :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 name: Local Rule priority. Required. + :type name: str + :return: PrefixListResource. The PrefixListResource is compatible with MutableMapping + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrefixListResource] = kwargs.pop("cls", None) + + _request = build_prefix_list_local_rulestack_get_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrefixListResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + local_rulestack_name: str, + name: str, + resource: Union[_models.PrefixListResource, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_prefix_list_local_rulestack_create_or_update_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if 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, + local_rulestack_name: str, + name: str, + resource: _models.PrefixListResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrefixListResource]: + """Create a PrefixListResource. + + :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 name: Local Rule priority. Required. + :type name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource + :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 PrefixListResource. The PrefixListResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + local_rulestack_name: str, + name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrefixListResource]: + """Create a PrefixListResource. + + :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 name: Local Rule priority. Required. + :type name: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns PrefixListResource. The PrefixListResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + local_rulestack_name: str, + name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrefixListResource]: + """Create a PrefixListResource. + + :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 name: Local Rule priority. Required. + :type 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 PrefixListResource. The PrefixListResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + local_rulestack_name: str, + name: str, + resource: Union[_models.PrefixListResource, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.PrefixListResource]: + """Create a PrefixListResource. + + :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 name: Local Rule priority. Required. + :type name: str + :param resource: Resource create parameters. Is one of the following types: PrefixListResource, + JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource or JSON or IO[bytes] + :return: An instance of LROPoller that returns PrefixListResource. The PrefixListResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrefixListResource] = 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, + local_rulestack_name=local_rulestack_name, + name=name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PrefixListResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.PrefixListResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.PrefixListResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_prefix_list_local_rulestack_delete_request( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a PrefixListResource. + + :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 name: Local Rule priority. Required. + :type name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + local_rulestack_name=local_rulestack_name, + name=name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_local_rulestacks( + self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any + ) -> ItemPaged["_models.PrefixListResource"]: + """List PrefixListResource resources by LocalRulestacks. + + :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 + :return: An iterator like instance of PrefixListResource + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.PrefixListResource]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,14 +13240,20 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata["url"], + _request = build_prefix_list_local_rulestack_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=self._config.api_version, headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -119,37 +13265,314 @@ 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 + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PrefixListResource], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) + return deserialized.get("nextLink") or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _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 = _failsafe_deserialize( + _models.ErrorResponse, + 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"} + +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. + """ + + 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. The ProductSerialNumberRequestStatus is compatible + with MutableMapping + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ProductSerialNumberRequestStatus] = kwargs.pop("cls", None) + + _request = build_palo_alto_networks_cloudngfw_operations_create_product_serial_number_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ProductSerialNumberRequestStatus, response.json()) + + 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. The CloudManagerTenantList is compatible with MutableMapping + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CloudManagerTenantList] = kwargs.pop("cls", None) + + _request = build_palo_alto_networks_cloudngfw_operations_list_cloud_manager_tenants_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CloudManagerTenantList, response.json()) + + 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. The ProductSerialNumberStatus is compatible with + MutableMapping + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[Optional[_models.ProductSerialNumberStatus]] = kwargs.pop("cls", None) + + _request = build_palo_alto_networks_cloudngfw_operations_list_product_serial_number_status_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ProductSerialNumberStatus, response.json()) + + 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. The SupportInfoModel is compatible with MutableMapping + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SupportInfoModel] = kwargs.pop("cls", None) + + _request = build_palo_alto_networks_cloudngfw_operations_list_support_info_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SupportInfoModel, response.json()) + + 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 deleted file mode 100644 index 9fb02c01406a..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_post_rules_operations.py +++ /dev/null @@ -1,937 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import 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 azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(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")) - 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"), - } - - _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(global_rulestack_name: str, priority: 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")) - 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"), - } - - _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(global_rulestack_name: str, priority: 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")) - 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}/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"), - } - - _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(global_rulestack_name: str, priority: 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")) - 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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_counters_request( - global_rulestack_name: str, priority: str, *, firewall_name: Optional[str] = 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")) - 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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if firewall_name is not None: - _params["firewallName"] = _SERIALIZER.query("firewall_name", firewall_name, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_refresh_counters_request( - global_rulestack_name: str, priority: str, *, firewall_name: Optional[str] = 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")) - 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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if firewall_name is not None: - _params["firewallName"] = _SERIALIZER.query("firewall_name", firewall_name, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_reset_counters_request( - global_rulestack_name: str, priority: str, *, firewall_name: Optional[str] = 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")) - 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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if firewall_name is not None: - _params["firewallName"] = _SERIALIZER.query("firewall_name", firewall_name, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class PostRulesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient`'s - :attr:`post_rules` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, global_rulestack_name: str, **kwargs: Any) -> Iterable["_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: - """ - _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.PostRulesResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - 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) - - 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 = _convert_request(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) - 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) - - 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. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :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 = { - 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.PostRulesResource] = kwargs.pop("cls", None) - - 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) - - _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("PostRulesResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}" - } - - def _create_or_update_initial( - self, global_rulestack_name: str, priority: str, resource: Union[_models.PostRulesResource, IO], **kwargs: Any - ) -> _models.PostRulesResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PostRulesResource] = 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, "PostRulesResource") - - 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) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("PostRulesResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PostRulesResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # 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, - global_rulestack_name: str, - priority: str, - resource: _models.PostRulesResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PostRulesResource]: - """Create a PostRulesResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param priority: Post Rule priority. Required. - :type priority: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource - :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: - ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - global_rulestack_name: str, - priority: str, - resource: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PostRulesResource]: - """Create a PostRulesResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param priority: Post Rule priority. Required. - :type priority: str - :param resource: Resource create parameters. Required. - :type resource: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :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: - ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, global_rulestack_name: str, priority: str, resource: Union[_models.PostRulesResource, IO], **kwargs: Any - ) -> LROPoller[_models.PostRulesResource]: - """Create a PostRulesResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :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. - :return: An instance of LROPoller that returns either PostRulesResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource] - :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.PostRulesResource] = 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( - global_rulestack_name=global_rulestack_name, - priority=priority, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PostRulesResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, priority: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - 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) - - _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, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}" - } - - @distributed_trace - def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> LROPoller[None]: - """Delete a PostRulesResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :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: - """ - _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( # type: ignore - global_rulestack_name=global_rulestack_name, - priority=priority, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - 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.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}" - } - - @distributed_trace - def get_counters( - self, global_rulestack_name: str, priority: str, firewall_name: Optional[str] = None, **kwargs: Any - ) -> _models.RuleCounter: - """Get counters. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param priority: Post Rule priority. Required. - :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 = { - 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.RuleCounter] = kwargs.pop("cls", None) - - 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) - - _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("RuleCounter", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}/getCounters" - } - - @distributed_trace - def refresh_counters( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, priority: str, firewall_name: Optional[str] = None, **kwargs: Any - ) -> None: - """Refresh counters. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param priority: Post Rule priority. Required. - :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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_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) - - _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 [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - refresh_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}/refreshCounters" - } - - @distributed_trace - def reset_counters( - self, global_rulestack_name: str, priority: str, firewall_name: Optional[str] = None, **kwargs: Any - ) -> _models.RuleCounterReset: - """Reset counters. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param priority: Post Rule priority. Required. - :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 = { - 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.RuleCounterReset] = kwargs.pop("cls", None) - - 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) - - _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("RuleCounterReset", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - reset_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}/resetCounters" - } 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 deleted file mode 100644 index d272deda4bc9..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_pre_rules_operations.py +++ /dev/null @@ -1,934 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import 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 azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(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")) - 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"), - } - - _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(global_rulestack_name: str, priority: 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")) - 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"), - } - - _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(global_rulestack_name: str, priority: 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")) - 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}/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"), - } - - _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(global_rulestack_name: str, priority: 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")) - 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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_counters_request( - global_rulestack_name: str, priority: str, *, firewall_name: Optional[str] = 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")) - 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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if firewall_name is not None: - _params["firewallName"] = _SERIALIZER.query("firewall_name", firewall_name, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_refresh_counters_request( - global_rulestack_name: str, priority: str, *, firewall_name: Optional[str] = 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")) - 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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if firewall_name is not None: - _params["firewallName"] = _SERIALIZER.query("firewall_name", firewall_name, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_reset_counters_request( - global_rulestack_name: str, priority: str, *, firewall_name: Optional[str] = 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")) - 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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if firewall_name is not None: - _params["firewallName"] = _SERIALIZER.query("firewall_name", firewall_name, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class PreRulesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient`'s - :attr:`pre_rules` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, global_rulestack_name: str, **kwargs: Any) -> Iterable["_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: - """ - _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.PreRulesResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - 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) - - 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 = _convert_request(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) - 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) - - 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. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :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 = { - 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.PreRulesResource] = kwargs.pop("cls", None) - - 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) - - _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("PreRulesResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}" - } - - def _create_or_update_initial( - self, global_rulestack_name: str, priority: str, resource: Union[_models.PreRulesResource, IO], **kwargs: Any - ) -> _models.PreRulesResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PreRulesResource] = 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, "PreRulesResource") - - 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) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("PreRulesResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PreRulesResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # 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, - global_rulestack_name: str, - priority: str, - resource: _models.PreRulesResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PreRulesResource]: - """Create a PreRulesResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param priority: Pre Rule priority. Required. - :type priority: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource - :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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - global_rulestack_name: str, - priority: str, - resource: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PreRulesResource]: - """Create a PreRulesResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param priority: Pre Rule priority. Required. - :type priority: str - :param resource: Resource create parameters. Required. - :type resource: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, global_rulestack_name: str, priority: str, resource: Union[_models.PreRulesResource, IO], **kwargs: Any - ) -> LROPoller[_models.PreRulesResource]: - """Create a PreRulesResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :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. - :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] - :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.PreRulesResource] = 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( - global_rulestack_name=global_rulestack_name, - priority=priority, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PreRulesResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, priority: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - 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) - - _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, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}" - } - - @distributed_trace - def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> LROPoller[None]: - """Delete a PreRulesResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :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: - """ - _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( # type: ignore - global_rulestack_name=global_rulestack_name, - priority=priority, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - 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.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}" - } - - @distributed_trace - def get_counters( - self, global_rulestack_name: str, priority: str, firewall_name: Optional[str] = None, **kwargs: Any - ) -> _models.RuleCounter: - """Get counters. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param priority: Pre Rule priority. Required. - :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 = { - 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.RuleCounter] = kwargs.pop("cls", None) - - 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) - - _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("RuleCounter", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}/getCounters" - } - - @distributed_trace - def refresh_counters( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, priority: str, firewall_name: Optional[str] = None, **kwargs: Any - ) -> None: - """Refresh counters. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param priority: Pre Rule priority. Required. - :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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_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) - - _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 [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - refresh_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}/refreshCounters" - } - - @distributed_trace - def reset_counters( - self, global_rulestack_name: str, priority: str, firewall_name: Optional[str] = None, **kwargs: Any - ) -> _models.RuleCounterReset: - """Reset counters. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param priority: Pre Rule priority. Required. - :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 = { - 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.RuleCounterReset] = kwargs.pop("cls", None) - - 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) - - _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("RuleCounterReset", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - reset_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}/resetCounters" - } 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 deleted file mode 100644 index 983965edf4db..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_prefix_list_global_rulestack_operations.py +++ /dev/null @@ -1,657 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import 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 azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(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")) - 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"), - } - - _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(global_rulestack_name: str, 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")) - 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"), - } - - _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(global_rulestack_name: str, 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")) - 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}/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"), - } - - _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(global_rulestack_name: str, 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")) - 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"), - } - - _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 PrefixListGlobalRulestackOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient`'s - :attr:`prefix_list_global_rulestack` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, global_rulestack_name: str, **kwargs: Any) -> Iterable["_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: - ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource] - :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.PrefixListGlobalRulestackResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - 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) - - 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 = _convert_request(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) - 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) - - 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. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :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 = { - 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.PrefixListGlobalRulestackResource] = kwargs.pop("cls", None) - - 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) - - _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("PrefixListGlobalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}" - } - - def _create_or_update_initial( - self, - global_rulestack_name: str, - name: str, - resource: Union[_models.PrefixListGlobalRulestackResource, IO], - **kwargs: Any - ) -> _models.PrefixListGlobalRulestackResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrefixListGlobalRulestackResource] = 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, "PrefixListGlobalRulestackResource") - - 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) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("PrefixListGlobalRulestackResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PrefixListGlobalRulestackResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # 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, - global_rulestack_name: str, - name: str, - resource: _models.PrefixListGlobalRulestackResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PrefixListGlobalRulestackResource]: - """Create a PrefixListGlobalRulestackResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param name: Local Rule priority. Required. - :type name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource - :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: - ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - global_rulestack_name: str, - name: str, - resource: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PrefixListGlobalRulestackResource]: - """Create a PrefixListGlobalRulestackResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :param name: Local Rule priority. Required. - :type name: str - :param resource: Resource create parameters. Required. - :type resource: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :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: - ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - global_rulestack_name: str, - name: str, - resource: Union[_models.PrefixListGlobalRulestackResource, IO], - **kwargs: Any - ) -> LROPoller[_models.PrefixListGlobalRulestackResource]: - """Create a PrefixListGlobalRulestackResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :type global_rulestack_name: str - :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. - :return: An instance of LROPoller that returns either PrefixListGlobalRulestackResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource] - :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.PrefixListGlobalRulestackResource] = 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( - global_rulestack_name=global_rulestack_name, - name=name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrefixListGlobalRulestackResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - 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) - - _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, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}" - } - - @distributed_trace - def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> LROPoller[None]: - """Delete a PrefixListGlobalRulestackResource. - - :param global_rulestack_name: GlobalRulestack resource name. Required. - :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: - """ - _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( # type: ignore - global_rulestack_name=global_rulestack_name, - name=name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - 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.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}" - } 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 deleted file mode 100644 index 06fdd5142ac4..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_prefix_list_local_rulestack_operations.py +++ /dev/null @@ -1,721 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import 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 azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_local_rulestacks_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")) - 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( - "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") - - # 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, local_rulestack_name: str, 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")) - 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( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), - "name": _SERIALIZER.url("name", name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, local_rulestack_name: str, 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")) - 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/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( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), - "name": _SERIALIZER.url("name", name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, local_rulestack_name: str, 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")) - 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( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "localRulestackName": _SERIALIZER.url("local_rulestack_name", local_rulestack_name, "str"), - "name": _SERIALIZER.url("name", name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class PrefixListLocalRulestackOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient`'s - :attr:`prefix_list_local_rulestack` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_local_rulestacks( - self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> Iterable["_models.PrefixListResource"]: - """List PrefixListResource resources by LocalRulestacks. - - :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 - :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] - :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.PrefixListResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 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_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) - - 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 = _convert_request(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) - 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) - - 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 - ) -> _models.PrefixListResource: - """Get a PrefixListResource. - - :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 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 = { - 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.PrefixListResource] = kwargs.pop("cls", None) - - 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) - - _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("PrefixListResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}" - } - - def _create_or_update_initial( - self, - resource_group_name: str, - local_rulestack_name: str, - name: str, - resource: Union[_models.PrefixListResource, IO], - **kwargs: Any - ) -> _models.PrefixListResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrefixListResource] = 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, "PrefixListResource") - - request = build_create_or_update_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, - 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) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("PrefixListResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PrefixListResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # 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, - resource_group_name: str, - local_rulestack_name: str, - name: str, - resource: _models.PrefixListResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PrefixListResource]: - """Create a PrefixListResource. - - :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 name: Local Rule priority. Required. - :type name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource - :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: - ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - local_rulestack_name: str, - name: str, - resource: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PrefixListResource]: - """Create a PrefixListResource. - - :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 name: Local Rule priority. Required. - :type name: str - :param resource: Resource create parameters. Required. - :type resource: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :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: - ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - local_rulestack_name: str, - name: str, - resource: Union[_models.PrefixListResource, IO], - **kwargs: Any - ) -> LROPoller[_models.PrefixListResource]: - """Create a PrefixListResource. - - :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 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. - :return: An instance of LROPoller that returns either PrefixListResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource] - :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.PrefixListResource] = 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, - local_rulestack_name=local_rulestack_name, - name=name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrefixListResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - 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) - - _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, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}" - } - - @distributed_trace - def begin_delete( - self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a PrefixListResource. - - :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 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: - """ - _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( # type: ignore - resource_group_name=resource_group_name, - local_rulestack_name=local_rulestack_name, - name=name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - 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.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}" - } 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..91fb42cfdd67 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -46,6 +47,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: 2025-10-08/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..4e0ba9a218f8 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,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: 2025-10-08/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..2424ee01a0f3 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,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: 2025-10-08/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..11848a96b5e1 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,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: 2025-10-08/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..b342de8c38f7 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..aee79bbe6457 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..802679fded4f 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..ba0dea673cdf 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..55bf6a70676d 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.certificate_object_local_rulestack.begin_create_or_update( @@ -47,6 +48,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: 2025-10-08/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..73a2c924b7ab 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.certificate_object_local_rulestack.begin_create_or_update( @@ -38,6 +39,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: 2025-10-08/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..f52fc3c2ee5c 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) client.certificate_object_local_rulestack.begin_delete( @@ -36,6 +37,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: 2025-10-08/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..34c70e823d17 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) client.certificate_object_local_rulestack.begin_delete( @@ -36,6 +37,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: 2025-10-08/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..d0b821d3b4d9 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.certificate_object_local_rulestack.get( @@ -37,6 +38,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: 2025-10-08/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..f52018f7af39 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.certificate_object_local_rulestack.get( @@ -37,6 +38,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: 2025-10-08/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..e78146b4b842 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.certificate_object_local_rulestack.list_by_local_rulestacks( @@ -37,6 +38,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: 2025-10-08/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..e562e488a9ed 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.certificate_object_local_rulestack.list_by_local_rulestacks( @@ -37,6 +38,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: 2025-10-08/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..5c28234c29d2 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.firewall_status.get( @@ -36,6 +37,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: 2025-10-08/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..c225e51f8895 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.firewall_status.get( @@ -36,6 +37,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: 2025-10-08/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..a263d2acff1b 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.firewall_status.list_by_firewalls( @@ -37,6 +38,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: 2025-10-08/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..410322391666 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.firewall_status.list_by_firewalls( @@ -37,6 +38,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: 2025-10-08/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..be33969fd59e 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,12 +1,14 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +28,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.firewalls.begin_create_or_update( @@ -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: 2025-10-08/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..d7279fbd3a6a 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,12 +1,14 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +28,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.firewalls.begin_create_or_update( @@ -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: 2025-10-08/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..86d22fa21a6b 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) client.firewalls.begin_delete( @@ -35,6 +36,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: 2025-10-08/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..ea8e2abb7e59 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) client.firewalls.begin_delete( @@ -35,6 +36,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: 2025-10-08/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..426f656f1ddf 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.firewalls.get_global_rulestack( @@ -36,6 +37,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: 2025-10-08/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..76b6a43e36b3 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.firewalls.get_global_rulestack( @@ -36,6 +37,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: 2025-10-08/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..c821e495667a 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.firewalls.get_log_profile( @@ -36,6 +37,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: 2025-10-08/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..ecd602b089e6 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.firewalls.get_log_profile( @@ -36,6 +37,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: 2025-10-08/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..ce72c72b8132 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.firewalls.get( @@ -36,6 +37,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: 2025-10-08/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..88b03297e75a 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.firewalls.get( @@ -36,6 +37,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: 2025-10-08/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..aa582bd8858a 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.firewalls.get_support_info( @@ -36,6 +37,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: 2025-10-08/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..886efcbfea3f 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.firewalls.get_support_info( @@ -36,6 +37,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: 2025-10-08/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..044afd8ee660 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.firewalls.list_by_resource_group( @@ -36,6 +37,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: 2025-10-08/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..fd435bde92d7 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.firewalls.list_by_resource_group( @@ -36,6 +37,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: 2025-10-08/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..58f566d5c44c 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.firewalls.list_by_subscription() @@ -34,6 +35,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: 2025-10-08/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..0b6bb2101ca7 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.firewalls.list_by_subscription() @@ -34,6 +35,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: 2025-10-08/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..867ca2b04f64 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) client.firewalls.save_log_profile( @@ -35,6 +36,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: 2025-10-08/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..7e5d01a64533 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) client.firewalls.save_log_profile( @@ -35,6 +36,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: 2025-10-08/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..60f243dd5507 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,12 +1,14 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +28,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.firewalls.update( @@ -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: 2025-10-08/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..ade15621f909 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -45,6 +46,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: 2025-10-08/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..2ab59fb665f8 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,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: 2025-10-08/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..2e5d2bb91215 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,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: 2025-10-08/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..d14231d0276f 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,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: 2025-10-08/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..1c3defdd3345 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..b5798fc794fd 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..468cf884986b 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..34c8ad50eeb2 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..9675d8f2f0c6 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.fqdn_list_local_rulestack.begin_create_or_update( @@ -46,6 +47,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: 2025-10-08/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..ea5ac924c7e1 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.fqdn_list_local_rulestack.begin_create_or_update( @@ -38,6 +39,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: 2025-10-08/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..aeb103ab8c36 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) client.fqdn_list_local_rulestack.begin_delete( @@ -36,6 +37,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: 2025-10-08/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..157069c36ff0 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) client.fqdn_list_local_rulestack.begin_delete( @@ -36,6 +37,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: 2025-10-08/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..9f2b1a0bfb9e 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.fqdn_list_local_rulestack.get( @@ -37,6 +38,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: 2025-10-08/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..fe02055a2e9b 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.fqdn_list_local_rulestack.get( @@ -37,6 +38,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: 2025-10-08/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..1c1c03050384 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.fqdn_list_local_rulestack.list_by_local_rulestacks( @@ -37,6 +38,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: 2025-10-08/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..56bf127c7361 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.fqdn_list_local_rulestack.list_by_local_rulestacks( @@ -37,6 +38,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: 2025-10-08/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..7217badd4504 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +35,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: 2025-10-08/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..b944f708db57 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +35,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: 2025-10-08/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..238d74652612 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -62,6 +63,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: 2025-10-08/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..98a01729bf6a 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..e2a10d3544d6 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +35,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: 2025-10-08/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..57d1efb43bbe 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +35,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: 2025-10-08/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..543b4890c04c 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,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: 2025-10-08/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..a966298f7fc2 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,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: 2025-10-08/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..d22d672d1638 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,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: 2025-10-08/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..5d68e30cc2f5 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,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: 2025-10-08/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..d0622913c919 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..1cb4a33949c0 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..9be0fdbd8a7a 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,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: 2025-10-08/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..ebdbda5f6d7b 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,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: 2025-10-08/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..fa6c9a247e14 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,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: 2025-10-08/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..f5be3dd4047f 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,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: 2025-10-08/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..c59922d5c0ea 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,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: 2025-10-08/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..0db6bcdbb473 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,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: 2025-10-08/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..87d0dac4477b 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +35,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: 2025-10-08/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..d386f0812602 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +35,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: 2025-10-08/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..2498dee77685 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,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: 2025-10-08/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..6555501af15f 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,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: 2025-10-08/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..30117fde9cc6 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..58346159bbd1 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..dbb9c932d5d8 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +35,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: 2025-10-08/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..3de4f298ab6c 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +35,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: 2025-10-08/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..b01261d8ca34 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -61,6 +62,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: 2025-10-08/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..699d2d7c4338 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.local_rules.begin_create_or_update( @@ -66,6 +67,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: 2025-10-08/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..0f41299faa3a 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.local_rules.begin_create_or_update( @@ -38,6 +39,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: 2025-10-08/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..f7fe36cd5787 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) client.local_rules.begin_delete( @@ -36,6 +37,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: 2025-10-08/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..7f7ec4de23eb 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) client.local_rules.begin_delete( @@ -36,6 +37,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: 2025-10-08/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..3ed2d0a6795c 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.local_rules.get_counters( @@ -37,6 +38,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: 2025-10-08/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..82b5d69524d9 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.local_rules.get_counters( @@ -37,6 +38,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: 2025-10-08/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..d623f7aa3b41 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.local_rules.get( @@ -37,6 +38,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: 2025-10-08/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..e97ef318bae6 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.local_rules.get( @@ -37,6 +38,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: 2025-10-08/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..620d3f928fa5 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.local_rules.list_by_local_rulestacks( @@ -37,6 +38,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: 2025-10-08/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..e053aae701e6 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.local_rules.list_by_local_rulestacks( @@ -37,6 +38,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: 2025-10-08/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..7d5c1d32ae6e 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) client.local_rules.refresh_counters( @@ -36,6 +37,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: 2025-10-08/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..2a5f6e6ee608 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) client.local_rules.refresh_counters( @@ -36,6 +37,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: 2025-10-08/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..64f5e8baeb32 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.local_rules.reset_counters( @@ -37,6 +38,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: 2025-10-08/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..ad2a8ec41785 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.local_rules.reset_counters( @@ -37,6 +38,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: 2025-10-08/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..e3936decd7b4 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) client.local_rulestacks.begin_commit( @@ -35,6 +36,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: 2025-10-08/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..262ac4455d2b 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) client.local_rulestacks.begin_commit( @@ -35,6 +36,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: 2025-10-08/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..3dfac83722ba 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.local_rulestacks.begin_create_or_update( @@ -64,6 +65,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: 2025-10-08/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..efd6d77af12d 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.local_rulestacks.begin_create_or_update( @@ -37,6 +38,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: 2025-10-08/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..229f8d2da07e 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) client.local_rulestacks.begin_delete( @@ -35,6 +36,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: 2025-10-08/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..c0cd42d79336 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) client.local_rulestacks.begin_delete( @@ -35,6 +36,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: 2025-10-08/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..850ce6859cda 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.local_rulestacks.get_change_log( @@ -36,6 +37,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: 2025-10-08/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..30b98765f7fd 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.local_rulestacks.get_change_log( @@ -36,6 +37,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: 2025-10-08/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..98b12a5b754f 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.local_rulestacks.get( @@ -36,6 +37,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: 2025-10-08/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..75101236f626 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.local_rulestacks.get( @@ -36,6 +37,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: 2025-10-08/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..d52cb467da82 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.local_rulestacks.get_support_info( @@ -36,6 +37,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: 2025-10-08/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..07d7814b4d11 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.local_rulestacks.get_support_info( @@ -36,6 +37,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: 2025-10-08/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..9cbe41658697 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.local_rulestacks.list_advanced_security_objects( @@ -37,6 +38,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: 2025-10-08/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..9c21a1156901 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.local_rulestacks.list_advanced_security_objects( @@ -37,6 +38,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: 2025-10-08/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..46631591e131 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_app_ids_maximum_set_gen.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.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="SUBSCRIPTION_ID", + ) + + 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: 2025-10-08/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..4983742a99ad --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_app_ids_minimum_set_gen.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.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="SUBSCRIPTION_ID", + ) + + 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: 2025-10-08/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..7a02b3b147ab 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.local_rulestacks.list_by_resource_group( @@ -36,6 +37,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: 2025-10-08/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..300a42afdb6e 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.local_rulestacks.list_by_resource_group( @@ -36,6 +37,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: 2025-10-08/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..ca202edc9e8d 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.local_rulestacks.list_by_subscription() @@ -34,6 +35,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: 2025-10-08/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..f0b7f12f1996 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.local_rulestacks.list_by_subscription() @@ -34,6 +35,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: 2025-10-08/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..321ea51bf59b --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_countries_maximum_set_gen.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.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="SUBSCRIPTION_ID", + ) + + response = client.local_rulestacks.list_countries( + resource_group_name="rgopenapi", + local_rulestack_name="lrs1", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2025-10-08/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..e0db383ea096 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_countries_minimum_set_gen.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.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="SUBSCRIPTION_ID", + ) + + response = client.local_rulestacks.list_countries( + resource_group_name="rgopenapi", + local_rulestack_name="lrs1", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2025-10-08/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..e2d8965f18d0 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.local_rulestacks.list_firewalls( @@ -36,6 +37,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: 2025-10-08/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..b653c18a0411 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.local_rulestacks.list_firewalls( @@ -36,6 +37,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: 2025-10-08/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..11b7ca782293 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_predefined_url_categories_maximum_set_gen.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.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="SUBSCRIPTION_ID", + ) + + 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: 2025-10-08/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..b26eadcce361 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_predefined_url_categories_minimum_set_gen.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.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="SUBSCRIPTION_ID", + ) + + 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: 2025-10-08/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..d604f8cf87b7 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.local_rulestacks.list_security_services( @@ -37,6 +38,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: 2025-10-08/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..b8e273d2747c 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.local_rulestacks.list_security_services( @@ -37,6 +38,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: 2025-10-08/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..5e2d68aadad4 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) client.local_rulestacks.revert( @@ -35,6 +36,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: 2025-10-08/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..6b10a3eca3aa 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) client.local_rulestacks.revert( @@ -35,6 +36,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: 2025-10-08/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..25f8b03e7eca 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.local_rulestacks.update( @@ -62,6 +63,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: 2025-10-08/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..7979880481c7 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_create_or_update_maximum_set_gen.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.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="SUBSCRIPTION_ID", + ) + + 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: 2025-10-08/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..02ec94db9501 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_create_or_update_minimum_set_gen.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.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="SUBSCRIPTION_ID", + ) + + 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: 2025-10-08/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..03462dd607d2 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_delete_maximum_set_gen.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.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="SUBSCRIPTION_ID", + ) + + client.metrics_object_firewall.begin_delete( + resource_group_name="rgopenapi", + firewall_name="aaaaaaaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: 2025-10-08/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..e68bf1488148 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_delete_minimum_set_gen.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.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="SUBSCRIPTION_ID", + ) + + client.metrics_object_firewall.begin_delete( + resource_group_name="rgopenapi", + firewall_name="aaaaaaaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: 2025-10-08/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..f4b4c6b2214c --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_get_maximum_set_gen.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.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="SUBSCRIPTION_ID", + ) + + response = client.metrics_object_firewall.get( + resource_group_name="rgopenapi", + firewall_name="aaaaaaaaaaaaaaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: 2025-10-08/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..7b1c8c7f59f6 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_get_minimum_set_gen.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.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="SUBSCRIPTION_ID", + ) + + response = client.metrics_object_firewall.get( + resource_group_name="rgopenapi", + firewall_name="aaaaaaaaaaaaaaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: 2025-10-08/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..84fe3767f7e7 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_list_by_firewalls_maximum_set_gen.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.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="SUBSCRIPTION_ID", + ) + + 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: 2025-10-08/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..5cf86b7876a4 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/metrics_object_firewall_list_by_firewalls_minimum_set_gen.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.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="SUBSCRIPTION_ID", + ) + + 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: 2025-10-08/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..bf962afc38c2 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +35,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: 2025-10-08/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..585c3997d293 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +35,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: 2025-10-08/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..0b5acc96c0e2 --- /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,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.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="SUBSCRIPTION_ID", + ) + + response = client.palo_alto_networks_cloudngfw_operations.create_product_serial_number() + print(response) + + +# x-ms-original-file: 2025-10-08/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..d3c6888dc8ed --- /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,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.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="SUBSCRIPTION_ID", + ) + + response = client.palo_alto_networks_cloudngfw_operations.create_product_serial_number() + print(response) + + +# x-ms-original-file: 2025-10-08/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..92d808480a39 --- /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,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.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="SUBSCRIPTION_ID", + ) + + response = client.palo_alto_networks_cloudngfw_operations.list_cloud_manager_tenants() + print(response) + + +# x-ms-original-file: 2025-10-08/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..f31edde96c09 --- /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,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.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="SUBSCRIPTION_ID", + ) + + response = client.palo_alto_networks_cloudngfw_operations.list_cloud_manager_tenants() + print(response) + + +# x-ms-original-file: 2025-10-08/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..f12a55734190 --- /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,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.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="SUBSCRIPTION_ID", + ) + + response = client.palo_alto_networks_cloudngfw_operations.list_product_serial_number_status() + print(response) + + +# x-ms-original-file: 2025-10-08/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..04d6d9019ce9 --- /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,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.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="SUBSCRIPTION_ID", + ) + + response = client.palo_alto_networks_cloudngfw_operations.list_product_serial_number_status() + print(response) + + +# x-ms-original-file: 2025-10-08/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..aaa7d8625dec --- /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,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.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="SUBSCRIPTION_ID", + ) + + response = client.palo_alto_networks_cloudngfw_operations.list_support_info() + print(response) + + +# x-ms-original-file: 2025-10-08/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..19e08b56de8f --- /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,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.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="SUBSCRIPTION_ID", + ) + + response = client.palo_alto_networks_cloudngfw_operations.list_support_info() + print(response) + + +# x-ms-original-file: 2025-10-08/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..b28b034dd7aa 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -65,6 +66,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: 2025-10-08/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..4e425586d9c7 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,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: 2025-10-08/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..46f337aea6c7 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,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: 2025-10-08/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..792089cee582 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,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: 2025-10-08/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..1818f13c0e60 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..53cbefd45ebe 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..604bd8ed918d 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..b156d176cb76 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..4dd2224c460b 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..8df2252dddd8 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..00fd2e21239e 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,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: 2025-10-08/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..845682e5eac1 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,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: 2025-10-08/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..8d9b27f9abb7 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..fe385aa116e7 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..d020cf72fdf3 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -65,6 +66,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: 2025-10-08/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..750f9e74adaf 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,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: 2025-10-08/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..e608e97eb489 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,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: 2025-10-08/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..f8598c87511f 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,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: 2025-10-08/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..2832beea64c4 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..063f247ed1d8 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..2d88c8b31180 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..6c03e9688c16 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..8987d18d27c9 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..cf2d2295d198 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..52c3c76fefe9 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,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: 2025-10-08/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..044013d7e4ae 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,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: 2025-10-08/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..c4525b7d1412 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..e6780174866d 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..f9a3578e71a7 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -45,6 +46,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: 2025-10-08/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..0fec26066566 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,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: 2025-10-08/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..815a4bd1f5a1 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,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: 2025-10-08/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..49c336b75c72 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,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: 2025-10-08/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..89728dc0f1d9 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..8862c2f3c27e 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..6fef1ef494fa 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..3751a15fc984 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,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: 2025-10-08/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..32e5f25d8668 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.prefix_list_local_rulestack.begin_create_or_update( @@ -46,6 +47,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: 2025-10-08/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..3621cd3fef96 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.prefix_list_local_rulestack.begin_create_or_update( @@ -38,6 +39,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: 2025-10-08/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..9fa9cacff408 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) client.prefix_list_local_rulestack.begin_delete( @@ -36,6 +37,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: 2025-10-08/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..08ff75c87c5c 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) client.prefix_list_local_rulestack.begin_delete( @@ -36,6 +37,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: 2025-10-08/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..fece407c0166 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.prefix_list_local_rulestack.get( @@ -37,6 +38,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: 2025-10-08/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..f7cba166b79f 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.prefix_list_local_rulestack.get( @@ -37,6 +38,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: 2025-10-08/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..218bb675dfc5 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.prefix_list_local_rulestack.list_by_local_rulestacks( @@ -37,6 +38,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: 2025-10-08/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..689d76497fc8 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 @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = PaloAltoNetworksNgfwMgmtClient( credential=DefaultAzureCredential(), - subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + subscription_id="SUBSCRIPTION_ID", ) response = client.prefix_list_local_rulestack.list_by_local_rulestacks( @@ -37,6 +38,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: 2025-10-08/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..78a6c7a6af66 --- /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) Python 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..45845de79c9c --- /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,83 @@ +# 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.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_get(self, resource_group): + response = self.client.certificate_object_global_rulestack.get( + global_rulestack_name="str", + name="str", + ) + + # 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={ + "properties": { + "certificateSelfSigned": "str", + "auditComment": "str", + "certificateSignerResourceId": "str", + "description": "str", + "etag": "str", + "provisioningState": "str", + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ).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", + ).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_list(self, resource_group): + response = self.client.certificate_object_global_rulestack.list( + global_rulestack_name="str", + ) + 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_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..4ad69e222b47 --- /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,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) 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.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_get(self, resource_group): + response = await self.client.certificate_object_global_rulestack.get( + global_rulestack_name="str", + name="str", + ) + + # 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={ + "properties": { + "certificateSelfSigned": "str", + "auditComment": "str", + "certificateSignerResourceId": "str", + "description": "str", + "etag": "str", + "provisioningState": "str", + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + ).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", + ) + ).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_list(self, resource_group): + response = self.client.certificate_object_global_rulestack.list( + global_rulestack_name="str", + ) + 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_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..a454b695a550 --- /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,87 @@ +# 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.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_get(self, resource_group): + response = self.client.certificate_object_local_rulestack.get( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + ) + + # 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={ + "properties": { + "certificateSelfSigned": "str", + "auditComment": "str", + "certificateSignerResourceId": "str", + "description": "str", + "etag": "str", + "provisioningState": "str", + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ).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", + ).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_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", + ) + 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_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..542d27120b85 --- /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,92 @@ +# 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.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_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", + ) + + # 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={ + "properties": { + "certificateSelfSigned": "str", + "auditComment": "str", + "certificateSignerResourceId": "str", + "description": "str", + "etag": "str", + "provisioningState": "str", + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + ).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", + ) + ).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_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", + ) + 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_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..d0e811098fe1 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_firewall_status_operations.py @@ -0,0 +1,41 @@ +# 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.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_get(self, resource_group): + response = self.client.firewall_status.get( + resource_group_name=resource_group.name, + firewall_name="str", + ) + + # please add some check logic here by yourself + # ... + + @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", + ) + 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_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..26759dda11ce --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_firewall_status_operations_async.py @@ -0,0 +1,42 @@ +# 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.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_get(self, resource_group): + response = await self.client.firewall_status.get( + resource_group_name=resource_group.name, + firewall_name="str", + ) + + # please add some check logic here by yourself + # ... + + @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", + ) + 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_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..6bc64cbe0a3e --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_firewalls_operations.py @@ -0,0 +1,288 @@ +# 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.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_get(self, resource_group): + response = self.client.firewalls.get( + resource_group_name=resource_group.name, + firewall_name="str", + ) + + # 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={ + "location": "str", + "properties": { + "dnsSettings": { + "dnsServers": [{"address": "str", "resourceId": "str"}], + "enableDnsProxy": "str", + "enabledDnsType": "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", + } + ], + "isPanoramaManaged": "str", + "isStrataCloudManaged": "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"}, + }, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ).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"}, + }, + ) + + # 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", + ).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_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] + # please add some check logic here by yourself + # ... + + @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] + # 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", + ) + + # 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", + ) + + # 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", + ) + + # 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", + ) + + # 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..ac5a404f8d31 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_firewalls_operations_async.py @@ -0,0 +1,296 @@ +# 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.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_get(self, resource_group): + response = await self.client.firewalls.get( + resource_group_name=resource_group.name, + firewall_name="str", + ) + + # 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={ + "location": "str", + "properties": { + "dnsSettings": { + "dnsServers": [{"address": "str", "resourceId": "str"}], + "enableDnsProxy": "str", + "enabledDnsType": "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", + } + ], + "isPanoramaManaged": "str", + "isStrataCloudManaged": "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"}, + }, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + ).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"}, + }, + ) + + # 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", + ) + ).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_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] + # please add some check logic here by yourself + # ... + + @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] + # 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", + ) + + # 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", + ) + + # 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", + ) + + # 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", + ) + + # 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..9413bbac110e --- /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,82 @@ +# 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.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_get(self, resource_group): + response = self.client.fqdn_list_global_rulestack.get( + global_rulestack_name="str", + name="str", + ) + + # 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={ + "properties": { + "fqdnList": ["str"], + "auditComment": "str", + "description": "str", + "etag": "str", + "provisioningState": "str", + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ).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", + ).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_list(self, resource_group): + response = self.client.fqdn_list_global_rulestack.list( + global_rulestack_name="str", + ) + 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_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..c5bfe6fc289c --- /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,87 @@ +# 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.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_get(self, resource_group): + response = await self.client.fqdn_list_global_rulestack.get( + global_rulestack_name="str", + name="str", + ) + + # 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={ + "properties": { + "fqdnList": ["str"], + "auditComment": "str", + "description": "str", + "etag": "str", + "provisioningState": "str", + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + ).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", + ) + ).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_list(self, resource_group): + response = self.client.fqdn_list_global_rulestack.list( + global_rulestack_name="str", + ) + 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_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..8339ffca1ac5 --- /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,86 @@ +# 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.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_get(self, resource_group): + response = self.client.fqdn_list_local_rulestack.get( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + ) + + # 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={ + "properties": { + "fqdnList": ["str"], + "auditComment": "str", + "description": "str", + "etag": "str", + "provisioningState": "str", + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ).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", + ).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_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", + ) + 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_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..7a7e85001657 --- /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,91 @@ +# 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.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_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", + ) + + # 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={ + "properties": { + "fqdnList": ["str"], + "auditComment": "str", + "description": "str", + "etag": "str", + "provisioningState": "str", + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + ).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", + ) + ).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_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", + ) + 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_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..5fc516085de2 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_global_rulestack_operations.py @@ -0,0 +1,227 @@ +# 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.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_get(self, resource_group): + response = self.client.global_rulestack.get( + global_rulestack_name="str", + ) + + # 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", + "properties": { + "associatedSubscriptions": ["str"], + "defaultMode": "str", + "description": "str", + "minAppIdVersion": "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", + }, + }, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ).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", + }, + }, + }, + ) + + # 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", + ).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_list(self, resource_group): + response = self.client.global_rulestack.list() + 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_begin_commit(self, resource_group): + response = self.client.global_rulestack.begin_commit( + global_rulestack_name="str", + ).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", + ) + + # 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", + ) + + # 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", + ) + + # 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", + ) + + # 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", + ) + + # 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", + ) + + # 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", + ) + + # 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", + ) + + # 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..bc7fbc2fde73 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_global_rulestack_operations_async.py @@ -0,0 +1,234 @@ +# 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.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_get(self, resource_group): + response = await self.client.global_rulestack.get( + global_rulestack_name="str", + ) + + # 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", + "properties": { + "associatedSubscriptions": ["str"], + "defaultMode": "str", + "description": "str", + "minAppIdVersion": "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", + }, + }, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + ).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", + }, + }, + }, + ) + + # 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", + ) + ).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_list(self, resource_group): + response = self.client.global_rulestack.list() + 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_begin_commit(self, resource_group): + response = await ( + await self.client.global_rulestack.begin_commit( + global_rulestack_name="str", + ) + ).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", + ) + + # 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", + ) + + # 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", + ) + + # 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", + ) + + # 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", + ) + + # 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", + ) + + # 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", + ) + + # 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", + ) + + # 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..e31c46a7e3ec --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_local_rules_operations.py @@ -0,0 +1,143 @@ +# 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.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_get(self, resource_group): + response = self.client.local_rules.get( + resource_group_name=resource_group.name, + local_rulestack_name="str", + priority="str", + ) + + # 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={ + "properties": { + "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", + "inboundInspectionCertificate": "str", + "negateDestination": "str", + "negateSource": "str", + "priority": 0, + "protocol": "str", + "protocolPortList": ["str"], + "provisioningState": "str", + "ruleState": "str", + "source": {"cidrs": ["str"], "countries": ["str"], "feeds": ["str"], "prefixLists": ["str"]}, + "tags": [{"key": "str", "value": "str"}], + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ).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", + ).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_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", + ) + 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_counters(self, resource_group): + response = self.client.local_rules.get_counters( + resource_group_name=resource_group.name, + local_rulestack_name="str", + priority="str", + ) + + # 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", + ) + + # 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", + ) + + # 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..0f456136e013 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_local_rules_operations_async.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) 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.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_get(self, resource_group): + response = await self.client.local_rules.get( + resource_group_name=resource_group.name, + local_rulestack_name="str", + priority="str", + ) + + # 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={ + "properties": { + "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", + "inboundInspectionCertificate": "str", + "negateDestination": "str", + "negateSource": "str", + "priority": 0, + "protocol": "str", + "protocolPortList": ["str"], + "provisioningState": "str", + "ruleState": "str", + "source": {"cidrs": ["str"], "countries": ["str"], "feeds": ["str"], "prefixLists": ["str"]}, + "tags": [{"key": "str", "value": "str"}], + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + ).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", + ) + ).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_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", + ) + 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_counters(self, resource_group): + response = await self.client.local_rules.get_counters( + resource_group_name=resource_group.name, + local_rulestack_name="str", + priority="str", + ) + + # 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", + ) + + # 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", + ) + + # 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..3077c8e71aba --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_local_rulestacks_operations.py @@ -0,0 +1,262 @@ +# 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.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_get(self, resource_group): + response = self.client.local_rulestacks.get( + resource_group_name=resource_group.name, + local_rulestack_name="str", + ) + + # 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", + "properties": { + "associatedSubscriptions": ["str"], + "defaultMode": "str", + "description": "str", + "minAppIdVersion": "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", + }, + }, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ).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"}, + }, + ) + + # 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", + ).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_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] + # please add some check logic here by yourself + # ... + + @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] + # 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", + ).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", + ) + + # 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", + ) + + # 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", + ) + + # 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", + ) + 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", + ) + 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", + ) + + # 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", + ) + 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", + ) + + # 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", + ) + + # 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..446113b8de7c --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_local_rulestacks_operations_async.py @@ -0,0 +1,269 @@ +# 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.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_get(self, resource_group): + response = await self.client.local_rulestacks.get( + resource_group_name=resource_group.name, + local_rulestack_name="str", + ) + + # 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", + "properties": { + "associatedSubscriptions": ["str"], + "defaultMode": "str", + "description": "str", + "minAppIdVersion": "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", + }, + }, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + ).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"}, + }, + ) + + # 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", + ) + ).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_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] + # please add some check logic here by yourself + # ... + + @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] + # 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", + ) + ).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", + ) + + # 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", + ) + + # 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", + ) + + # 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", + ) + 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", + ) + 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", + ) + + # 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", + ) + 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", + ) + + # 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", + ) + + # 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..cfda41d112ec --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_metrics_object_firewall_operations.py @@ -0,0 +1,82 @@ +# 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.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_get(self, resource_group): + response = self.client.metrics_object_firewall.get( + resource_group_name=resource_group.name, + firewall_name="str", + ) + + # 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={ + "properties": { + "applicationInsightsConnectionString": "str", + "applicationInsightsResourceId": "str", + "panEtag": "str", + "provisioningState": "str", + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ).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", + ).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_list_by_firewalls(self, resource_group): + response = self.client.metrics_object_firewall.list_by_firewalls( + resource_group_name=resource_group.name, + firewall_name="str", + ) + 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_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..7a2f52e78210 --- /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,87 @@ +# 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.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_get(self, resource_group): + response = await self.client.metrics_object_firewall.get( + resource_group_name=resource_group.name, + firewall_name="str", + ) + + # 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={ + "properties": { + "applicationInsightsConnectionString": "str", + "applicationInsightsResourceId": "str", + "panEtag": "str", + "provisioningState": "str", + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + ).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", + ) + ).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_list_by_firewalls(self, resource_group): + response = self.client.metrics_object_firewall.list_by_firewalls( + resource_group_name=resource_group.name, + firewall_name="str", + ) + 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_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_operations.py new file mode 100644 index 000000000000..3cf0b8327413 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_operations.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 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() + 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..7493c856d286 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_operations_async.py @@ -0,0 +1,28 @@ +# 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.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() + 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..278a4e067959 --- /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,51 @@ +# 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.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() + + # 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() + + # 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() + + # 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() + + # 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..3a127384427c --- /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,52 @@ +# 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.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() + + # 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() + + # 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() + + # 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() + + # 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..e209ef7f039b --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_post_rules_operations.py @@ -0,0 +1,136 @@ +# 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.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_get(self, resource_group): + response = self.client.post_rules.get( + global_rulestack_name="str", + priority="str", + ) + + # 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={ + "properties": { + "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", + "inboundInspectionCertificate": "str", + "negateDestination": "str", + "negateSource": "str", + "priority": 0, + "protocol": "str", + "protocolPortList": ["str"], + "provisioningState": "str", + "ruleState": "str", + "source": {"cidrs": ["str"], "countries": ["str"], "feeds": ["str"], "prefixLists": ["str"]}, + "tags": [{"key": "str", "value": "str"}], + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ).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", + ).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_list(self, resource_group): + response = self.client.post_rules.list( + global_rulestack_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_post_rules_get_counters(self, resource_group): + response = self.client.post_rules.get_counters( + global_rulestack_name="str", + priority="str", + ) + + # 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", + ) + + # 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", + ) + + # 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..17423892a10f --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_post_rules_operations_async.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) 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.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_get(self, resource_group): + response = await self.client.post_rules.get( + global_rulestack_name="str", + priority="str", + ) + + # 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={ + "properties": { + "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", + "inboundInspectionCertificate": "str", + "negateDestination": "str", + "negateSource": "str", + "priority": 0, + "protocol": "str", + "protocolPortList": ["str"], + "provisioningState": "str", + "ruleState": "str", + "source": {"cidrs": ["str"], "countries": ["str"], "feeds": ["str"], "prefixLists": ["str"]}, + "tags": [{"key": "str", "value": "str"}], + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + ).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", + ) + ).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_list(self, resource_group): + response = self.client.post_rules.list( + global_rulestack_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_post_rules_get_counters(self, resource_group): + response = await self.client.post_rules.get_counters( + global_rulestack_name="str", + priority="str", + ) + + # 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", + ) + + # 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", + ) + + # 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..344111c9611d --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_pre_rules_operations.py @@ -0,0 +1,136 @@ +# 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.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_get(self, resource_group): + response = self.client.pre_rules.get( + global_rulestack_name="str", + priority="str", + ) + + # 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={ + "properties": { + "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", + "inboundInspectionCertificate": "str", + "negateDestination": "str", + "negateSource": "str", + "priority": 0, + "protocol": "str", + "protocolPortList": ["str"], + "provisioningState": "str", + "ruleState": "str", + "source": {"cidrs": ["str"], "countries": ["str"], "feeds": ["str"], "prefixLists": ["str"]}, + "tags": [{"key": "str", "value": "str"}], + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ).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", + ).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_list(self, resource_group): + response = self.client.pre_rules.list( + global_rulestack_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_pre_rules_get_counters(self, resource_group): + response = self.client.pre_rules.get_counters( + global_rulestack_name="str", + priority="str", + ) + + # 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", + ) + + # 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", + ) + + # 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..d70e9220f532 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_pre_rules_operations_async.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) 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.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_get(self, resource_group): + response = await self.client.pre_rules.get( + global_rulestack_name="str", + priority="str", + ) + + # 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={ + "properties": { + "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", + "inboundInspectionCertificate": "str", + "negateDestination": "str", + "negateSource": "str", + "priority": 0, + "protocol": "str", + "protocolPortList": ["str"], + "provisioningState": "str", + "ruleState": "str", + "source": {"cidrs": ["str"], "countries": ["str"], "feeds": ["str"], "prefixLists": ["str"]}, + "tags": [{"key": "str", "value": "str"}], + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + ).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", + ) + ).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_list(self, resource_group): + response = self.client.pre_rules.list( + global_rulestack_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_pre_rules_get_counters(self, resource_group): + response = await self.client.pre_rules.get_counters( + global_rulestack_name="str", + priority="str", + ) + + # 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", + ) + + # 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", + ) + + # 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..db375170cad7 --- /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,82 @@ +# 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.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_get(self, resource_group): + response = self.client.prefix_list_global_rulestack.get( + global_rulestack_name="str", + name="str", + ) + + # 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={ + "properties": { + "prefixList": ["str"], + "auditComment": "str", + "description": "str", + "etag": "str", + "provisioningState": "str", + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ).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", + ).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_list(self, resource_group): + response = self.client.prefix_list_global_rulestack.list( + global_rulestack_name="str", + ) + 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_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..7fe50f82abaa --- /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,87 @@ +# 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.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_get(self, resource_group): + response = await self.client.prefix_list_global_rulestack.get( + global_rulestack_name="str", + name="str", + ) + + # 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={ + "properties": { + "prefixList": ["str"], + "auditComment": "str", + "description": "str", + "etag": "str", + "provisioningState": "str", + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + ).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", + ) + ).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_list(self, resource_group): + response = self.client.prefix_list_global_rulestack.list( + global_rulestack_name="str", + ) + 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_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..2a26a1df1c75 --- /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,86 @@ +# 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.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_get(self, resource_group): + response = self.client.prefix_list_local_rulestack.get( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + ) + + # 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={ + "properties": { + "prefixList": ["str"], + "auditComment": "str", + "description": "str", + "etag": "str", + "provisioningState": "str", + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ).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", + ).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_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", + ) + 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_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..b35803a89749 --- /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,91 @@ +# 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.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_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", + ) + + # 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={ + "properties": { + "prefixList": ["str"], + "auditComment": "str", + "description": "str", + "etag": "str", + "provisioningState": "str", + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + ).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", + ) + ).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_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", + ) + result = [r async for r in response] + # 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..de7d1408bae7 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 = [ + "isodate>=0.6.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..85d1adc3301c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/conftest.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/conftest.py @@ -35,6 +35,7 @@ load_dotenv() + @pytest.fixture(scope="session", autouse=True) def add_sanitizers(test_proxy): subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") 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.py index c52cc4b28fef..55a8326bed34 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/test_cli_mgmt_paloaltonetworksngfw.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tests/test_cli_mgmt_paloaltonetworksngfw.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,14 @@ import azure.mgmt.paloaltonetworksngfw from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy -AZURE_LOCATION = 'eastus' +AZURE_LOCATION = "eastus" + 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 +28,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/tsp-location.yaml b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tsp-location.yaml new file mode 100644 index 000000000000..588ac2c9c17e --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/paloaltonetworks/PaloAltoNetworks.Management +commit: bef8b5a67ca1bd7320fd44d0f8e95dc4bae3f6ae +repo: Azure/azure-rest-api-specs +additionalDirectories: