您可以使用 Google Cloud CLI 或 Compute Engine API 的單一要求,批次更新階層式和網路防火牆政策的所有防火牆政策規則。確保防火牆政策規則集的完整性。透過批次更新,Cloud Next Generation Firewall 可讓您以有效率且易於管理的方式,處理雲端環境中的防火牆政策規則更新。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[],[],null,["# Overview\n\nYou can use a single request from the [Google Cloud CLI](/sdk/install) or\nthe [Compute Engine API](/compute/docs/reference/rest/v1/firewallPolicies#get)\nto batch update all the firewall policy rules for hierarchical and\nnetwork firewall policies. This ensures the integrity of the firewall\npolicy's rule set. Using the batch updates, Cloud Next Generation Firewall\nprovides an efficient and manageable way for you to handle firewall policy\nrule updates in your cloud environments.\n\nFor more information about how to configure batch update, see\n[Configure batch updates to firewall policy rules](/firewall/docs/configure-batch-updates).\n\nPermissions\n-----------\n\nMake sure that you have the following permissions to batch update the\nfirewall policy rules.\n\n- The `compute.firewallPolicies.get` permission to export the hierarchical firewall policy rules.\n- The `compute.firewallPolicies.update` permission to import the hierarchical firewall policy rules.\n- The `compute.firewallPolicies.get` permission to export the network firewall policy rules.\n- The `compute.regionFirewallPolicies.get` permission to export regional network firewall policy rules.\n- The `compute.firewallPolicies.update` permission to import the network firewall policy rules.\n- The `compute.regionFirewallPolicies.update` permission to import the regional network firewall policy rules.\n\nFor more information about the roles and permissions, see\n[Compute Engine roles](/iam/docs/understanding-roles#compute-engine-roles).\n\nSpecification\n-------------\n\nBatch update of firewall policy rules has the following specifications:\n\n- The update process is atomic. This means that if an error occurs\n while the rules are being imported, all changes are rolled back, and\n your firewall policy rule remains in its previous state.\n\n- When you use the REST APIs to update firewall policy rules, the REST APIs\n require a fingerprint for optimistic locking. For more information, see\n [Optimistic concurrency control](https://en.wikipedia.org/wiki/Optimistic_concurrency_control).\n To get the latest fingerprint, we recommend that you first make a `get`\n request to the firewall policy. A `get` request to the firewall policy gets\n the most recent version of the policy, which helps ensure that updates are\n based on the most recent version of the policy. This helps prevent conflicts\n if concurrent modifications are made to the policy.\n\n- When you use the REST API `patch` method, you can replace all existing\n rules by providing a completely new list in your request.\n\n- If a firewall policy `patch` operation is in progress, you can't\n modify rules using methods such as\n [`addRule`](/compute/docs/reference/rest/v1/firewallPolicies/addRule),\n [`patchRule`](/compute/docs/reference/rest/v1/firewallPolicies/patchRule),\n [`removeRule`](/compute/docs/reference/rest/v1/firewallPolicies/removeRule), or\n [`cloneRules`](/compute/docs/reference/rest/v1/firewallPolicies/cloneRules).\n This helps ensure that there are no conflicting modifications during\n the patch operation.\n\nConfigure batch update\n----------------------\n\nThe batch update process involves three key steps:\n\n1. **Export**: export your current firewall policy rules.\n2. **Modify**: make the required batch updates to the exported firewall policy rules.\n3. **Import**: import the modified file back into the firewall policy rules.\n\nTo configure the batch update to firewall policy rules, do the following:\n\n1. Export your firewall policy rules. For more information, see\n [Export firewall policy rule](/firewall/docs/configure-batch-updates#export-rules).\n\n2. Modify the exported file. You can perform the following steps to update\n the file:\n\n - **Add new rules** : make sure that each new rule adheres to the\n [`FirewallPolicyRule.yaml`](https://json-schema.org/draft-06/schema#) schema.\n\n - **Modify existing rules**: change the attributes of the rules that you\n want to update. These attributes include the action, description,\n and match conditions against which incoming traffic is evaluated.\n\n - **Delete rules**: remove the entries for the firewall policy rules you want\n to delete.\n\n For more information, see\n [Modify firewall policy rules](/firewall/docs/configure-batch-updates#modify-firewall-rules).\n3. Import the rules back into your firewall policy. For more information, see\n [Import firewall policy rules](/firewall/docs/configure-batch-updates#import-rules).\n\nWhat's next\n-----------\n\n- For an introduction to firewall rules, see [Firewall policy rules](/firewall/docs/firewall-policies-rule-details).\n- To learn how to configure batch updates to firewall policy rules, see [Configure batch updates for firewall policies](/firewall/configure-batch-updates)."]]