# Gateway ## Get Zero Trust account information `zero_trust.gateway.list(GatewayListParams**kwargs) -> GatewayListResponse` **get** `/accounts/{account_id}/gateway` Retrieve information about the current Zero Trust account. ### Parameters - `account_id: str` ### Returns - `class GatewayListResponse: …` - `id: Optional[str]` Specify the Cloudflare account ID. - `gateway_tag: Optional[str]` Specify the gateway internal ID. - `provider_name: Optional[str]` Specify the provider name (usually Cloudflare). ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) gateways = client.zero_trust.gateway.list( account_id="699d98642c564d2e855e9661899b7252", ) print(gateways.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "699d98642c564d2e855e9661899b7252", "gateway_tag": "f174e90afafe4643bbbc4a0ed4fc8415", "provider_name": "Cloudflare" } } ``` ## Create Zero Trust account `zero_trust.gateway.create(GatewayCreateParams**kwargs) -> GatewayCreateResponse` **post** `/accounts/{account_id}/gateway` Create a Zero Trust account for an existing Cloudflare account. ### Parameters - `account_id: str` ### Returns - `class GatewayCreateResponse: …` - `id: Optional[str]` Specify the Cloudflare account ID. - `gateway_tag: Optional[str]` Specify the gateway internal ID. - `provider_name: Optional[str]` Specify the provider name (usually Cloudflare). ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) gateway = client.zero_trust.gateway.create( account_id="699d98642c564d2e855e9661899b7252", ) print(gateway.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "699d98642c564d2e855e9661899b7252", "gateway_tag": "f174e90afafe4643bbbc4a0ed4fc8415", "provider_name": "Cloudflare" } } ``` ## Domain Types ### Gateway List Response - `class GatewayListResponse: …` - `id: Optional[str]` Specify the Cloudflare account ID. - `gateway_tag: Optional[str]` Specify the gateway internal ID. - `provider_name: Optional[str]` Specify the provider name (usually Cloudflare). ### Gateway Create Response - `class GatewayCreateResponse: …` - `id: Optional[str]` Specify the Cloudflare account ID. - `gateway_tag: Optional[str]` Specify the gateway internal ID. - `provider_name: Optional[str]` Specify the provider name (usually Cloudflare). # Audit SSH Settings ## Get Zero Trust SSH settings `zero_trust.gateway.audit_ssh_settings.get(AuditSSHSettingGetParams**kwargs) -> GatewaySettings` **get** `/accounts/{account_id}/gateway/audit_ssh_settings` Retrieve all Zero Trust Audit SSH and SSH with Access for Infrastructure settings for an account. ### Parameters - `account_id: str` ### Returns - `class GatewaySettings: …` - `created_at: Optional[datetime]` - `public_key: Optional[str]` Provide the Base64-encoded HPKE public key that encrypts SSH session logs. See https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/use-cases/ssh/ssh-infrastructure-access/#enable-ssh-command-logging. - `seed_id: Optional[str]` Identify the seed ID. - `updated_at: Optional[datetime]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) gateway_settings = client.zero_trust.gateway.audit_ssh_settings.get( account_id="699d98642c564d2e855e9661899b7252", ) print(gateway_settings.seed_id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "created_at": "2014-01-01T05:20:00.12345Z", "public_key": "1pyl6I1tL7xfJuFYVzXlUW8uXXlpxegHXBzGCBKaSFA=", "seed_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "updated_at": "2014-01-01T05:20:00.12345Z" } } ``` ## Update Zero Trust SSH settings `zero_trust.gateway.audit_ssh_settings.update(AuditSSHSettingUpdateParams**kwargs) -> GatewaySettings` **put** `/accounts/{account_id}/gateway/audit_ssh_settings` Update Zero Trust Audit SSH and SSH with Access for Infrastructure settings for an account. ### Parameters - `account_id: str` - `public_key: str` Provide the Base64-encoded HPKE public key that encrypts SSH session logs. See https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/use-cases/ssh/ssh-infrastructure-access/#enable-ssh-command-logging. ### Returns - `class GatewaySettings: …` - `created_at: Optional[datetime]` - `public_key: Optional[str]` Provide the Base64-encoded HPKE public key that encrypts SSH session logs. See https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/use-cases/ssh/ssh-infrastructure-access/#enable-ssh-command-logging. - `seed_id: Optional[str]` Identify the seed ID. - `updated_at: Optional[datetime]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) gateway_settings = client.zero_trust.gateway.audit_ssh_settings.update( account_id="699d98642c564d2e855e9661899b7252", public_key="1pyl6I1tL7xfJuFYVzXlUW8uXXlpxegHXBzGCBKaSFA=", ) print(gateway_settings.seed_id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "created_at": "2014-01-01T05:20:00.12345Z", "public_key": "1pyl6I1tL7xfJuFYVzXlUW8uXXlpxegHXBzGCBKaSFA=", "seed_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "updated_at": "2014-01-01T05:20:00.12345Z" } } ``` ## Rotate Zero Trust SSH account seed `zero_trust.gateway.audit_ssh_settings.rotate_seed(AuditSSHSettingRotateSeedParams**kwargs) -> GatewaySettings` **post** `/accounts/{account_id}/gateway/audit_ssh_settings/rotate_seed` Rotate the SSH account seed that generates the host key identity when connecting through the Cloudflare SSH Proxy. ### Parameters - `account_id: str` ### Returns - `class GatewaySettings: …` - `created_at: Optional[datetime]` - `public_key: Optional[str]` Provide the Base64-encoded HPKE public key that encrypts SSH session logs. See https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/use-cases/ssh/ssh-infrastructure-access/#enable-ssh-command-logging. - `seed_id: Optional[str]` Identify the seed ID. - `updated_at: Optional[datetime]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) gateway_settings = client.zero_trust.gateway.audit_ssh_settings.rotate_seed( account_id="699d98642c564d2e855e9661899b7252", ) print(gateway_settings.seed_id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "created_at": "2014-01-01T05:20:00.12345Z", "public_key": "1pyl6I1tL7xfJuFYVzXlUW8uXXlpxegHXBzGCBKaSFA=", "seed_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "updated_at": "2014-01-01T05:20:00.12345Z" } } ``` ## Domain Types ### Gateway Settings - `class GatewaySettings: …` - `created_at: Optional[datetime]` - `public_key: Optional[str]` Provide the Base64-encoded HPKE public key that encrypts SSH session logs. See https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/use-cases/ssh/ssh-infrastructure-access/#enable-ssh-command-logging. - `seed_id: Optional[str]` Identify the seed ID. - `updated_at: Optional[datetime]` # Categories ## List categories `zero_trust.gateway.categories.list(CategoryListParams**kwargs) -> SyncSinglePage[Category]` **get** `/accounts/{account_id}/gateway/categories` List all categories. ### Parameters - `account_id: str` Provide the identifier string. ### Returns - `class Category: …` - `id: Optional[int]` Identify this category. Only one category per ID. - `beta: Optional[bool]` Indicate whether the category is in beta and subject to change. - `class_: Optional[Literal["free", "premium", "blocked", 2 more]]` Specify which account types can create policies for this category. `blocked` Blocks unconditionally for all accounts. `removalPending` Allows removal from policies but disables addition. `noBlock` Prevents blocking. - `"free"` - `"premium"` - `"blocked"` - `"removalPending"` - `"noBlock"` - `description: Optional[str]` Provide a short summary of domains in the category. - `name: Optional[str]` Specify the category name. - `subcategories: Optional[List[Subcategory]]` Provide all subcategories for this category. - `id: Optional[int]` Identify this category. Only one category per ID. - `beta: Optional[bool]` Indicate whether the category is in beta and subject to change. - `class_: Optional[Literal["free", "premium", "blocked", 2 more]]` Specify which account types can create policies for this category. `blocked` Blocks unconditionally for all accounts. `removalPending` Allows removal from policies but disables addition. `noBlock` Prevents blocking. - `"free"` - `"premium"` - `"blocked"` - `"removalPending"` - `"noBlock"` - `description: Optional[str]` Provide a short summary of domains in the category. - `name: Optional[str]` Specify the category name. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.zero_trust.gateway.categories.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "id": 0, "beta": false, "class": "premium", "description": "Sites related to educational content that are not included in other categories such as Science, Technology or Educational institutions.", "name": "Education", "subcategories": [ { "id": 0, "beta": false, "class": "premium", "description": "Sites related to educational content that are not included in other categories such as Science, Technology or Educational institutions.", "name": "Education" } ] } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Domain Types ### Category - `class Category: …` - `id: Optional[int]` Identify this category. Only one category per ID. - `beta: Optional[bool]` Indicate whether the category is in beta and subject to change. - `class_: Optional[Literal["free", "premium", "blocked", 2 more]]` Specify which account types can create policies for this category. `blocked` Blocks unconditionally for all accounts. `removalPending` Allows removal from policies but disables addition. `noBlock` Prevents blocking. - `"free"` - `"premium"` - `"blocked"` - `"removalPending"` - `"noBlock"` - `description: Optional[str]` Provide a short summary of domains in the category. - `name: Optional[str]` Specify the category name. - `subcategories: Optional[List[Subcategory]]` Provide all subcategories for this category. - `id: Optional[int]` Identify this category. Only one category per ID. - `beta: Optional[bool]` Indicate whether the category is in beta and subject to change. - `class_: Optional[Literal["free", "premium", "blocked", 2 more]]` Specify which account types can create policies for this category. `blocked` Blocks unconditionally for all accounts. `removalPending` Allows removal from policies but disables addition. `noBlock` Prevents blocking. - `"free"` - `"premium"` - `"blocked"` - `"removalPending"` - `"noBlock"` - `description: Optional[str]` Provide a short summary of domains in the category. - `name: Optional[str]` Specify the category name. # App Types ## List application and application type mappings `zero_trust.gateway.app_types.list(AppTypeListParams**kwargs) -> SyncSinglePage[AppType]` **get** `/accounts/{account_id}/gateway/app_types` List all application and application type mappings. ### Parameters - `account_id: str` Provide the identifier string. ### Returns - `AppType` - `class ZeroTrustGatewayApplication: …` - `id: Optional[int]` Identify this application. Only one application per ID. - `application_type_id: Optional[int]` Identify the type of this application. Multiple applications can share the same type. Refers to the `id` of a returned application type. - `created_at: Optional[datetime]` - `name: Optional[str]` Specify the name of the application or application type. - `class ZeroTrustGatewayApplicationType: …` - `id: Optional[int]` Identify the type of this application. Multiple applications can share the same type. Refers to the `id` of a returned application type. - `created_at: Optional[datetime]` - `description: Optional[str]` Provide a short summary of applications with this type. - `name: Optional[str]` Specify the name of the application or application type. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.zero_trust.gateway.app_types.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "id": 0, "application_type_id": 0, "created_at": "2014-01-01T05:20:00.12345Z", "name": "Facebook" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Domain Types ### App Type - `AppType` - `class ZeroTrustGatewayApplication: …` - `id: Optional[int]` Identify this application. Only one application per ID. - `application_type_id: Optional[int]` Identify the type of this application. Multiple applications can share the same type. Refers to the `id` of a returned application type. - `created_at: Optional[datetime]` - `name: Optional[str]` Specify the name of the application or application type. - `class ZeroTrustGatewayApplicationType: …` - `id: Optional[int]` Identify the type of this application. Multiple applications can share the same type. Refers to the `id` of a returned application type. - `created_at: Optional[datetime]` - `description: Optional[str]` Provide a short summary of applications with this type. - `name: Optional[str]` Specify the name of the application or application type. # Configurations ## Get Zero Trust account configuration `zero_trust.gateway.configurations.get(ConfigurationGetParams**kwargs) -> ConfigurationGetResponse` **get** `/accounts/{account_id}/gateway/configuration` Retrieve the current Zero Trust account configuration. ### Parameters - `account_id: str` ### Returns - `class ConfigurationGetResponse: …` Specify account settings. - `created_at: Optional[datetime]` - `settings: Optional[GatewayConfigurationSettings]` Specify account settings. - `activity_log: Optional[ActivityLogSettings]` Specify activity log settings. - `enabled: Optional[bool]` Specify whether to log activity. - `antivirus: Optional[AntiVirusSettings]` Specify anti-virus settings. - `enabled_download_phase: Optional[bool]` Specify whether to enable anti-virus scanning on downloads. - `enabled_upload_phase: Optional[bool]` Specify whether to enable anti-virus scanning on uploads. - `fail_closed: Optional[bool]` Specify whether to block requests for unscannable files. - `notification_settings: Optional[NotificationSettings]` Configure the message the user's device shows during an antivirus scan. - `enabled: Optional[bool]` Specify whether to enable notifications. - `include_context: Optional[bool]` Specify whether to include context information as query parameters. - `msg: Optional[str]` Specify the message to show in the notification. - `support_url: Optional[str]` Specify a URL that directs users to more information. If unset, the notification opens a block page. - `block_page: Optional[BlockPageSettings]` Specify block page layout settings. - `background_color: Optional[str]` Specify the block page background color in `#rrggbb` format when the mode is customized_block_page. - `enabled: Optional[bool]` Specify whether to enable the custom block page. - `footer_text: Optional[str]` Specify the block page footer text when the mode is customized_block_page. - `header_text: Optional[str]` Specify the block page header text when the mode is customized_block_page. - `include_context: Optional[bool]` Specify whether to append context to target_uri as query parameters. This applies only when the mode is redirect_uri. - `logo_path: Optional[str]` Specify the full URL to the logo file when the mode is customized_block_page. - `mailto_address: Optional[str]` Specify the admin email for users to contact when the mode is customized_block_page. - `mailto_subject: Optional[str]` Specify the subject line for emails created from the block page when the mode is customized_block_page. - `mode: Optional[Literal["", "customized_block_page", "redirect_uri"]]` Specify whether to redirect users to a Cloudflare-hosted block page or a customer-provided URI. - `""` - `"customized_block_page"` - `"redirect_uri"` - `name: Optional[str]` Specify the block page title when the mode is customized_block_page. - `read_only: Optional[bool]` Indicate that this setting was shared via the Orgs API and read only for the current account. - `source_account: Optional[str]` Indicate the account tag of the account that shared this setting. - `suppress_footer: Optional[bool]` Specify whether to suppress detailed information at the bottom of the block page when the mode is customized_block_page. - `target_uri: Optional[str]` Specify the URI to redirect users to when the mode is redirect_uri. - `version: Optional[int]` Indicate the version number of the setting. - `body_scanning: Optional[BodyScanningSettings]` Specify the DLP inspection mode. - `inspection_mode: Optional[Literal["deep", "shallow"]]` Specify the inspection mode as either `deep` or `shallow`. - `"deep"` - `"shallow"` - `browser_isolation: Optional[BrowserIsolationSettings]` Specify Clientless Browser Isolation settings. - `non_identity_enabled: Optional[bool]` Specify whether to enable non-identity onramp support for Browser Isolation. - `url_browser_isolation_enabled: Optional[bool]` Specify whether to enable Clientless Browser Isolation. - `certificate: Optional[Certificate]` Specify certificate settings for Gateway TLS interception. If unset, the Cloudflare Root CA handles interception. - `id: str` Specify the UUID of the certificate used for interception. Ensure the certificate is available at the edge(previously called 'active'). A nil UUID directs Cloudflare to use the Root CA. - `custom_certificate: Optional[CustomCertificateSettings]` Specify custom certificate settings for BYO-PKI. This field is deprecated; use `certificate` instead. - `enabled: Optional[bool]` Specify whether to enable a custom certificate authority for signing Gateway traffic. - `id: Optional[str]` Specify the UUID of the certificate (ID from MTLS certificate store). - `binding_status: Optional[str]` Indicate the internal certificate status. - `updated_at: Optional[datetime]` - `extended_email_matching: Optional[ExtendedEmailMatching]` Configures user email settings for firewall policies. When you enable this, the system standardizes email addresses in the identity portion of the rule to match extended email variants in firewall policies. When you disable this setting, the system matches email addresses exactly as you provide them. Enable this setting if your email uses `.` or `+` modifiers. - `enabled: Optional[bool]` Specify whether to match all variants of user emails (with + or . modifiers) used as criteria in Firewall policies. - `read_only: Optional[bool]` Indicate that this setting was shared via the Orgs API and read only for the current account. - `source_account: Optional[str]` Indicate the account tag of the account that shared this setting. - `version: Optional[int]` Indicate the version number of the setting. - `fips: Optional[FipsSettings]` Specify FIPS settings. - `tls: Optional[bool]` Enforce cipher suites and TLS versions compliant with FIPS 140-2. - `host_selector: Optional[HostSelector]` Enable host selection in egress policies. - `enabled: Optional[bool]` Specify whether to enable filtering via hosts for egress policies. - `inspection: Optional[Inspection]` Define the proxy inspection mode. - `mode: Optional[Literal["static", "dynamic"]]` Define the proxy inspection mode. 1. static: Gateway applies static inspection to HTTP on TCP(80). With TLS decryption on, Gateway inspects HTTPS traffic on TCP(443) and UDP(443). 2. dynamic: Gateway applies protocol detection to inspect HTTP and HTTPS traffic on any port. TLS decryption must remain on to inspect HTTPS traffic. - `"static"` - `"dynamic"` - `protocol_detection: Optional[ProtocolDetection]` Specify whether to detect protocols from the initial bytes of client traffic. - `enabled: Optional[bool]` Specify whether to detect protocols from the initial bytes of client traffic. - `sandbox: Optional[Sandbox]` Specify whether to enable the sandbox. - `enabled: Optional[bool]` Specify whether to enable the sandbox. - `fallback_action: Optional[Literal["allow", "block"]]` Specify the action to take when the system cannot scan the file. - `"allow"` - `"block"` - `tls_decrypt: Optional[TLSSettings]` Specify whether to inspect encrypted HTTP traffic. - `enabled: Optional[bool]` Specify whether to inspect encrypted HTTP traffic. - `updated_at: Optional[datetime]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) configuration = client.zero_trust.gateway.configurations.get( account_id="699d98642c564d2e855e9661899b7252", ) print(configuration.created_at) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "created_at": "2014-01-01T05:20:00.12345Z", "settings": { "activity_log": { "enabled": true }, "antivirus": { "enabled_download_phase": false, "enabled_upload_phase": false, "fail_closed": false, "notification_settings": { "enabled": true, "include_context": true, "msg": "msg", "support_url": "support_url" } }, "block_page": { "background_color": "background_color", "enabled": true, "footer_text": "--footer--", "header_text": "--header--", "include_context": true, "logo_path": "https://logos.com/a.png", "mailto_address": "admin@example.com", "mailto_subject": "Blocked User Inquiry", "mode": "", "name": "Cloudflare", "read_only": true, "source_account": "source_account", "suppress_footer": false, "target_uri": "https://example.com", "version": 1 }, "body_scanning": { "inspection_mode": "deep" }, "browser_isolation": { "non_identity_enabled": true, "url_browser_isolation_enabled": true }, "certificate": { "id": "d1b364c5-1311-466e-a194-f0e943e0799f" }, "custom_certificate": { "enabled": true, "id": "d1b364c5-1311-466e-a194-f0e943e0799f", "binding_status": "pending_deployment", "updated_at": "2019-12-27T18:11:19.117Z" }, "extended_email_matching": { "enabled": true, "read_only": true, "source_account": "source_account", "version": 1 }, "fips": { "tls": true }, "host_selector": { "enabled": false }, "inspection": { "mode": "static" }, "protocol_detection": { "enabled": true }, "sandbox": { "enabled": true, "fallback_action": "allow" }, "tls_decrypt": { "enabled": true } }, "updated_at": "2014-01-01T05:20:00.12345Z" } } ``` ## Update Zero Trust account configuration `zero_trust.gateway.configurations.update(ConfigurationUpdateParams**kwargs) -> ConfigurationUpdateResponse` **put** `/accounts/{account_id}/gateway/configuration` Update the current Zero Trust account configuration. ### Parameters - `account_id: str` - `settings: Optional[GatewayConfigurationSettingsParam]` Specify account settings. - `activity_log: Optional[ActivityLogSettings]` Specify activity log settings. - `enabled: Optional[bool]` Specify whether to log activity. - `antivirus: Optional[AntiVirusSettings]` Specify anti-virus settings. - `enabled_download_phase: Optional[bool]` Specify whether to enable anti-virus scanning on downloads. - `enabled_upload_phase: Optional[bool]` Specify whether to enable anti-virus scanning on uploads. - `fail_closed: Optional[bool]` Specify whether to block requests for unscannable files. - `notification_settings: Optional[NotificationSettings]` Configure the message the user's device shows during an antivirus scan. - `enabled: Optional[bool]` Specify whether to enable notifications. - `include_context: Optional[bool]` Specify whether to include context information as query parameters. - `msg: Optional[str]` Specify the message to show in the notification. - `support_url: Optional[str]` Specify a URL that directs users to more information. If unset, the notification opens a block page. - `block_page: Optional[BlockPageSettings]` Specify block page layout settings. - `background_color: Optional[str]` Specify the block page background color in `#rrggbb` format when the mode is customized_block_page. - `enabled: Optional[bool]` Specify whether to enable the custom block page. - `footer_text: Optional[str]` Specify the block page footer text when the mode is customized_block_page. - `header_text: Optional[str]` Specify the block page header text when the mode is customized_block_page. - `include_context: Optional[bool]` Specify whether to append context to target_uri as query parameters. This applies only when the mode is redirect_uri. - `logo_path: Optional[str]` Specify the full URL to the logo file when the mode is customized_block_page. - `mailto_address: Optional[str]` Specify the admin email for users to contact when the mode is customized_block_page. - `mailto_subject: Optional[str]` Specify the subject line for emails created from the block page when the mode is customized_block_page. - `mode: Optional[Literal["", "customized_block_page", "redirect_uri"]]` Specify whether to redirect users to a Cloudflare-hosted block page or a customer-provided URI. - `""` - `"customized_block_page"` - `"redirect_uri"` - `name: Optional[str]` Specify the block page title when the mode is customized_block_page. - `read_only: Optional[bool]` Indicate that this setting was shared via the Orgs API and read only for the current account. - `source_account: Optional[str]` Indicate the account tag of the account that shared this setting. - `suppress_footer: Optional[bool]` Specify whether to suppress detailed information at the bottom of the block page when the mode is customized_block_page. - `target_uri: Optional[str]` Specify the URI to redirect users to when the mode is redirect_uri. - `version: Optional[int]` Indicate the version number of the setting. - `body_scanning: Optional[BodyScanningSettings]` Specify the DLP inspection mode. - `inspection_mode: Optional[Literal["deep", "shallow"]]` Specify the inspection mode as either `deep` or `shallow`. - `"deep"` - `"shallow"` - `browser_isolation: Optional[BrowserIsolationSettings]` Specify Clientless Browser Isolation settings. - `non_identity_enabled: Optional[bool]` Specify whether to enable non-identity onramp support for Browser Isolation. - `url_browser_isolation_enabled: Optional[bool]` Specify whether to enable Clientless Browser Isolation. - `certificate: Optional[Certificate]` Specify certificate settings for Gateway TLS interception. If unset, the Cloudflare Root CA handles interception. - `id: str` Specify the UUID of the certificate used for interception. Ensure the certificate is available at the edge(previously called 'active'). A nil UUID directs Cloudflare to use the Root CA. - `custom_certificate: Optional[CustomCertificateSettings]` Specify custom certificate settings for BYO-PKI. This field is deprecated; use `certificate` instead. - `enabled: Optional[bool]` Specify whether to enable a custom certificate authority for signing Gateway traffic. - `id: Optional[str]` Specify the UUID of the certificate (ID from MTLS certificate store). - `binding_status: Optional[str]` Indicate the internal certificate status. - `updated_at: Optional[datetime]` - `extended_email_matching: Optional[ExtendedEmailMatching]` Configures user email settings for firewall policies. When you enable this, the system standardizes email addresses in the identity portion of the rule to match extended email variants in firewall policies. When you disable this setting, the system matches email addresses exactly as you provide them. Enable this setting if your email uses `.` or `+` modifiers. - `enabled: Optional[bool]` Specify whether to match all variants of user emails (with + or . modifiers) used as criteria in Firewall policies. - `read_only: Optional[bool]` Indicate that this setting was shared via the Orgs API and read only for the current account. - `source_account: Optional[str]` Indicate the account tag of the account that shared this setting. - `version: Optional[int]` Indicate the version number of the setting. - `fips: Optional[FipsSettings]` Specify FIPS settings. - `tls: Optional[bool]` Enforce cipher suites and TLS versions compliant with FIPS 140-2. - `host_selector: Optional[HostSelector]` Enable host selection in egress policies. - `enabled: Optional[bool]` Specify whether to enable filtering via hosts for egress policies. - `inspection: Optional[Inspection]` Define the proxy inspection mode. - `mode: Optional[Literal["static", "dynamic"]]` Define the proxy inspection mode. 1. static: Gateway applies static inspection to HTTP on TCP(80). With TLS decryption on, Gateway inspects HTTPS traffic on TCP(443) and UDP(443). 2. dynamic: Gateway applies protocol detection to inspect HTTP and HTTPS traffic on any port. TLS decryption must remain on to inspect HTTPS traffic. - `"static"` - `"dynamic"` - `protocol_detection: Optional[ProtocolDetection]` Specify whether to detect protocols from the initial bytes of client traffic. - `enabled: Optional[bool]` Specify whether to detect protocols from the initial bytes of client traffic. - `sandbox: Optional[Sandbox]` Specify whether to enable the sandbox. - `enabled: Optional[bool]` Specify whether to enable the sandbox. - `fallback_action: Optional[Literal["allow", "block"]]` Specify the action to take when the system cannot scan the file. - `"allow"` - `"block"` - `tls_decrypt: Optional[TLSSettings]` Specify whether to inspect encrypted HTTP traffic. - `enabled: Optional[bool]` Specify whether to inspect encrypted HTTP traffic. ### Returns - `class ConfigurationUpdateResponse: …` Specify account settings. - `created_at: Optional[datetime]` - `settings: Optional[GatewayConfigurationSettings]` Specify account settings. - `activity_log: Optional[ActivityLogSettings]` Specify activity log settings. - `enabled: Optional[bool]` Specify whether to log activity. - `antivirus: Optional[AntiVirusSettings]` Specify anti-virus settings. - `enabled_download_phase: Optional[bool]` Specify whether to enable anti-virus scanning on downloads. - `enabled_upload_phase: Optional[bool]` Specify whether to enable anti-virus scanning on uploads. - `fail_closed: Optional[bool]` Specify whether to block requests for unscannable files. - `notification_settings: Optional[NotificationSettings]` Configure the message the user's device shows during an antivirus scan. - `enabled: Optional[bool]` Specify whether to enable notifications. - `include_context: Optional[bool]` Specify whether to include context information as query parameters. - `msg: Optional[str]` Specify the message to show in the notification. - `support_url: Optional[str]` Specify a URL that directs users to more information. If unset, the notification opens a block page. - `block_page: Optional[BlockPageSettings]` Specify block page layout settings. - `background_color: Optional[str]` Specify the block page background color in `#rrggbb` format when the mode is customized_block_page. - `enabled: Optional[bool]` Specify whether to enable the custom block page. - `footer_text: Optional[str]` Specify the block page footer text when the mode is customized_block_page. - `header_text: Optional[str]` Specify the block page header text when the mode is customized_block_page. - `include_context: Optional[bool]` Specify whether to append context to target_uri as query parameters. This applies only when the mode is redirect_uri. - `logo_path: Optional[str]` Specify the full URL to the logo file when the mode is customized_block_page. - `mailto_address: Optional[str]` Specify the admin email for users to contact when the mode is customized_block_page. - `mailto_subject: Optional[str]` Specify the subject line for emails created from the block page when the mode is customized_block_page. - `mode: Optional[Literal["", "customized_block_page", "redirect_uri"]]` Specify whether to redirect users to a Cloudflare-hosted block page or a customer-provided URI. - `""` - `"customized_block_page"` - `"redirect_uri"` - `name: Optional[str]` Specify the block page title when the mode is customized_block_page. - `read_only: Optional[bool]` Indicate that this setting was shared via the Orgs API and read only for the current account. - `source_account: Optional[str]` Indicate the account tag of the account that shared this setting. - `suppress_footer: Optional[bool]` Specify whether to suppress detailed information at the bottom of the block page when the mode is customized_block_page. - `target_uri: Optional[str]` Specify the URI to redirect users to when the mode is redirect_uri. - `version: Optional[int]` Indicate the version number of the setting. - `body_scanning: Optional[BodyScanningSettings]` Specify the DLP inspection mode. - `inspection_mode: Optional[Literal["deep", "shallow"]]` Specify the inspection mode as either `deep` or `shallow`. - `"deep"` - `"shallow"` - `browser_isolation: Optional[BrowserIsolationSettings]` Specify Clientless Browser Isolation settings. - `non_identity_enabled: Optional[bool]` Specify whether to enable non-identity onramp support for Browser Isolation. - `url_browser_isolation_enabled: Optional[bool]` Specify whether to enable Clientless Browser Isolation. - `certificate: Optional[Certificate]` Specify certificate settings for Gateway TLS interception. If unset, the Cloudflare Root CA handles interception. - `id: str` Specify the UUID of the certificate used for interception. Ensure the certificate is available at the edge(previously called 'active'). A nil UUID directs Cloudflare to use the Root CA. - `custom_certificate: Optional[CustomCertificateSettings]` Specify custom certificate settings for BYO-PKI. This field is deprecated; use `certificate` instead. - `enabled: Optional[bool]` Specify whether to enable a custom certificate authority for signing Gateway traffic. - `id: Optional[str]` Specify the UUID of the certificate (ID from MTLS certificate store). - `binding_status: Optional[str]` Indicate the internal certificate status. - `updated_at: Optional[datetime]` - `extended_email_matching: Optional[ExtendedEmailMatching]` Configures user email settings for firewall policies. When you enable this, the system standardizes email addresses in the identity portion of the rule to match extended email variants in firewall policies. When you disable this setting, the system matches email addresses exactly as you provide them. Enable this setting if your email uses `.` or `+` modifiers. - `enabled: Optional[bool]` Specify whether to match all variants of user emails (with + or . modifiers) used as criteria in Firewall policies. - `read_only: Optional[bool]` Indicate that this setting was shared via the Orgs API and read only for the current account. - `source_account: Optional[str]` Indicate the account tag of the account that shared this setting. - `version: Optional[int]` Indicate the version number of the setting. - `fips: Optional[FipsSettings]` Specify FIPS settings. - `tls: Optional[bool]` Enforce cipher suites and TLS versions compliant with FIPS 140-2. - `host_selector: Optional[HostSelector]` Enable host selection in egress policies. - `enabled: Optional[bool]` Specify whether to enable filtering via hosts for egress policies. - `inspection: Optional[Inspection]` Define the proxy inspection mode. - `mode: Optional[Literal["static", "dynamic"]]` Define the proxy inspection mode. 1. static: Gateway applies static inspection to HTTP on TCP(80). With TLS decryption on, Gateway inspects HTTPS traffic on TCP(443) and UDP(443). 2. dynamic: Gateway applies protocol detection to inspect HTTP and HTTPS traffic on any port. TLS decryption must remain on to inspect HTTPS traffic. - `"static"` - `"dynamic"` - `protocol_detection: Optional[ProtocolDetection]` Specify whether to detect protocols from the initial bytes of client traffic. - `enabled: Optional[bool]` Specify whether to detect protocols from the initial bytes of client traffic. - `sandbox: Optional[Sandbox]` Specify whether to enable the sandbox. - `enabled: Optional[bool]` Specify whether to enable the sandbox. - `fallback_action: Optional[Literal["allow", "block"]]` Specify the action to take when the system cannot scan the file. - `"allow"` - `"block"` - `tls_decrypt: Optional[TLSSettings]` Specify whether to inspect encrypted HTTP traffic. - `enabled: Optional[bool]` Specify whether to inspect encrypted HTTP traffic. - `updated_at: Optional[datetime]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) configuration = client.zero_trust.gateway.configurations.update( account_id="699d98642c564d2e855e9661899b7252", ) print(configuration.created_at) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "created_at": "2014-01-01T05:20:00.12345Z", "settings": { "activity_log": { "enabled": true }, "antivirus": { "enabled_download_phase": false, "enabled_upload_phase": false, "fail_closed": false, "notification_settings": { "enabled": true, "include_context": true, "msg": "msg", "support_url": "support_url" } }, "block_page": { "background_color": "background_color", "enabled": true, "footer_text": "--footer--", "header_text": "--header--", "include_context": true, "logo_path": "https://logos.com/a.png", "mailto_address": "admin@example.com", "mailto_subject": "Blocked User Inquiry", "mode": "", "name": "Cloudflare", "read_only": true, "source_account": "source_account", "suppress_footer": false, "target_uri": "https://example.com", "version": 1 }, "body_scanning": { "inspection_mode": "deep" }, "browser_isolation": { "non_identity_enabled": true, "url_browser_isolation_enabled": true }, "certificate": { "id": "d1b364c5-1311-466e-a194-f0e943e0799f" }, "custom_certificate": { "enabled": true, "id": "d1b364c5-1311-466e-a194-f0e943e0799f", "binding_status": "pending_deployment", "updated_at": "2019-12-27T18:11:19.117Z" }, "extended_email_matching": { "enabled": true, "read_only": true, "source_account": "source_account", "version": 1 }, "fips": { "tls": true }, "host_selector": { "enabled": false }, "inspection": { "mode": "static" }, "protocol_detection": { "enabled": true }, "sandbox": { "enabled": true, "fallback_action": "allow" }, "tls_decrypt": { "enabled": true } }, "updated_at": "2014-01-01T05:20:00.12345Z" } } ``` ## Patch Zero Trust account configuration `zero_trust.gateway.configurations.edit(ConfigurationEditParams**kwargs) -> ConfigurationEditResponse` **patch** `/accounts/{account_id}/gateway/configuration` Update (PATCH) a single subcollection of settings such as `antivirus`, `tls_decrypt`, `activity_log`, `block_page`, `browser_isolation`, `fips`, `body_scanning`, or `certificate` without updating the entire configuration object. This endpoint returns an error if any settings collection lacks proper configuration. ### Parameters - `account_id: str` - `settings: Optional[GatewayConfigurationSettingsParam]` Specify account settings. - `activity_log: Optional[ActivityLogSettings]` Specify activity log settings. - `enabled: Optional[bool]` Specify whether to log activity. - `antivirus: Optional[AntiVirusSettings]` Specify anti-virus settings. - `enabled_download_phase: Optional[bool]` Specify whether to enable anti-virus scanning on downloads. - `enabled_upload_phase: Optional[bool]` Specify whether to enable anti-virus scanning on uploads. - `fail_closed: Optional[bool]` Specify whether to block requests for unscannable files. - `notification_settings: Optional[NotificationSettings]` Configure the message the user's device shows during an antivirus scan. - `enabled: Optional[bool]` Specify whether to enable notifications. - `include_context: Optional[bool]` Specify whether to include context information as query parameters. - `msg: Optional[str]` Specify the message to show in the notification. - `support_url: Optional[str]` Specify a URL that directs users to more information. If unset, the notification opens a block page. - `block_page: Optional[BlockPageSettings]` Specify block page layout settings. - `background_color: Optional[str]` Specify the block page background color in `#rrggbb` format when the mode is customized_block_page. - `enabled: Optional[bool]` Specify whether to enable the custom block page. - `footer_text: Optional[str]` Specify the block page footer text when the mode is customized_block_page. - `header_text: Optional[str]` Specify the block page header text when the mode is customized_block_page. - `include_context: Optional[bool]` Specify whether to append context to target_uri as query parameters. This applies only when the mode is redirect_uri. - `logo_path: Optional[str]` Specify the full URL to the logo file when the mode is customized_block_page. - `mailto_address: Optional[str]` Specify the admin email for users to contact when the mode is customized_block_page. - `mailto_subject: Optional[str]` Specify the subject line for emails created from the block page when the mode is customized_block_page. - `mode: Optional[Literal["", "customized_block_page", "redirect_uri"]]` Specify whether to redirect users to a Cloudflare-hosted block page or a customer-provided URI. - `""` - `"customized_block_page"` - `"redirect_uri"` - `name: Optional[str]` Specify the block page title when the mode is customized_block_page. - `read_only: Optional[bool]` Indicate that this setting was shared via the Orgs API and read only for the current account. - `source_account: Optional[str]` Indicate the account tag of the account that shared this setting. - `suppress_footer: Optional[bool]` Specify whether to suppress detailed information at the bottom of the block page when the mode is customized_block_page. - `target_uri: Optional[str]` Specify the URI to redirect users to when the mode is redirect_uri. - `version: Optional[int]` Indicate the version number of the setting. - `body_scanning: Optional[BodyScanningSettings]` Specify the DLP inspection mode. - `inspection_mode: Optional[Literal["deep", "shallow"]]` Specify the inspection mode as either `deep` or `shallow`. - `"deep"` - `"shallow"` - `browser_isolation: Optional[BrowserIsolationSettings]` Specify Clientless Browser Isolation settings. - `non_identity_enabled: Optional[bool]` Specify whether to enable non-identity onramp support for Browser Isolation. - `url_browser_isolation_enabled: Optional[bool]` Specify whether to enable Clientless Browser Isolation. - `certificate: Optional[Certificate]` Specify certificate settings for Gateway TLS interception. If unset, the Cloudflare Root CA handles interception. - `id: str` Specify the UUID of the certificate used for interception. Ensure the certificate is available at the edge(previously called 'active'). A nil UUID directs Cloudflare to use the Root CA. - `custom_certificate: Optional[CustomCertificateSettings]` Specify custom certificate settings for BYO-PKI. This field is deprecated; use `certificate` instead. - `enabled: Optional[bool]` Specify whether to enable a custom certificate authority for signing Gateway traffic. - `id: Optional[str]` Specify the UUID of the certificate (ID from MTLS certificate store). - `binding_status: Optional[str]` Indicate the internal certificate status. - `updated_at: Optional[datetime]` - `extended_email_matching: Optional[ExtendedEmailMatching]` Configures user email settings for firewall policies. When you enable this, the system standardizes email addresses in the identity portion of the rule to match extended email variants in firewall policies. When you disable this setting, the system matches email addresses exactly as you provide them. Enable this setting if your email uses `.` or `+` modifiers. - `enabled: Optional[bool]` Specify whether to match all variants of user emails (with + or . modifiers) used as criteria in Firewall policies. - `read_only: Optional[bool]` Indicate that this setting was shared via the Orgs API and read only for the current account. - `source_account: Optional[str]` Indicate the account tag of the account that shared this setting. - `version: Optional[int]` Indicate the version number of the setting. - `fips: Optional[FipsSettings]` Specify FIPS settings. - `tls: Optional[bool]` Enforce cipher suites and TLS versions compliant with FIPS 140-2. - `host_selector: Optional[HostSelector]` Enable host selection in egress policies. - `enabled: Optional[bool]` Specify whether to enable filtering via hosts for egress policies. - `inspection: Optional[Inspection]` Define the proxy inspection mode. - `mode: Optional[Literal["static", "dynamic"]]` Define the proxy inspection mode. 1. static: Gateway applies static inspection to HTTP on TCP(80). With TLS decryption on, Gateway inspects HTTPS traffic on TCP(443) and UDP(443). 2. dynamic: Gateway applies protocol detection to inspect HTTP and HTTPS traffic on any port. TLS decryption must remain on to inspect HTTPS traffic. - `"static"` - `"dynamic"` - `protocol_detection: Optional[ProtocolDetection]` Specify whether to detect protocols from the initial bytes of client traffic. - `enabled: Optional[bool]` Specify whether to detect protocols from the initial bytes of client traffic. - `sandbox: Optional[Sandbox]` Specify whether to enable the sandbox. - `enabled: Optional[bool]` Specify whether to enable the sandbox. - `fallback_action: Optional[Literal["allow", "block"]]` Specify the action to take when the system cannot scan the file. - `"allow"` - `"block"` - `tls_decrypt: Optional[TLSSettings]` Specify whether to inspect encrypted HTTP traffic. - `enabled: Optional[bool]` Specify whether to inspect encrypted HTTP traffic. ### Returns - `class ConfigurationEditResponse: …` Specify account settings. - `created_at: Optional[datetime]` - `settings: Optional[GatewayConfigurationSettings]` Specify account settings. - `activity_log: Optional[ActivityLogSettings]` Specify activity log settings. - `enabled: Optional[bool]` Specify whether to log activity. - `antivirus: Optional[AntiVirusSettings]` Specify anti-virus settings. - `enabled_download_phase: Optional[bool]` Specify whether to enable anti-virus scanning on downloads. - `enabled_upload_phase: Optional[bool]` Specify whether to enable anti-virus scanning on uploads. - `fail_closed: Optional[bool]` Specify whether to block requests for unscannable files. - `notification_settings: Optional[NotificationSettings]` Configure the message the user's device shows during an antivirus scan. - `enabled: Optional[bool]` Specify whether to enable notifications. - `include_context: Optional[bool]` Specify whether to include context information as query parameters. - `msg: Optional[str]` Specify the message to show in the notification. - `support_url: Optional[str]` Specify a URL that directs users to more information. If unset, the notification opens a block page. - `block_page: Optional[BlockPageSettings]` Specify block page layout settings. - `background_color: Optional[str]` Specify the block page background color in `#rrggbb` format when the mode is customized_block_page. - `enabled: Optional[bool]` Specify whether to enable the custom block page. - `footer_text: Optional[str]` Specify the block page footer text when the mode is customized_block_page. - `header_text: Optional[str]` Specify the block page header text when the mode is customized_block_page. - `include_context: Optional[bool]` Specify whether to append context to target_uri as query parameters. This applies only when the mode is redirect_uri. - `logo_path: Optional[str]` Specify the full URL to the logo file when the mode is customized_block_page. - `mailto_address: Optional[str]` Specify the admin email for users to contact when the mode is customized_block_page. - `mailto_subject: Optional[str]` Specify the subject line for emails created from the block page when the mode is customized_block_page. - `mode: Optional[Literal["", "customized_block_page", "redirect_uri"]]` Specify whether to redirect users to a Cloudflare-hosted block page or a customer-provided URI. - `""` - `"customized_block_page"` - `"redirect_uri"` - `name: Optional[str]` Specify the block page title when the mode is customized_block_page. - `read_only: Optional[bool]` Indicate that this setting was shared via the Orgs API and read only for the current account. - `source_account: Optional[str]` Indicate the account tag of the account that shared this setting. - `suppress_footer: Optional[bool]` Specify whether to suppress detailed information at the bottom of the block page when the mode is customized_block_page. - `target_uri: Optional[str]` Specify the URI to redirect users to when the mode is redirect_uri. - `version: Optional[int]` Indicate the version number of the setting. - `body_scanning: Optional[BodyScanningSettings]` Specify the DLP inspection mode. - `inspection_mode: Optional[Literal["deep", "shallow"]]` Specify the inspection mode as either `deep` or `shallow`. - `"deep"` - `"shallow"` - `browser_isolation: Optional[BrowserIsolationSettings]` Specify Clientless Browser Isolation settings. - `non_identity_enabled: Optional[bool]` Specify whether to enable non-identity onramp support for Browser Isolation. - `url_browser_isolation_enabled: Optional[bool]` Specify whether to enable Clientless Browser Isolation. - `certificate: Optional[Certificate]` Specify certificate settings for Gateway TLS interception. If unset, the Cloudflare Root CA handles interception. - `id: str` Specify the UUID of the certificate used for interception. Ensure the certificate is available at the edge(previously called 'active'). A nil UUID directs Cloudflare to use the Root CA. - `custom_certificate: Optional[CustomCertificateSettings]` Specify custom certificate settings for BYO-PKI. This field is deprecated; use `certificate` instead. - `enabled: Optional[bool]` Specify whether to enable a custom certificate authority for signing Gateway traffic. - `id: Optional[str]` Specify the UUID of the certificate (ID from MTLS certificate store). - `binding_status: Optional[str]` Indicate the internal certificate status. - `updated_at: Optional[datetime]` - `extended_email_matching: Optional[ExtendedEmailMatching]` Configures user email settings for firewall policies. When you enable this, the system standardizes email addresses in the identity portion of the rule to match extended email variants in firewall policies. When you disable this setting, the system matches email addresses exactly as you provide them. Enable this setting if your email uses `.` or `+` modifiers. - `enabled: Optional[bool]` Specify whether to match all variants of user emails (with + or . modifiers) used as criteria in Firewall policies. - `read_only: Optional[bool]` Indicate that this setting was shared via the Orgs API and read only for the current account. - `source_account: Optional[str]` Indicate the account tag of the account that shared this setting. - `version: Optional[int]` Indicate the version number of the setting. - `fips: Optional[FipsSettings]` Specify FIPS settings. - `tls: Optional[bool]` Enforce cipher suites and TLS versions compliant with FIPS 140-2. - `host_selector: Optional[HostSelector]` Enable host selection in egress policies. - `enabled: Optional[bool]` Specify whether to enable filtering via hosts for egress policies. - `inspection: Optional[Inspection]` Define the proxy inspection mode. - `mode: Optional[Literal["static", "dynamic"]]` Define the proxy inspection mode. 1. static: Gateway applies static inspection to HTTP on TCP(80). With TLS decryption on, Gateway inspects HTTPS traffic on TCP(443) and UDP(443). 2. dynamic: Gateway applies protocol detection to inspect HTTP and HTTPS traffic on any port. TLS decryption must remain on to inspect HTTPS traffic. - `"static"` - `"dynamic"` - `protocol_detection: Optional[ProtocolDetection]` Specify whether to detect protocols from the initial bytes of client traffic. - `enabled: Optional[bool]` Specify whether to detect protocols from the initial bytes of client traffic. - `sandbox: Optional[Sandbox]` Specify whether to enable the sandbox. - `enabled: Optional[bool]` Specify whether to enable the sandbox. - `fallback_action: Optional[Literal["allow", "block"]]` Specify the action to take when the system cannot scan the file. - `"allow"` - `"block"` - `tls_decrypt: Optional[TLSSettings]` Specify whether to inspect encrypted HTTP traffic. - `enabled: Optional[bool]` Specify whether to inspect encrypted HTTP traffic. - `updated_at: Optional[datetime]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.zero_trust.gateway.configurations.edit( account_id="699d98642c564d2e855e9661899b7252", ) print(response.created_at) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "created_at": "2014-01-01T05:20:00.12345Z", "settings": { "activity_log": { "enabled": true }, "antivirus": { "enabled_download_phase": false, "enabled_upload_phase": false, "fail_closed": false, "notification_settings": { "enabled": true, "include_context": true, "msg": "msg", "support_url": "support_url" } }, "block_page": { "background_color": "background_color", "enabled": true, "footer_text": "--footer--", "header_text": "--header--", "include_context": true, "logo_path": "https://logos.com/a.png", "mailto_address": "admin@example.com", "mailto_subject": "Blocked User Inquiry", "mode": "", "name": "Cloudflare", "read_only": true, "source_account": "source_account", "suppress_footer": false, "target_uri": "https://example.com", "version": 1 }, "body_scanning": { "inspection_mode": "deep" }, "browser_isolation": { "non_identity_enabled": true, "url_browser_isolation_enabled": true }, "certificate": { "id": "d1b364c5-1311-466e-a194-f0e943e0799f" }, "custom_certificate": { "enabled": true, "id": "d1b364c5-1311-466e-a194-f0e943e0799f", "binding_status": "pending_deployment", "updated_at": "2019-12-27T18:11:19.117Z" }, "extended_email_matching": { "enabled": true, "read_only": true, "source_account": "source_account", "version": 1 }, "fips": { "tls": true }, "host_selector": { "enabled": false }, "inspection": { "mode": "static" }, "protocol_detection": { "enabled": true }, "sandbox": { "enabled": true, "fallback_action": "allow" }, "tls_decrypt": { "enabled": true } }, "updated_at": "2014-01-01T05:20:00.12345Z" } } ``` ## Domain Types ### Activity Log Settings - `class ActivityLogSettings: …` Specify activity log settings. - `enabled: Optional[bool]` Specify whether to log activity. ### Anti Virus Settings - `class AntiVirusSettings: …` Specify anti-virus settings. - `enabled_download_phase: Optional[bool]` Specify whether to enable anti-virus scanning on downloads. - `enabled_upload_phase: Optional[bool]` Specify whether to enable anti-virus scanning on uploads. - `fail_closed: Optional[bool]` Specify whether to block requests for unscannable files. - `notification_settings: Optional[NotificationSettings]` Configure the message the user's device shows during an antivirus scan. - `enabled: Optional[bool]` Specify whether to enable notifications. - `include_context: Optional[bool]` Specify whether to include context information as query parameters. - `msg: Optional[str]` Specify the message to show in the notification. - `support_url: Optional[str]` Specify a URL that directs users to more information. If unset, the notification opens a block page. ### Block Page Settings - `class BlockPageSettings: …` Specify block page layout settings. - `background_color: Optional[str]` Specify the block page background color in `#rrggbb` format when the mode is customized_block_page. - `enabled: Optional[bool]` Specify whether to enable the custom block page. - `footer_text: Optional[str]` Specify the block page footer text when the mode is customized_block_page. - `header_text: Optional[str]` Specify the block page header text when the mode is customized_block_page. - `include_context: Optional[bool]` Specify whether to append context to target_uri as query parameters. This applies only when the mode is redirect_uri. - `logo_path: Optional[str]` Specify the full URL to the logo file when the mode is customized_block_page. - `mailto_address: Optional[str]` Specify the admin email for users to contact when the mode is customized_block_page. - `mailto_subject: Optional[str]` Specify the subject line for emails created from the block page when the mode is customized_block_page. - `mode: Optional[Literal["", "customized_block_page", "redirect_uri"]]` Specify whether to redirect users to a Cloudflare-hosted block page or a customer-provided URI. - `""` - `"customized_block_page"` - `"redirect_uri"` - `name: Optional[str]` Specify the block page title when the mode is customized_block_page. - `read_only: Optional[bool]` Indicate that this setting was shared via the Orgs API and read only for the current account. - `source_account: Optional[str]` Indicate the account tag of the account that shared this setting. - `suppress_footer: Optional[bool]` Specify whether to suppress detailed information at the bottom of the block page when the mode is customized_block_page. - `target_uri: Optional[str]` Specify the URI to redirect users to when the mode is redirect_uri. - `version: Optional[int]` Indicate the version number of the setting. ### Body Scanning Settings - `class BodyScanningSettings: …` Specify the DLP inspection mode. - `inspection_mode: Optional[Literal["deep", "shallow"]]` Specify the inspection mode as either `deep` or `shallow`. - `"deep"` - `"shallow"` ### Browser Isolation Settings - `class BrowserIsolationSettings: …` Specify Clientless Browser Isolation settings. - `non_identity_enabled: Optional[bool]` Specify whether to enable non-identity onramp support for Browser Isolation. - `url_browser_isolation_enabled: Optional[bool]` Specify whether to enable Clientless Browser Isolation. ### Custom Certificate Settings - `class CustomCertificateSettings: …` Specify custom certificate settings for BYO-PKI. This field is deprecated; use `certificate` instead. - `enabled: Optional[bool]` Specify whether to enable a custom certificate authority for signing Gateway traffic. - `id: Optional[str]` Specify the UUID of the certificate (ID from MTLS certificate store). - `binding_status: Optional[str]` Indicate the internal certificate status. - `updated_at: Optional[datetime]` ### Extended Email Matching - `class ExtendedEmailMatching: …` Configures user email settings for firewall policies. When you enable this, the system standardizes email addresses in the identity portion of the rule to match extended email variants in firewall policies. When you disable this setting, the system matches email addresses exactly as you provide them. Enable this setting if your email uses `.` or `+` modifiers. - `enabled: Optional[bool]` Specify whether to match all variants of user emails (with + or . modifiers) used as criteria in Firewall policies. - `read_only: Optional[bool]` Indicate that this setting was shared via the Orgs API and read only for the current account. - `source_account: Optional[str]` Indicate the account tag of the account that shared this setting. - `version: Optional[int]` Indicate the version number of the setting. ### Fips Settings - `class FipsSettings: …` Specify FIPS settings. - `tls: Optional[bool]` Enforce cipher suites and TLS versions compliant with FIPS 140-2. ### Gateway Configuration Settings - `class GatewayConfigurationSettings: …` Specify account settings. - `activity_log: Optional[ActivityLogSettings]` Specify activity log settings. - `enabled: Optional[bool]` Specify whether to log activity. - `antivirus: Optional[AntiVirusSettings]` Specify anti-virus settings. - `enabled_download_phase: Optional[bool]` Specify whether to enable anti-virus scanning on downloads. - `enabled_upload_phase: Optional[bool]` Specify whether to enable anti-virus scanning on uploads. - `fail_closed: Optional[bool]` Specify whether to block requests for unscannable files. - `notification_settings: Optional[NotificationSettings]` Configure the message the user's device shows during an antivirus scan. - `enabled: Optional[bool]` Specify whether to enable notifications. - `include_context: Optional[bool]` Specify whether to include context information as query parameters. - `msg: Optional[str]` Specify the message to show in the notification. - `support_url: Optional[str]` Specify a URL that directs users to more information. If unset, the notification opens a block page. - `block_page: Optional[BlockPageSettings]` Specify block page layout settings. - `background_color: Optional[str]` Specify the block page background color in `#rrggbb` format when the mode is customized_block_page. - `enabled: Optional[bool]` Specify whether to enable the custom block page. - `footer_text: Optional[str]` Specify the block page footer text when the mode is customized_block_page. - `header_text: Optional[str]` Specify the block page header text when the mode is customized_block_page. - `include_context: Optional[bool]` Specify whether to append context to target_uri as query parameters. This applies only when the mode is redirect_uri. - `logo_path: Optional[str]` Specify the full URL to the logo file when the mode is customized_block_page. - `mailto_address: Optional[str]` Specify the admin email for users to contact when the mode is customized_block_page. - `mailto_subject: Optional[str]` Specify the subject line for emails created from the block page when the mode is customized_block_page. - `mode: Optional[Literal["", "customized_block_page", "redirect_uri"]]` Specify whether to redirect users to a Cloudflare-hosted block page or a customer-provided URI. - `""` - `"customized_block_page"` - `"redirect_uri"` - `name: Optional[str]` Specify the block page title when the mode is customized_block_page. - `read_only: Optional[bool]` Indicate that this setting was shared via the Orgs API and read only for the current account. - `source_account: Optional[str]` Indicate the account tag of the account that shared this setting. - `suppress_footer: Optional[bool]` Specify whether to suppress detailed information at the bottom of the block page when the mode is customized_block_page. - `target_uri: Optional[str]` Specify the URI to redirect users to when the mode is redirect_uri. - `version: Optional[int]` Indicate the version number of the setting. - `body_scanning: Optional[BodyScanningSettings]` Specify the DLP inspection mode. - `inspection_mode: Optional[Literal["deep", "shallow"]]` Specify the inspection mode as either `deep` or `shallow`. - `"deep"` - `"shallow"` - `browser_isolation: Optional[BrowserIsolationSettings]` Specify Clientless Browser Isolation settings. - `non_identity_enabled: Optional[bool]` Specify whether to enable non-identity onramp support for Browser Isolation. - `url_browser_isolation_enabled: Optional[bool]` Specify whether to enable Clientless Browser Isolation. - `certificate: Optional[Certificate]` Specify certificate settings for Gateway TLS interception. If unset, the Cloudflare Root CA handles interception. - `id: str` Specify the UUID of the certificate used for interception. Ensure the certificate is available at the edge(previously called 'active'). A nil UUID directs Cloudflare to use the Root CA. - `custom_certificate: Optional[CustomCertificateSettings]` Specify custom certificate settings for BYO-PKI. This field is deprecated; use `certificate` instead. - `enabled: Optional[bool]` Specify whether to enable a custom certificate authority for signing Gateway traffic. - `id: Optional[str]` Specify the UUID of the certificate (ID from MTLS certificate store). - `binding_status: Optional[str]` Indicate the internal certificate status. - `updated_at: Optional[datetime]` - `extended_email_matching: Optional[ExtendedEmailMatching]` Configures user email settings for firewall policies. When you enable this, the system standardizes email addresses in the identity portion of the rule to match extended email variants in firewall policies. When you disable this setting, the system matches email addresses exactly as you provide them. Enable this setting if your email uses `.` or `+` modifiers. - `enabled: Optional[bool]` Specify whether to match all variants of user emails (with + or . modifiers) used as criteria in Firewall policies. - `read_only: Optional[bool]` Indicate that this setting was shared via the Orgs API and read only for the current account. - `source_account: Optional[str]` Indicate the account tag of the account that shared this setting. - `version: Optional[int]` Indicate the version number of the setting. - `fips: Optional[FipsSettings]` Specify FIPS settings. - `tls: Optional[bool]` Enforce cipher suites and TLS versions compliant with FIPS 140-2. - `host_selector: Optional[HostSelector]` Enable host selection in egress policies. - `enabled: Optional[bool]` Specify whether to enable filtering via hosts for egress policies. - `inspection: Optional[Inspection]` Define the proxy inspection mode. - `mode: Optional[Literal["static", "dynamic"]]` Define the proxy inspection mode. 1. static: Gateway applies static inspection to HTTP on TCP(80). With TLS decryption on, Gateway inspects HTTPS traffic on TCP(443) and UDP(443). 2. dynamic: Gateway applies protocol detection to inspect HTTP and HTTPS traffic on any port. TLS decryption must remain on to inspect HTTPS traffic. - `"static"` - `"dynamic"` - `protocol_detection: Optional[ProtocolDetection]` Specify whether to detect protocols from the initial bytes of client traffic. - `enabled: Optional[bool]` Specify whether to detect protocols from the initial bytes of client traffic. - `sandbox: Optional[Sandbox]` Specify whether to enable the sandbox. - `enabled: Optional[bool]` Specify whether to enable the sandbox. - `fallback_action: Optional[Literal["allow", "block"]]` Specify the action to take when the system cannot scan the file. - `"allow"` - `"block"` - `tls_decrypt: Optional[TLSSettings]` Specify whether to inspect encrypted HTTP traffic. - `enabled: Optional[bool]` Specify whether to inspect encrypted HTTP traffic. ### Notification Settings - `class NotificationSettings: …` Configure the message the user's device shows during an antivirus scan. - `enabled: Optional[bool]` Specify whether to enable notifications. - `include_context: Optional[bool]` Specify whether to include context information as query parameters. - `msg: Optional[str]` Specify the message to show in the notification. - `support_url: Optional[str]` Specify a URL that directs users to more information. If unset, the notification opens a block page. ### Protocol Detection - `class ProtocolDetection: …` Specify whether to detect protocols from the initial bytes of client traffic. - `enabled: Optional[bool]` Specify whether to detect protocols from the initial bytes of client traffic. ### TLS Settings - `class TLSSettings: …` Specify whether to inspect encrypted HTTP traffic. - `enabled: Optional[bool]` Specify whether to inspect encrypted HTTP traffic. ### Configuration Get Response - `class ConfigurationGetResponse: …` Specify account settings. - `created_at: Optional[datetime]` - `settings: Optional[GatewayConfigurationSettings]` Specify account settings. - `activity_log: Optional[ActivityLogSettings]` Specify activity log settings. - `enabled: Optional[bool]` Specify whether to log activity. - `antivirus: Optional[AntiVirusSettings]` Specify anti-virus settings. - `enabled_download_phase: Optional[bool]` Specify whether to enable anti-virus scanning on downloads. - `enabled_upload_phase: Optional[bool]` Specify whether to enable anti-virus scanning on uploads. - `fail_closed: Optional[bool]` Specify whether to block requests for unscannable files. - `notification_settings: Optional[NotificationSettings]` Configure the message the user's device shows during an antivirus scan. - `enabled: Optional[bool]` Specify whether to enable notifications. - `include_context: Optional[bool]` Specify whether to include context information as query parameters. - `msg: Optional[str]` Specify the message to show in the notification. - `support_url: Optional[str]` Specify a URL that directs users to more information. If unset, the notification opens a block page. - `block_page: Optional[BlockPageSettings]` Specify block page layout settings. - `background_color: Optional[str]` Specify the block page background color in `#rrggbb` format when the mode is customized_block_page. - `enabled: Optional[bool]` Specify whether to enable the custom block page. - `footer_text: Optional[str]` Specify the block page footer text when the mode is customized_block_page. - `header_text: Optional[str]` Specify the block page header text when the mode is customized_block_page. - `include_context: Optional[bool]` Specify whether to append context to target_uri as query parameters. This applies only when the mode is redirect_uri. - `logo_path: Optional[str]` Specify the full URL to the logo file when the mode is customized_block_page. - `mailto_address: Optional[str]` Specify the admin email for users to contact when the mode is customized_block_page. - `mailto_subject: Optional[str]` Specify the subject line for emails created from the block page when the mode is customized_block_page. - `mode: Optional[Literal["", "customized_block_page", "redirect_uri"]]` Specify whether to redirect users to a Cloudflare-hosted block page or a customer-provided URI. - `""` - `"customized_block_page"` - `"redirect_uri"` - `name: Optional[str]` Specify the block page title when the mode is customized_block_page. - `read_only: Optional[bool]` Indicate that this setting was shared via the Orgs API and read only for the current account. - `source_account: Optional[str]` Indicate the account tag of the account that shared this setting. - `suppress_footer: Optional[bool]` Specify whether to suppress detailed information at the bottom of the block page when the mode is customized_block_page. - `target_uri: Optional[str]` Specify the URI to redirect users to when the mode is redirect_uri. - `version: Optional[int]` Indicate the version number of the setting. - `body_scanning: Optional[BodyScanningSettings]` Specify the DLP inspection mode. - `inspection_mode: Optional[Literal["deep", "shallow"]]` Specify the inspection mode as either `deep` or `shallow`. - `"deep"` - `"shallow"` - `browser_isolation: Optional[BrowserIsolationSettings]` Specify Clientless Browser Isolation settings. - `non_identity_enabled: Optional[bool]` Specify whether to enable non-identity onramp support for Browser Isolation. - `url_browser_isolation_enabled: Optional[bool]` Specify whether to enable Clientless Browser Isolation. - `certificate: Optional[Certificate]` Specify certificate settings for Gateway TLS interception. If unset, the Cloudflare Root CA handles interception. - `id: str` Specify the UUID of the certificate used for interception. Ensure the certificate is available at the edge(previously called 'active'). A nil UUID directs Cloudflare to use the Root CA. - `custom_certificate: Optional[CustomCertificateSettings]` Specify custom certificate settings for BYO-PKI. This field is deprecated; use `certificate` instead. - `enabled: Optional[bool]` Specify whether to enable a custom certificate authority for signing Gateway traffic. - `id: Optional[str]` Specify the UUID of the certificate (ID from MTLS certificate store). - `binding_status: Optional[str]` Indicate the internal certificate status. - `updated_at: Optional[datetime]` - `extended_email_matching: Optional[ExtendedEmailMatching]` Configures user email settings for firewall policies. When you enable this, the system standardizes email addresses in the identity portion of the rule to match extended email variants in firewall policies. When you disable this setting, the system matches email addresses exactly as you provide them. Enable this setting if your email uses `.` or `+` modifiers. - `enabled: Optional[bool]` Specify whether to match all variants of user emails (with + or . modifiers) used as criteria in Firewall policies. - `read_only: Optional[bool]` Indicate that this setting was shared via the Orgs API and read only for the current account. - `source_account: Optional[str]` Indicate the account tag of the account that shared this setting. - `version: Optional[int]` Indicate the version number of the setting. - `fips: Optional[FipsSettings]` Specify FIPS settings. - `tls: Optional[bool]` Enforce cipher suites and TLS versions compliant with FIPS 140-2. - `host_selector: Optional[HostSelector]` Enable host selection in egress policies. - `enabled: Optional[bool]` Specify whether to enable filtering via hosts for egress policies. - `inspection: Optional[Inspection]` Define the proxy inspection mode. - `mode: Optional[Literal["static", "dynamic"]]` Define the proxy inspection mode. 1. static: Gateway applies static inspection to HTTP on TCP(80). With TLS decryption on, Gateway inspects HTTPS traffic on TCP(443) and UDP(443). 2. dynamic: Gateway applies protocol detection to inspect HTTP and HTTPS traffic on any port. TLS decryption must remain on to inspect HTTPS traffic. - `"static"` - `"dynamic"` - `protocol_detection: Optional[ProtocolDetection]` Specify whether to detect protocols from the initial bytes of client traffic. - `enabled: Optional[bool]` Specify whether to detect protocols from the initial bytes of client traffic. - `sandbox: Optional[Sandbox]` Specify whether to enable the sandbox. - `enabled: Optional[bool]` Specify whether to enable the sandbox. - `fallback_action: Optional[Literal["allow", "block"]]` Specify the action to take when the system cannot scan the file. - `"allow"` - `"block"` - `tls_decrypt: Optional[TLSSettings]` Specify whether to inspect encrypted HTTP traffic. - `enabled: Optional[bool]` Specify whether to inspect encrypted HTTP traffic. - `updated_at: Optional[datetime]` ### Configuration Update Response - `class ConfigurationUpdateResponse: …` Specify account settings. - `created_at: Optional[datetime]` - `settings: Optional[GatewayConfigurationSettings]` Specify account settings. - `activity_log: Optional[ActivityLogSettings]` Specify activity log settings. - `enabled: Optional[bool]` Specify whether to log activity. - `antivirus: Optional[AntiVirusSettings]` Specify anti-virus settings. - `enabled_download_phase: Optional[bool]` Specify whether to enable anti-virus scanning on downloads. - `enabled_upload_phase: Optional[bool]` Specify whether to enable anti-virus scanning on uploads. - `fail_closed: Optional[bool]` Specify whether to block requests for unscannable files. - `notification_settings: Optional[NotificationSettings]` Configure the message the user's device shows during an antivirus scan. - `enabled: Optional[bool]` Specify whether to enable notifications. - `include_context: Optional[bool]` Specify whether to include context information as query parameters. - `msg: Optional[str]` Specify the message to show in the notification. - `support_url: Optional[str]` Specify a URL that directs users to more information. If unset, the notification opens a block page. - `block_page: Optional[BlockPageSettings]` Specify block page layout settings. - `background_color: Optional[str]` Specify the block page background color in `#rrggbb` format when the mode is customized_block_page. - `enabled: Optional[bool]` Specify whether to enable the custom block page. - `footer_text: Optional[str]` Specify the block page footer text when the mode is customized_block_page. - `header_text: Optional[str]` Specify the block page header text when the mode is customized_block_page. - `include_context: Optional[bool]` Specify whether to append context to target_uri as query parameters. This applies only when the mode is redirect_uri. - `logo_path: Optional[str]` Specify the full URL to the logo file when the mode is customized_block_page. - `mailto_address: Optional[str]` Specify the admin email for users to contact when the mode is customized_block_page. - `mailto_subject: Optional[str]` Specify the subject line for emails created from the block page when the mode is customized_block_page. - `mode: Optional[Literal["", "customized_block_page", "redirect_uri"]]` Specify whether to redirect users to a Cloudflare-hosted block page or a customer-provided URI. - `""` - `"customized_block_page"` - `"redirect_uri"` - `name: Optional[str]` Specify the block page title when the mode is customized_block_page. - `read_only: Optional[bool]` Indicate that this setting was shared via the Orgs API and read only for the current account. - `source_account: Optional[str]` Indicate the account tag of the account that shared this setting. - `suppress_footer: Optional[bool]` Specify whether to suppress detailed information at the bottom of the block page when the mode is customized_block_page. - `target_uri: Optional[str]` Specify the URI to redirect users to when the mode is redirect_uri. - `version: Optional[int]` Indicate the version number of the setting. - `body_scanning: Optional[BodyScanningSettings]` Specify the DLP inspection mode. - `inspection_mode: Optional[Literal["deep", "shallow"]]` Specify the inspection mode as either `deep` or `shallow`. - `"deep"` - `"shallow"` - `browser_isolation: Optional[BrowserIsolationSettings]` Specify Clientless Browser Isolation settings. - `non_identity_enabled: Optional[bool]` Specify whether to enable non-identity onramp support for Browser Isolation. - `url_browser_isolation_enabled: Optional[bool]` Specify whether to enable Clientless Browser Isolation. - `certificate: Optional[Certificate]` Specify certificate settings for Gateway TLS interception. If unset, the Cloudflare Root CA handles interception. - `id: str` Specify the UUID of the certificate used for interception. Ensure the certificate is available at the edge(previously called 'active'). A nil UUID directs Cloudflare to use the Root CA. - `custom_certificate: Optional[CustomCertificateSettings]` Specify custom certificate settings for BYO-PKI. This field is deprecated; use `certificate` instead. - `enabled: Optional[bool]` Specify whether to enable a custom certificate authority for signing Gateway traffic. - `id: Optional[str]` Specify the UUID of the certificate (ID from MTLS certificate store). - `binding_status: Optional[str]` Indicate the internal certificate status. - `updated_at: Optional[datetime]` - `extended_email_matching: Optional[ExtendedEmailMatching]` Configures user email settings for firewall policies. When you enable this, the system standardizes email addresses in the identity portion of the rule to match extended email variants in firewall policies. When you disable this setting, the system matches email addresses exactly as you provide them. Enable this setting if your email uses `.` or `+` modifiers. - `enabled: Optional[bool]` Specify whether to match all variants of user emails (with + or . modifiers) used as criteria in Firewall policies. - `read_only: Optional[bool]` Indicate that this setting was shared via the Orgs API and read only for the current account. - `source_account: Optional[str]` Indicate the account tag of the account that shared this setting. - `version: Optional[int]` Indicate the version number of the setting. - `fips: Optional[FipsSettings]` Specify FIPS settings. - `tls: Optional[bool]` Enforce cipher suites and TLS versions compliant with FIPS 140-2. - `host_selector: Optional[HostSelector]` Enable host selection in egress policies. - `enabled: Optional[bool]` Specify whether to enable filtering via hosts for egress policies. - `inspection: Optional[Inspection]` Define the proxy inspection mode. - `mode: Optional[Literal["static", "dynamic"]]` Define the proxy inspection mode. 1. static: Gateway applies static inspection to HTTP on TCP(80). With TLS decryption on, Gateway inspects HTTPS traffic on TCP(443) and UDP(443). 2. dynamic: Gateway applies protocol detection to inspect HTTP and HTTPS traffic on any port. TLS decryption must remain on to inspect HTTPS traffic. - `"static"` - `"dynamic"` - `protocol_detection: Optional[ProtocolDetection]` Specify whether to detect protocols from the initial bytes of client traffic. - `enabled: Optional[bool]` Specify whether to detect protocols from the initial bytes of client traffic. - `sandbox: Optional[Sandbox]` Specify whether to enable the sandbox. - `enabled: Optional[bool]` Specify whether to enable the sandbox. - `fallback_action: Optional[Literal["allow", "block"]]` Specify the action to take when the system cannot scan the file. - `"allow"` - `"block"` - `tls_decrypt: Optional[TLSSettings]` Specify whether to inspect encrypted HTTP traffic. - `enabled: Optional[bool]` Specify whether to inspect encrypted HTTP traffic. - `updated_at: Optional[datetime]` ### Configuration Edit Response - `class ConfigurationEditResponse: …` Specify account settings. - `created_at: Optional[datetime]` - `settings: Optional[GatewayConfigurationSettings]` Specify account settings. - `activity_log: Optional[ActivityLogSettings]` Specify activity log settings. - `enabled: Optional[bool]` Specify whether to log activity. - `antivirus: Optional[AntiVirusSettings]` Specify anti-virus settings. - `enabled_download_phase: Optional[bool]` Specify whether to enable anti-virus scanning on downloads. - `enabled_upload_phase: Optional[bool]` Specify whether to enable anti-virus scanning on uploads. - `fail_closed: Optional[bool]` Specify whether to block requests for unscannable files. - `notification_settings: Optional[NotificationSettings]` Configure the message the user's device shows during an antivirus scan. - `enabled: Optional[bool]` Specify whether to enable notifications. - `include_context: Optional[bool]` Specify whether to include context information as query parameters. - `msg: Optional[str]` Specify the message to show in the notification. - `support_url: Optional[str]` Specify a URL that directs users to more information. If unset, the notification opens a block page. - `block_page: Optional[BlockPageSettings]` Specify block page layout settings. - `background_color: Optional[str]` Specify the block page background color in `#rrggbb` format when the mode is customized_block_page. - `enabled: Optional[bool]` Specify whether to enable the custom block page. - `footer_text: Optional[str]` Specify the block page footer text when the mode is customized_block_page. - `header_text: Optional[str]` Specify the block page header text when the mode is customized_block_page. - `include_context: Optional[bool]` Specify whether to append context to target_uri as query parameters. This applies only when the mode is redirect_uri. - `logo_path: Optional[str]` Specify the full URL to the logo file when the mode is customized_block_page. - `mailto_address: Optional[str]` Specify the admin email for users to contact when the mode is customized_block_page. - `mailto_subject: Optional[str]` Specify the subject line for emails created from the block page when the mode is customized_block_page. - `mode: Optional[Literal["", "customized_block_page", "redirect_uri"]]` Specify whether to redirect users to a Cloudflare-hosted block page or a customer-provided URI. - `""` - `"customized_block_page"` - `"redirect_uri"` - `name: Optional[str]` Specify the block page title when the mode is customized_block_page. - `read_only: Optional[bool]` Indicate that this setting was shared via the Orgs API and read only for the current account. - `source_account: Optional[str]` Indicate the account tag of the account that shared this setting. - `suppress_footer: Optional[bool]` Specify whether to suppress detailed information at the bottom of the block page when the mode is customized_block_page. - `target_uri: Optional[str]` Specify the URI to redirect users to when the mode is redirect_uri. - `version: Optional[int]` Indicate the version number of the setting. - `body_scanning: Optional[BodyScanningSettings]` Specify the DLP inspection mode. - `inspection_mode: Optional[Literal["deep", "shallow"]]` Specify the inspection mode as either `deep` or `shallow`. - `"deep"` - `"shallow"` - `browser_isolation: Optional[BrowserIsolationSettings]` Specify Clientless Browser Isolation settings. - `non_identity_enabled: Optional[bool]` Specify whether to enable non-identity onramp support for Browser Isolation. - `url_browser_isolation_enabled: Optional[bool]` Specify whether to enable Clientless Browser Isolation. - `certificate: Optional[Certificate]` Specify certificate settings for Gateway TLS interception. If unset, the Cloudflare Root CA handles interception. - `id: str` Specify the UUID of the certificate used for interception. Ensure the certificate is available at the edge(previously called 'active'). A nil UUID directs Cloudflare to use the Root CA. - `custom_certificate: Optional[CustomCertificateSettings]` Specify custom certificate settings for BYO-PKI. This field is deprecated; use `certificate` instead. - `enabled: Optional[bool]` Specify whether to enable a custom certificate authority for signing Gateway traffic. - `id: Optional[str]` Specify the UUID of the certificate (ID from MTLS certificate store). - `binding_status: Optional[str]` Indicate the internal certificate status. - `updated_at: Optional[datetime]` - `extended_email_matching: Optional[ExtendedEmailMatching]` Configures user email settings for firewall policies. When you enable this, the system standardizes email addresses in the identity portion of the rule to match extended email variants in firewall policies. When you disable this setting, the system matches email addresses exactly as you provide them. Enable this setting if your email uses `.` or `+` modifiers. - `enabled: Optional[bool]` Specify whether to match all variants of user emails (with + or . modifiers) used as criteria in Firewall policies. - `read_only: Optional[bool]` Indicate that this setting was shared via the Orgs API and read only for the current account. - `source_account: Optional[str]` Indicate the account tag of the account that shared this setting. - `version: Optional[int]` Indicate the version number of the setting. - `fips: Optional[FipsSettings]` Specify FIPS settings. - `tls: Optional[bool]` Enforce cipher suites and TLS versions compliant with FIPS 140-2. - `host_selector: Optional[HostSelector]` Enable host selection in egress policies. - `enabled: Optional[bool]` Specify whether to enable filtering via hosts for egress policies. - `inspection: Optional[Inspection]` Define the proxy inspection mode. - `mode: Optional[Literal["static", "dynamic"]]` Define the proxy inspection mode. 1. static: Gateway applies static inspection to HTTP on TCP(80). With TLS decryption on, Gateway inspects HTTPS traffic on TCP(443) and UDP(443). 2. dynamic: Gateway applies protocol detection to inspect HTTP and HTTPS traffic on any port. TLS decryption must remain on to inspect HTTPS traffic. - `"static"` - `"dynamic"` - `protocol_detection: Optional[ProtocolDetection]` Specify whether to detect protocols from the initial bytes of client traffic. - `enabled: Optional[bool]` Specify whether to detect protocols from the initial bytes of client traffic. - `sandbox: Optional[Sandbox]` Specify whether to enable the sandbox. - `enabled: Optional[bool]` Specify whether to enable the sandbox. - `fallback_action: Optional[Literal["allow", "block"]]` Specify the action to take when the system cannot scan the file. - `"allow"` - `"block"` - `tls_decrypt: Optional[TLSSettings]` Specify whether to inspect encrypted HTTP traffic. - `enabled: Optional[bool]` Specify whether to inspect encrypted HTTP traffic. - `updated_at: Optional[datetime]` # Custom Certificate ## Get Zero Trust certificate configuration `zero_trust.gateway.configurations.custom_certificate.get(CustomCertificateGetParams**kwargs) -> CustomCertificateSettings` **get** `/accounts/{account_id}/gateway/configuration/custom_certificate` Retrieve the current Zero Trust certificate configuration. ### Parameters - `account_id: str` ### Returns - `class CustomCertificateSettings: …` Specify custom certificate settings for BYO-PKI. This field is deprecated; use `certificate` instead. - `enabled: Optional[bool]` Specify whether to enable a custom certificate authority for signing Gateway traffic. - `id: Optional[str]` Specify the UUID of the certificate (ID from MTLS certificate store). - `binding_status: Optional[str]` Indicate the internal certificate status. - `updated_at: Optional[datetime]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) custom_certificate_settings = client.zero_trust.gateway.configurations.custom_certificate.get( account_id="699d98642c564d2e855e9661899b7252", ) print(custom_certificate_settings.id) ``` #### Response ```json { "enabled": true, "id": "d1b364c5-1311-466e-a194-f0e943e0799f", "binding_status": "pending_deployment", "updated_at": "2019-12-27T18:11:19.117Z" } ``` # Lists ## List Zero Trust lists `zero_trust.gateway.lists.list(ListListParams**kwargs) -> SyncSinglePage[GatewayList]` **get** `/accounts/{account_id}/gateway/lists` Fetch all Zero Trust lists for an account. ### Parameters - `account_id: str` - `type: Optional[Literal["SERIAL", "URL", "DOMAIN", 5 more]]` Specify the list type. - `"SERIAL"` - `"URL"` - `"DOMAIN"` - `"EMAIL"` - `"IP"` - `"CATEGORY"` - `"LOCATION"` - `"DEVICE"` ### Returns - `class GatewayList: …` - `id: Optional[str]` Identify the API resource with a UUID. - `count: Optional[float]` Indicate the number of items in the list. - `created_at: Optional[datetime]` - `description: Optional[str]` Provide the list description. - `items: Optional[List[GatewayItem]]` Provide the list items. - `created_at: Optional[datetime]` - `description: Optional[str]` Provide the list item description (optional). - `value: Optional[str]` Specify the item value. - `name: Optional[str]` Specify the list name. - `type: Optional[Literal["SERIAL", "URL", "DOMAIN", 5 more]]` Specify the list type. - `"SERIAL"` - `"URL"` - `"DOMAIN"` - `"EMAIL"` - `"IP"` - `"CATEGORY"` - `"LOCATION"` - `"DEVICE"` - `updated_at: Optional[datetime]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.zero_trust.gateway.lists.list( account_id="699d98642c564d2e855e9661899b7252", ) page = page.result[0] print(page.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "count": 20, "created_at": "2014-01-01T05:20:00.12345Z", "description": "The serial numbers for administrators", "items": [ { "created_at": "2014-01-01T05:20:00.12345Z", "description": "Austin office IP", "value": "8GE8721REF" } ], "name": "Admin Serial Numbers", "type": "SERIAL", "updated_at": "2014-01-01T05:20:00.12345Z" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Get Zero Trust list details `zero_trust.gateway.lists.get(strlist_id, ListGetParams**kwargs) -> GatewayList` **get** `/accounts/{account_id}/gateway/lists/{list_id}` Fetch a single Zero Trust list. ### Parameters - `account_id: str` - `list_id: str` Identify the API resource with a UUID. ### Returns - `class GatewayList: …` - `id: Optional[str]` Identify the API resource with a UUID. - `count: Optional[float]` Indicate the number of items in the list. - `created_at: Optional[datetime]` - `description: Optional[str]` Provide the list description. - `items: Optional[List[GatewayItem]]` Provide the list items. - `created_at: Optional[datetime]` - `description: Optional[str]` Provide the list item description (optional). - `value: Optional[str]` Specify the item value. - `name: Optional[str]` Specify the list name. - `type: Optional[Literal["SERIAL", "URL", "DOMAIN", 5 more]]` Specify the list type. - `"SERIAL"` - `"URL"` - `"DOMAIN"` - `"EMAIL"` - `"IP"` - `"CATEGORY"` - `"LOCATION"` - `"DEVICE"` - `updated_at: Optional[datetime]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) gateway_list = client.zero_trust.gateway.lists.get( list_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) print(gateway_list.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "count": 20, "created_at": "2014-01-01T05:20:00.12345Z", "description": "The serial numbers for administrators", "items": [ { "created_at": "2014-01-01T05:20:00.12345Z", "description": "Austin office IP", "value": "8GE8721REF" } ], "name": "Admin Serial Numbers", "type": "SERIAL", "updated_at": "2014-01-01T05:20:00.12345Z" } } ``` ## Create Zero Trust list `zero_trust.gateway.lists.create(ListCreateParams**kwargs) -> ListCreateResponse` **post** `/accounts/{account_id}/gateway/lists` Creates a new Zero Trust list. ### Parameters - `account_id: str` - `name: str` Specify the list name. - `type: Literal["SERIAL", "URL", "DOMAIN", 5 more]` Specify the list type. - `"SERIAL"` - `"URL"` - `"DOMAIN"` - `"EMAIL"` - `"IP"` - `"CATEGORY"` - `"LOCATION"` - `"DEVICE"` - `description: Optional[str]` Provide the list description. - `items: Optional[Iterable[Item]]` Add items to the list. - `description: Optional[str]` Provide the list item description (optional). - `value: Optional[str]` Specify the item value. ### Returns - `class ListCreateResponse: …` - `id: Optional[str]` Identify the API resource with a UUID. - `created_at: Optional[datetime]` - `description: Optional[str]` Provide the list description. - `items: Optional[List[GatewayItem]]` Provide the list items. - `created_at: Optional[datetime]` - `description: Optional[str]` Provide the list item description (optional). - `value: Optional[str]` Specify the item value. - `name: Optional[str]` Specify the list name. - `type: Optional[Literal["SERIAL", "URL", "DOMAIN", 5 more]]` Specify the list type. - `"SERIAL"` - `"URL"` - `"DOMAIN"` - `"EMAIL"` - `"IP"` - `"CATEGORY"` - `"LOCATION"` - `"DEVICE"` - `updated_at: Optional[datetime]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) list = client.zero_trust.gateway.lists.create( account_id="699d98642c564d2e855e9661899b7252", name="Admin Serial Numbers", type="SERIAL", ) print(list.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "created_at": "2014-01-01T05:20:00.12345Z", "description": "The serial numbers for administrators", "items": [ { "created_at": "2014-01-01T05:20:00.12345Z", "description": "Austin office IP", "value": "8GE8721REF" } ], "name": "Admin Serial Numbers", "type": "SERIAL", "updated_at": "2014-01-01T05:20:00.12345Z" } } ``` ## Update Zero Trust list `zero_trust.gateway.lists.update(strlist_id, ListUpdateParams**kwargs) -> GatewayList` **put** `/accounts/{account_id}/gateway/lists/{list_id}` Updates a configured Zero Trust list. Skips updating list items if not included in the payload. A non empty list items will overwrite the existing list. ### Parameters - `account_id: str` - `list_id: str` Identify the API resource with a UUID. - `name: str` Specify the list name. - `description: Optional[str]` Provide the list description. - `items: Optional[Iterable[Item]]` Add items to the list. - `description: Optional[str]` Provide the list item description (optional). - `value: Optional[str]` Specify the item value. ### Returns - `class GatewayList: …` - `id: Optional[str]` Identify the API resource with a UUID. - `count: Optional[float]` Indicate the number of items in the list. - `created_at: Optional[datetime]` - `description: Optional[str]` Provide the list description. - `items: Optional[List[GatewayItem]]` Provide the list items. - `created_at: Optional[datetime]` - `description: Optional[str]` Provide the list item description (optional). - `value: Optional[str]` Specify the item value. - `name: Optional[str]` Specify the list name. - `type: Optional[Literal["SERIAL", "URL", "DOMAIN", 5 more]]` Specify the list type. - `"SERIAL"` - `"URL"` - `"DOMAIN"` - `"EMAIL"` - `"IP"` - `"CATEGORY"` - `"LOCATION"` - `"DEVICE"` - `updated_at: Optional[datetime]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) gateway_list = client.zero_trust.gateway.lists.update( list_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", name="Admin Serial Numbers", ) print(gateway_list.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "count": 20, "created_at": "2014-01-01T05:20:00.12345Z", "description": "The serial numbers for administrators", "items": [ { "created_at": "2014-01-01T05:20:00.12345Z", "description": "Austin office IP", "value": "8GE8721REF" } ], "name": "Admin Serial Numbers", "type": "SERIAL", "updated_at": "2014-01-01T05:20:00.12345Z" } } ``` ## Patch Zero Trust list. `zero_trust.gateway.lists.edit(strlist_id, ListEditParams**kwargs) -> GatewayList` **patch** `/accounts/{account_id}/gateway/lists/{list_id}` Appends or removes an item from a configured Zero Trust list. ### Parameters - `account_id: str` - `list_id: str` Identify the API resource with a UUID. - `append: Optional[Iterable[Append]]` Add items to the list. - `description: Optional[str]` Provide the list item description (optional). - `value: Optional[str]` Specify the item value. - `remove: Optional[SequenceNotStr[str]]` Lists of item values you want to remove. ### Returns - `class GatewayList: …` - `id: Optional[str]` Identify the API resource with a UUID. - `count: Optional[float]` Indicate the number of items in the list. - `created_at: Optional[datetime]` - `description: Optional[str]` Provide the list description. - `items: Optional[List[GatewayItem]]` Provide the list items. - `created_at: Optional[datetime]` - `description: Optional[str]` Provide the list item description (optional). - `value: Optional[str]` Specify the item value. - `name: Optional[str]` Specify the list name. - `type: Optional[Literal["SERIAL", "URL", "DOMAIN", 5 more]]` Specify the list type. - `"SERIAL"` - `"URL"` - `"DOMAIN"` - `"EMAIL"` - `"IP"` - `"CATEGORY"` - `"LOCATION"` - `"DEVICE"` - `updated_at: Optional[datetime]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) gateway_list = client.zero_trust.gateway.lists.edit( list_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) print(gateway_list.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "count": 20, "created_at": "2014-01-01T05:20:00.12345Z", "description": "The serial numbers for administrators", "items": [ { "created_at": "2014-01-01T05:20:00.12345Z", "description": "Austin office IP", "value": "8GE8721REF" } ], "name": "Admin Serial Numbers", "type": "SERIAL", "updated_at": "2014-01-01T05:20:00.12345Z" } } ``` ## Delete Zero Trust list `zero_trust.gateway.lists.delete(strlist_id, ListDeleteParams**kwargs) -> object` **delete** `/accounts/{account_id}/gateway/lists/{list_id}` Deletes a Zero Trust list. ### Parameters - `account_id: str` - `list_id: str` Identify the API resource with a UUID. ### Returns - `object` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) list = client.zero_trust.gateway.lists.delete( list_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) print(list) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": {} } ``` ## Domain Types ### Gateway Item - `class GatewayItem: …` - `created_at: Optional[datetime]` - `description: Optional[str]` Provide the list item description (optional). - `value: Optional[str]` Specify the item value. ### Gateway List - `class GatewayList: …` - `id: Optional[str]` Identify the API resource with a UUID. - `count: Optional[float]` Indicate the number of items in the list. - `created_at: Optional[datetime]` - `description: Optional[str]` Provide the list description. - `items: Optional[List[GatewayItem]]` Provide the list items. - `created_at: Optional[datetime]` - `description: Optional[str]` Provide the list item description (optional). - `value: Optional[str]` Specify the item value. - `name: Optional[str]` Specify the list name. - `type: Optional[Literal["SERIAL", "URL", "DOMAIN", 5 more]]` Specify the list type. - `"SERIAL"` - `"URL"` - `"DOMAIN"` - `"EMAIL"` - `"IP"` - `"CATEGORY"` - `"LOCATION"` - `"DEVICE"` - `updated_at: Optional[datetime]` ### List Create Response - `class ListCreateResponse: …` - `id: Optional[str]` Identify the API resource with a UUID. - `created_at: Optional[datetime]` - `description: Optional[str]` Provide the list description. - `items: Optional[List[GatewayItem]]` Provide the list items. - `created_at: Optional[datetime]` - `description: Optional[str]` Provide the list item description (optional). - `value: Optional[str]` Specify the item value. - `name: Optional[str]` Specify the list name. - `type: Optional[Literal["SERIAL", "URL", "DOMAIN", 5 more]]` Specify the list type. - `"SERIAL"` - `"URL"` - `"DOMAIN"` - `"EMAIL"` - `"IP"` - `"CATEGORY"` - `"LOCATION"` - `"DEVICE"` - `updated_at: Optional[datetime]` # Items ## Get Zero Trust list items `zero_trust.gateway.lists.items.list(strlist_id, ItemListParams**kwargs) -> SyncSinglePage[ItemListResponse]` **get** `/accounts/{account_id}/gateway/lists/{list_id}/items` Fetch all items in a single Zero Trust list. ### Parameters - `account_id: str` - `list_id: str` Identify the API resource with a UUID. ### Returns - `List[GatewayItem]` Provide the list items. - `created_at: Optional[datetime]` - `description: Optional[str]` Provide the list item description (optional). - `value: Optional[str]` Specify the item value. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.zero_trust.gateway.lists.items.list( list_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) page = page.result[0] print(page) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ [ { "created_at": "2014-01-01T05:20:00.12345Z", "description": "Austin office IP", "value": "8GE8721REF" } ] ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Domain Types ### Item List Response - `List[GatewayItem]` Provide the list items. - `created_at: Optional[datetime]` - `description: Optional[str]` Provide the list item description (optional). - `value: Optional[str]` Specify the item value. # Locations ## List Zero Trust Gateway locations `zero_trust.gateway.locations.list(LocationListParams**kwargs) -> SyncSinglePage[Location]` **get** `/accounts/{account_id}/gateway/locations` List Zero Trust Gateway locations for an account. ### Parameters - `account_id: str` ### Returns - `class Location: …` - `id: Optional[str]` - `client_default: Optional[bool]` Indicate whether this location is the default location. - `created_at: Optional[datetime]` - `dns_destination_ips_id: Optional[str]` Indicate the identifier of the pair of IPv4 addresses assigned to this location. - `dns_destination_ipv6_block_id: Optional[str]` Specify the UUID of the IPv6 block brought to the gateway so that this location's IPv6 address is allocated from the Bring Your Own IPv6 (BYOIPv6) block rather than the standard Cloudflare IPv6 block. - `doh_subdomain: Optional[str]` Specify the DNS over HTTPS domain that receives DNS requests. Gateway automatically generates this value. - `ecs_support: Optional[bool]` Indicate whether the location must resolve EDNS queries. - `endpoints: Optional[Endpoint]` Configure the destination endpoints for this location. - `doh: DOHEndpoint` - `enabled: Optional[bool]` Indicate whether the DOH endpoint is enabled for this location. - `networks: Optional[List[IPNetwork]]` Specify the list of allowed source IP network ranges for this endpoint. When the list is empty, the endpoint allows all source IPs. The list takes effect only if the endpoint is enabled for this location. - `network: str` Specify the IP address or IP CIDR. - `require_token: Optional[bool]` Specify whether the DOH endpoint requires user identity authentication. - `dot: DOTEndpoint` - `enabled: Optional[bool]` Indicate whether the DOT endpoint is enabled for this location. - `networks: Optional[List[IPNetwork]]` Specify the list of allowed source IP network ranges for this endpoint. When the list is empty, the endpoint allows all source IPs. The list takes effect only if the endpoint is enabled for this location. - `network: str` Specify the IP address or IP CIDR. - `ipv4: IPV4Endpoint` - `enabled: Optional[bool]` Indicate whether the IPv4 endpoint is enabled for this location. - `ipv6: IPV6Endpoint` - `enabled: Optional[bool]` Indicate whether the IPV6 endpoint is enabled for this location. - `networks: Optional[List[IPV6Network]]` Specify the list of allowed source IPv6 network ranges for this endpoint. When the list is empty, the endpoint allows all source IPs. The list takes effect only if the endpoint is enabled for this location. - `network: str` Specify the IPv6 address or IPv6 CIDR. - `ip: Optional[str]` Defines the automatically generated IPv6 destination IP assigned to this location. Gateway counts all DNS requests sent to this IP as requests under this location. - `ipv4_destination: Optional[str]` Show the primary destination IPv4 address from the pair identified dns_destination_ips_id. This field read-only. - `ipv4_destination_backup: Optional[str]` Show the backup destination IPv4 address from the pair identified dns_destination_ips_id. This field read-only. - `name: Optional[str]` Specify the location name. - `networks: Optional[List[Network]]` Specify the list of network ranges from which requests at this location originate. The list takes effect only if it is non-empty and the IPv4 endpoint is enabled for this location. - `network: str` Specify the IPv4 address or IPv4 CIDR. Limit IPv4 CIDRs to a maximum of /24. - `updated_at: Optional[datetime]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.zero_trust.gateway.locations.list( account_id="699d98642c564d2e855e9661899b7252", ) page = page.result[0] print(page.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "id": "ed35569b41ce4d1facfe683550f54086", "client_default": false, "created_at": "2014-01-01T05:20:00.12345Z", "dns_destination_ips_id": "0e4a32c6-6fb8-4858-9296-98f51631e8e6", "dns_destination_ipv6_block_id": "b08f7231-d458-495c-98ef-190604c9ee83", "doh_subdomain": "oli3n9zkz5", "ecs_support": false, "endpoints": { "doh": { "enabled": true, "networks": [ { "network": "2001:85a3::/64" } ], "require_token": true }, "dot": { "enabled": true, "networks": [ { "network": "2001:85a3::/64" } ] }, "ipv4": { "enabled": true }, "ipv6": { "enabled": true, "networks": [ { "network": "2001:85a3::/64" } ] } }, "ip": "2001:0db8:85a3:0000:0000:8a2e:0370:7334", "ipv4_destination": "172.64.36.1", "ipv4_destination_backup": "172.64.36.2", "name": "Austin Office Location", "networks": [ { "network": "192.0.2.1/32" } ], "updated_at": "2014-01-01T05:20:00.12345Z" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Get Zero Trust Gateway location details `zero_trust.gateway.locations.get(strlocation_id, LocationGetParams**kwargs) -> Location` **get** `/accounts/{account_id}/gateway/locations/{location_id}` Get a single Zero Trust Gateway location. ### Parameters - `account_id: str` - `location_id: str` ### Returns - `class Location: …` - `id: Optional[str]` - `client_default: Optional[bool]` Indicate whether this location is the default location. - `created_at: Optional[datetime]` - `dns_destination_ips_id: Optional[str]` Indicate the identifier of the pair of IPv4 addresses assigned to this location. - `dns_destination_ipv6_block_id: Optional[str]` Specify the UUID of the IPv6 block brought to the gateway so that this location's IPv6 address is allocated from the Bring Your Own IPv6 (BYOIPv6) block rather than the standard Cloudflare IPv6 block. - `doh_subdomain: Optional[str]` Specify the DNS over HTTPS domain that receives DNS requests. Gateway automatically generates this value. - `ecs_support: Optional[bool]` Indicate whether the location must resolve EDNS queries. - `endpoints: Optional[Endpoint]` Configure the destination endpoints for this location. - `doh: DOHEndpoint` - `enabled: Optional[bool]` Indicate whether the DOH endpoint is enabled for this location. - `networks: Optional[List[IPNetwork]]` Specify the list of allowed source IP network ranges for this endpoint. When the list is empty, the endpoint allows all source IPs. The list takes effect only if the endpoint is enabled for this location. - `network: str` Specify the IP address or IP CIDR. - `require_token: Optional[bool]` Specify whether the DOH endpoint requires user identity authentication. - `dot: DOTEndpoint` - `enabled: Optional[bool]` Indicate whether the DOT endpoint is enabled for this location. - `networks: Optional[List[IPNetwork]]` Specify the list of allowed source IP network ranges for this endpoint. When the list is empty, the endpoint allows all source IPs. The list takes effect only if the endpoint is enabled for this location. - `network: str` Specify the IP address or IP CIDR. - `ipv4: IPV4Endpoint` - `enabled: Optional[bool]` Indicate whether the IPv4 endpoint is enabled for this location. - `ipv6: IPV6Endpoint` - `enabled: Optional[bool]` Indicate whether the IPV6 endpoint is enabled for this location. - `networks: Optional[List[IPV6Network]]` Specify the list of allowed source IPv6 network ranges for this endpoint. When the list is empty, the endpoint allows all source IPs. The list takes effect only if the endpoint is enabled for this location. - `network: str` Specify the IPv6 address or IPv6 CIDR. - `ip: Optional[str]` Defines the automatically generated IPv6 destination IP assigned to this location. Gateway counts all DNS requests sent to this IP as requests under this location. - `ipv4_destination: Optional[str]` Show the primary destination IPv4 address from the pair identified dns_destination_ips_id. This field read-only. - `ipv4_destination_backup: Optional[str]` Show the backup destination IPv4 address from the pair identified dns_destination_ips_id. This field read-only. - `name: Optional[str]` Specify the location name. - `networks: Optional[List[Network]]` Specify the list of network ranges from which requests at this location originate. The list takes effect only if it is non-empty and the IPv4 endpoint is enabled for this location. - `network: str` Specify the IPv4 address or IPv4 CIDR. Limit IPv4 CIDRs to a maximum of /24. - `updated_at: Optional[datetime]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) location = client.zero_trust.gateway.locations.get( location_id="ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", ) print(location.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "ed35569b41ce4d1facfe683550f54086", "client_default": false, "created_at": "2014-01-01T05:20:00.12345Z", "dns_destination_ips_id": "0e4a32c6-6fb8-4858-9296-98f51631e8e6", "dns_destination_ipv6_block_id": "b08f7231-d458-495c-98ef-190604c9ee83", "doh_subdomain": "oli3n9zkz5", "ecs_support": false, "endpoints": { "doh": { "enabled": true, "networks": [ { "network": "2001:85a3::/64" } ], "require_token": true }, "dot": { "enabled": true, "networks": [ { "network": "2001:85a3::/64" } ] }, "ipv4": { "enabled": true }, "ipv6": { "enabled": true, "networks": [ { "network": "2001:85a3::/64" } ] } }, "ip": "2001:0db8:85a3:0000:0000:8a2e:0370:7334", "ipv4_destination": "172.64.36.1", "ipv4_destination_backup": "172.64.36.2", "name": "Austin Office Location", "networks": [ { "network": "192.0.2.1/32" } ], "updated_at": "2014-01-01T05:20:00.12345Z" } } ``` ## Create a Zero Trust Gateway location `zero_trust.gateway.locations.create(LocationCreateParams**kwargs) -> Location` **post** `/accounts/{account_id}/gateway/locations` Create a new Zero Trust Gateway location. ### Parameters - `account_id: str` - `name: str` Specify the location name. - `client_default: Optional[bool]` Indicate whether this location is the default location. - `dns_destination_ips_id: Optional[str]` Specify the identifier of the pair of IPv4 addresses assigned to this location. When creating a location, if this field is absent or set to null, the pair of shared IPv4 addresses (0e4a32c6-6fb8-4858-9296-98f51631e8e6) is auto-assigned. When updating a location, if this field is absent or set to null, the pre-assigned pair remains unchanged. - `ecs_support: Optional[bool]` Indicate whether the location must resolve EDNS queries. - `endpoints: Optional[EndpointParam]` Configure the destination endpoints for this location. - `doh: DOHEndpoint` - `enabled: Optional[bool]` Indicate whether the DOH endpoint is enabled for this location. - `networks: Optional[List[IPNetwork]]` Specify the list of allowed source IP network ranges for this endpoint. When the list is empty, the endpoint allows all source IPs. The list takes effect only if the endpoint is enabled for this location. - `network: str` Specify the IP address or IP CIDR. - `require_token: Optional[bool]` Specify whether the DOH endpoint requires user identity authentication. - `dot: DOTEndpoint` - `enabled: Optional[bool]` Indicate whether the DOT endpoint is enabled for this location. - `networks: Optional[List[IPNetwork]]` Specify the list of allowed source IP network ranges for this endpoint. When the list is empty, the endpoint allows all source IPs. The list takes effect only if the endpoint is enabled for this location. - `network: str` Specify the IP address or IP CIDR. - `ipv4: IPV4Endpoint` - `enabled: Optional[bool]` Indicate whether the IPv4 endpoint is enabled for this location. - `ipv6: IPV6Endpoint` - `enabled: Optional[bool]` Indicate whether the IPV6 endpoint is enabled for this location. - `networks: Optional[List[IPV6Network]]` Specify the list of allowed source IPv6 network ranges for this endpoint. When the list is empty, the endpoint allows all source IPs. The list takes effect only if the endpoint is enabled for this location. - `network: str` Specify the IPv6 address or IPv6 CIDR. - `networks: Optional[Iterable[Network]]` Specify the list of network ranges from which requests at this location originate. The list takes effect only if it is non-empty and the IPv4 endpoint is enabled for this location. - `network: str` Specify the IPv4 address or IPv4 CIDR. Limit IPv4 CIDRs to a maximum of /24. ### Returns - `class Location: …` - `id: Optional[str]` - `client_default: Optional[bool]` Indicate whether this location is the default location. - `created_at: Optional[datetime]` - `dns_destination_ips_id: Optional[str]` Indicate the identifier of the pair of IPv4 addresses assigned to this location. - `dns_destination_ipv6_block_id: Optional[str]` Specify the UUID of the IPv6 block brought to the gateway so that this location's IPv6 address is allocated from the Bring Your Own IPv6 (BYOIPv6) block rather than the standard Cloudflare IPv6 block. - `doh_subdomain: Optional[str]` Specify the DNS over HTTPS domain that receives DNS requests. Gateway automatically generates this value. - `ecs_support: Optional[bool]` Indicate whether the location must resolve EDNS queries. - `endpoints: Optional[Endpoint]` Configure the destination endpoints for this location. - `doh: DOHEndpoint` - `enabled: Optional[bool]` Indicate whether the DOH endpoint is enabled for this location. - `networks: Optional[List[IPNetwork]]` Specify the list of allowed source IP network ranges for this endpoint. When the list is empty, the endpoint allows all source IPs. The list takes effect only if the endpoint is enabled for this location. - `network: str` Specify the IP address or IP CIDR. - `require_token: Optional[bool]` Specify whether the DOH endpoint requires user identity authentication. - `dot: DOTEndpoint` - `enabled: Optional[bool]` Indicate whether the DOT endpoint is enabled for this location. - `networks: Optional[List[IPNetwork]]` Specify the list of allowed source IP network ranges for this endpoint. When the list is empty, the endpoint allows all source IPs. The list takes effect only if the endpoint is enabled for this location. - `network: str` Specify the IP address or IP CIDR. - `ipv4: IPV4Endpoint` - `enabled: Optional[bool]` Indicate whether the IPv4 endpoint is enabled for this location. - `ipv6: IPV6Endpoint` - `enabled: Optional[bool]` Indicate whether the IPV6 endpoint is enabled for this location. - `networks: Optional[List[IPV6Network]]` Specify the list of allowed source IPv6 network ranges for this endpoint. When the list is empty, the endpoint allows all source IPs. The list takes effect only if the endpoint is enabled for this location. - `network: str` Specify the IPv6 address or IPv6 CIDR. - `ip: Optional[str]` Defines the automatically generated IPv6 destination IP assigned to this location. Gateway counts all DNS requests sent to this IP as requests under this location. - `ipv4_destination: Optional[str]` Show the primary destination IPv4 address from the pair identified dns_destination_ips_id. This field read-only. - `ipv4_destination_backup: Optional[str]` Show the backup destination IPv4 address from the pair identified dns_destination_ips_id. This field read-only. - `name: Optional[str]` Specify the location name. - `networks: Optional[List[Network]]` Specify the list of network ranges from which requests at this location originate. The list takes effect only if it is non-empty and the IPv4 endpoint is enabled for this location. - `network: str` Specify the IPv4 address or IPv4 CIDR. Limit IPv4 CIDRs to a maximum of /24. - `updated_at: Optional[datetime]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) location = client.zero_trust.gateway.locations.create( account_id="699d98642c564d2e855e9661899b7252", name="Austin Office Location", ) print(location.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "ed35569b41ce4d1facfe683550f54086", "client_default": false, "created_at": "2014-01-01T05:20:00.12345Z", "dns_destination_ips_id": "0e4a32c6-6fb8-4858-9296-98f51631e8e6", "dns_destination_ipv6_block_id": "b08f7231-d458-495c-98ef-190604c9ee83", "doh_subdomain": "oli3n9zkz5", "ecs_support": false, "endpoints": { "doh": { "enabled": true, "networks": [ { "network": "2001:85a3::/64" } ], "require_token": true }, "dot": { "enabled": true, "networks": [ { "network": "2001:85a3::/64" } ] }, "ipv4": { "enabled": true }, "ipv6": { "enabled": true, "networks": [ { "network": "2001:85a3::/64" } ] } }, "ip": "2001:0db8:85a3:0000:0000:8a2e:0370:7334", "ipv4_destination": "172.64.36.1", "ipv4_destination_backup": "172.64.36.2", "name": "Austin Office Location", "networks": [ { "network": "192.0.2.1/32" } ], "updated_at": "2014-01-01T05:20:00.12345Z" } } ``` ## Update a Zero Trust Gateway location `zero_trust.gateway.locations.update(strlocation_id, LocationUpdateParams**kwargs) -> Location` **put** `/accounts/{account_id}/gateway/locations/{location_id}` Update a configured Zero Trust Gateway location. ### Parameters - `account_id: str` - `location_id: str` - `name: str` Specify the location name. - `client_default: Optional[bool]` Indicate whether this location is the default location. - `dns_destination_ips_id: Optional[str]` Specify the identifier of the pair of IPv4 addresses assigned to this location. When creating a location, if this field is absent or set to null, the pair of shared IPv4 addresses (0e4a32c6-6fb8-4858-9296-98f51631e8e6) is auto-assigned. When updating a location, if this field is absent or set to null, the pre-assigned pair remains unchanged. - `ecs_support: Optional[bool]` Indicate whether the location must resolve EDNS queries. - `endpoints: Optional[EndpointParam]` Configure the destination endpoints for this location. - `doh: DOHEndpoint` - `enabled: Optional[bool]` Indicate whether the DOH endpoint is enabled for this location. - `networks: Optional[List[IPNetwork]]` Specify the list of allowed source IP network ranges for this endpoint. When the list is empty, the endpoint allows all source IPs. The list takes effect only if the endpoint is enabled for this location. - `network: str` Specify the IP address or IP CIDR. - `require_token: Optional[bool]` Specify whether the DOH endpoint requires user identity authentication. - `dot: DOTEndpoint` - `enabled: Optional[bool]` Indicate whether the DOT endpoint is enabled for this location. - `networks: Optional[List[IPNetwork]]` Specify the list of allowed source IP network ranges for this endpoint. When the list is empty, the endpoint allows all source IPs. The list takes effect only if the endpoint is enabled for this location. - `network: str` Specify the IP address or IP CIDR. - `ipv4: IPV4Endpoint` - `enabled: Optional[bool]` Indicate whether the IPv4 endpoint is enabled for this location. - `ipv6: IPV6Endpoint` - `enabled: Optional[bool]` Indicate whether the IPV6 endpoint is enabled for this location. - `networks: Optional[List[IPV6Network]]` Specify the list of allowed source IPv6 network ranges for this endpoint. When the list is empty, the endpoint allows all source IPs. The list takes effect only if the endpoint is enabled for this location. - `network: str` Specify the IPv6 address or IPv6 CIDR. - `networks: Optional[Iterable[Network]]` Specify the list of network ranges from which requests at this location originate. The list takes effect only if it is non-empty and the IPv4 endpoint is enabled for this location. - `network: str` Specify the IPv4 address or IPv4 CIDR. Limit IPv4 CIDRs to a maximum of /24. ### Returns - `class Location: …` - `id: Optional[str]` - `client_default: Optional[bool]` Indicate whether this location is the default location. - `created_at: Optional[datetime]` - `dns_destination_ips_id: Optional[str]` Indicate the identifier of the pair of IPv4 addresses assigned to this location. - `dns_destination_ipv6_block_id: Optional[str]` Specify the UUID of the IPv6 block brought to the gateway so that this location's IPv6 address is allocated from the Bring Your Own IPv6 (BYOIPv6) block rather than the standard Cloudflare IPv6 block. - `doh_subdomain: Optional[str]` Specify the DNS over HTTPS domain that receives DNS requests. Gateway automatically generates this value. - `ecs_support: Optional[bool]` Indicate whether the location must resolve EDNS queries. - `endpoints: Optional[Endpoint]` Configure the destination endpoints for this location. - `doh: DOHEndpoint` - `enabled: Optional[bool]` Indicate whether the DOH endpoint is enabled for this location. - `networks: Optional[List[IPNetwork]]` Specify the list of allowed source IP network ranges for this endpoint. When the list is empty, the endpoint allows all source IPs. The list takes effect only if the endpoint is enabled for this location. - `network: str` Specify the IP address or IP CIDR. - `require_token: Optional[bool]` Specify whether the DOH endpoint requires user identity authentication. - `dot: DOTEndpoint` - `enabled: Optional[bool]` Indicate whether the DOT endpoint is enabled for this location. - `networks: Optional[List[IPNetwork]]` Specify the list of allowed source IP network ranges for this endpoint. When the list is empty, the endpoint allows all source IPs. The list takes effect only if the endpoint is enabled for this location. - `network: str` Specify the IP address or IP CIDR. - `ipv4: IPV4Endpoint` - `enabled: Optional[bool]` Indicate whether the IPv4 endpoint is enabled for this location. - `ipv6: IPV6Endpoint` - `enabled: Optional[bool]` Indicate whether the IPV6 endpoint is enabled for this location. - `networks: Optional[List[IPV6Network]]` Specify the list of allowed source IPv6 network ranges for this endpoint. When the list is empty, the endpoint allows all source IPs. The list takes effect only if the endpoint is enabled for this location. - `network: str` Specify the IPv6 address or IPv6 CIDR. - `ip: Optional[str]` Defines the automatically generated IPv6 destination IP assigned to this location. Gateway counts all DNS requests sent to this IP as requests under this location. - `ipv4_destination: Optional[str]` Show the primary destination IPv4 address from the pair identified dns_destination_ips_id. This field read-only. - `ipv4_destination_backup: Optional[str]` Show the backup destination IPv4 address from the pair identified dns_destination_ips_id. This field read-only. - `name: Optional[str]` Specify the location name. - `networks: Optional[List[Network]]` Specify the list of network ranges from which requests at this location originate. The list takes effect only if it is non-empty and the IPv4 endpoint is enabled for this location. - `network: str` Specify the IPv4 address or IPv4 CIDR. Limit IPv4 CIDRs to a maximum of /24. - `updated_at: Optional[datetime]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) location = client.zero_trust.gateway.locations.update( location_id="ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", name="Austin Office Location", ) print(location.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "ed35569b41ce4d1facfe683550f54086", "client_default": false, "created_at": "2014-01-01T05:20:00.12345Z", "dns_destination_ips_id": "0e4a32c6-6fb8-4858-9296-98f51631e8e6", "dns_destination_ipv6_block_id": "b08f7231-d458-495c-98ef-190604c9ee83", "doh_subdomain": "oli3n9zkz5", "ecs_support": false, "endpoints": { "doh": { "enabled": true, "networks": [ { "network": "2001:85a3::/64" } ], "require_token": true }, "dot": { "enabled": true, "networks": [ { "network": "2001:85a3::/64" } ] }, "ipv4": { "enabled": true }, "ipv6": { "enabled": true, "networks": [ { "network": "2001:85a3::/64" } ] } }, "ip": "2001:0db8:85a3:0000:0000:8a2e:0370:7334", "ipv4_destination": "172.64.36.1", "ipv4_destination_backup": "172.64.36.2", "name": "Austin Office Location", "networks": [ { "network": "192.0.2.1/32" } ], "updated_at": "2014-01-01T05:20:00.12345Z" } } ``` ## Delete a Zero Trust Gateway location `zero_trust.gateway.locations.delete(strlocation_id, LocationDeleteParams**kwargs) -> object` **delete** `/accounts/{account_id}/gateway/locations/{location_id}` Delete a configured Zero Trust Gateway location. ### Parameters - `account_id: str` - `location_id: str` ### Returns - `object` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) location = client.zero_trust.gateway.locations.delete( location_id="ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", ) print(location) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": {} } ``` ## Domain Types ### DOH Endpoint - `class DOHEndpoint: …` - `enabled: Optional[bool]` Indicate whether the DOH endpoint is enabled for this location. - `networks: Optional[List[IPNetwork]]` Specify the list of allowed source IP network ranges for this endpoint. When the list is empty, the endpoint allows all source IPs. The list takes effect only if the endpoint is enabled for this location. - `network: str` Specify the IP address or IP CIDR. - `require_token: Optional[bool]` Specify whether the DOH endpoint requires user identity authentication. ### DOT Endpoint - `class DOTEndpoint: …` - `enabled: Optional[bool]` Indicate whether the DOT endpoint is enabled for this location. - `networks: Optional[List[IPNetwork]]` Specify the list of allowed source IP network ranges for this endpoint. When the list is empty, the endpoint allows all source IPs. The list takes effect only if the endpoint is enabled for this location. - `network: str` Specify the IP address or IP CIDR. ### Endpoint - `class Endpoint: …` Configure the destination endpoints for this location. - `doh: DOHEndpoint` - `enabled: Optional[bool]` Indicate whether the DOH endpoint is enabled for this location. - `networks: Optional[List[IPNetwork]]` Specify the list of allowed source IP network ranges for this endpoint. When the list is empty, the endpoint allows all source IPs. The list takes effect only if the endpoint is enabled for this location. - `network: str` Specify the IP address or IP CIDR. - `require_token: Optional[bool]` Specify whether the DOH endpoint requires user identity authentication. - `dot: DOTEndpoint` - `enabled: Optional[bool]` Indicate whether the DOT endpoint is enabled for this location. - `networks: Optional[List[IPNetwork]]` Specify the list of allowed source IP network ranges for this endpoint. When the list is empty, the endpoint allows all source IPs. The list takes effect only if the endpoint is enabled for this location. - `network: str` Specify the IP address or IP CIDR. - `ipv4: IPV4Endpoint` - `enabled: Optional[bool]` Indicate whether the IPv4 endpoint is enabled for this location. - `ipv6: IPV6Endpoint` - `enabled: Optional[bool]` Indicate whether the IPV6 endpoint is enabled for this location. - `networks: Optional[List[IPV6Network]]` Specify the list of allowed source IPv6 network ranges for this endpoint. When the list is empty, the endpoint allows all source IPs. The list takes effect only if the endpoint is enabled for this location. - `network: str` Specify the IPv6 address or IPv6 CIDR. ### IP Network - `class IPNetwork: …` - `network: str` Specify the IP address or IP CIDR. ### IPV4 Endpoint - `class IPV4Endpoint: …` - `enabled: Optional[bool]` Indicate whether the IPv4 endpoint is enabled for this location. ### IPV6 Endpoint - `class IPV6Endpoint: …` - `enabled: Optional[bool]` Indicate whether the IPV6 endpoint is enabled for this location. - `networks: Optional[List[IPV6Network]]` Specify the list of allowed source IPv6 network ranges for this endpoint. When the list is empty, the endpoint allows all source IPs. The list takes effect only if the endpoint is enabled for this location. - `network: str` Specify the IPv6 address or IPv6 CIDR. ### IPV6 Network - `class IPV6Network: …` - `network: str` Specify the IPv6 address or IPv6 CIDR. ### Location - `class Location: …` - `id: Optional[str]` - `client_default: Optional[bool]` Indicate whether this location is the default location. - `created_at: Optional[datetime]` - `dns_destination_ips_id: Optional[str]` Indicate the identifier of the pair of IPv4 addresses assigned to this location. - `dns_destination_ipv6_block_id: Optional[str]` Specify the UUID of the IPv6 block brought to the gateway so that this location's IPv6 address is allocated from the Bring Your Own IPv6 (BYOIPv6) block rather than the standard Cloudflare IPv6 block. - `doh_subdomain: Optional[str]` Specify the DNS over HTTPS domain that receives DNS requests. Gateway automatically generates this value. - `ecs_support: Optional[bool]` Indicate whether the location must resolve EDNS queries. - `endpoints: Optional[Endpoint]` Configure the destination endpoints for this location. - `doh: DOHEndpoint` - `enabled: Optional[bool]` Indicate whether the DOH endpoint is enabled for this location. - `networks: Optional[List[IPNetwork]]` Specify the list of allowed source IP network ranges for this endpoint. When the list is empty, the endpoint allows all source IPs. The list takes effect only if the endpoint is enabled for this location. - `network: str` Specify the IP address or IP CIDR. - `require_token: Optional[bool]` Specify whether the DOH endpoint requires user identity authentication. - `dot: DOTEndpoint` - `enabled: Optional[bool]` Indicate whether the DOT endpoint is enabled for this location. - `networks: Optional[List[IPNetwork]]` Specify the list of allowed source IP network ranges for this endpoint. When the list is empty, the endpoint allows all source IPs. The list takes effect only if the endpoint is enabled for this location. - `network: str` Specify the IP address or IP CIDR. - `ipv4: IPV4Endpoint` - `enabled: Optional[bool]` Indicate whether the IPv4 endpoint is enabled for this location. - `ipv6: IPV6Endpoint` - `enabled: Optional[bool]` Indicate whether the IPV6 endpoint is enabled for this location. - `networks: Optional[List[IPV6Network]]` Specify the list of allowed source IPv6 network ranges for this endpoint. When the list is empty, the endpoint allows all source IPs. The list takes effect only if the endpoint is enabled for this location. - `network: str` Specify the IPv6 address or IPv6 CIDR. - `ip: Optional[str]` Defines the automatically generated IPv6 destination IP assigned to this location. Gateway counts all DNS requests sent to this IP as requests under this location. - `ipv4_destination: Optional[str]` Show the primary destination IPv4 address from the pair identified dns_destination_ips_id. This field read-only. - `ipv4_destination_backup: Optional[str]` Show the backup destination IPv4 address from the pair identified dns_destination_ips_id. This field read-only. - `name: Optional[str]` Specify the location name. - `networks: Optional[List[Network]]` Specify the list of network ranges from which requests at this location originate. The list takes effect only if it is non-empty and the IPv4 endpoint is enabled for this location. - `network: str` Specify the IPv4 address or IPv4 CIDR. Limit IPv4 CIDRs to a maximum of /24. - `updated_at: Optional[datetime]` # Logging ## Get logging settings for the Zero Trust account `zero_trust.gateway.logging.get(LoggingGetParams**kwargs) -> LoggingSetting` **get** `/accounts/{account_id}/gateway/logging` Retrieve the current logging settings for the Zero Trust account. ### Parameters - `account_id: str` ### Returns - `class LoggingSetting: …` - `redact_pii: Optional[bool]` Indicate whether to redact personally identifiable information from activity logging (PII fields include source IP, user email, user ID, device ID, URL, referrer, and user agent). - `settings_by_rule_type: Optional[SettingsByRuleType]` Configure logging settings for each rule type. - `dns: Optional[SettingsByRuleTypeDNS]` Configure logging settings for DNS firewall. - `log_all: Optional[bool]` Specify whether to log all requests to this service. - `log_blocks: Optional[bool]` Specify whether to log only blocking requests to this service. - `http: Optional[SettingsByRuleTypeHTTP]` Configure logging settings for HTTP/HTTPS firewall. - `log_all: Optional[bool]` Specify whether to log all requests to this service. - `log_blocks: Optional[bool]` Specify whether to log only blocking requests to this service. - `l4: Optional[SettingsByRuleTypeL4]` Configure logging settings for Network firewall. - `log_all: Optional[bool]` Specify whether to log all requests to this service. - `log_blocks: Optional[bool]` Specify whether to log only blocking requests to this service. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) logging_setting = client.zero_trust.gateway.logging.get( account_id="699d98642c564d2e855e9661899b7252", ) print(logging_setting.redact_pii) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "redact_pii": true, "settings_by_rule_type": { "dns": { "log_all": false, "log_blocks": true }, "http": { "log_all": false, "log_blocks": true }, "l4": { "log_all": false, "log_blocks": true } } } } ``` ## Update Zero Trust account logging settings `zero_trust.gateway.logging.update(LoggingUpdateParams**kwargs) -> LoggingSetting` **put** `/accounts/{account_id}/gateway/logging` Update logging settings for the current Zero Trust account. ### Parameters - `account_id: str` - `redact_pii: Optional[bool]` Indicate whether to redact personally identifiable information from activity logging (PII fields include source IP, user email, user ID, device ID, URL, referrer, and user agent). - `settings_by_rule_type: Optional[SettingsByRuleType]` Configure logging settings for each rule type. - `dns: Optional[SettingsByRuleTypeDNS]` Configure logging settings for DNS firewall. - `log_all: Optional[bool]` Specify whether to log all requests to this service. - `log_blocks: Optional[bool]` Specify whether to log only blocking requests to this service. - `http: Optional[SettingsByRuleTypeHTTP]` Configure logging settings for HTTP/HTTPS firewall. - `log_all: Optional[bool]` Specify whether to log all requests to this service. - `log_blocks: Optional[bool]` Specify whether to log only blocking requests to this service. - `l4: Optional[SettingsByRuleTypeL4]` Configure logging settings for Network firewall. - `log_all: Optional[bool]` Specify whether to log all requests to this service. - `log_blocks: Optional[bool]` Specify whether to log only blocking requests to this service. ### Returns - `class LoggingSetting: …` - `redact_pii: Optional[bool]` Indicate whether to redact personally identifiable information from activity logging (PII fields include source IP, user email, user ID, device ID, URL, referrer, and user agent). - `settings_by_rule_type: Optional[SettingsByRuleType]` Configure logging settings for each rule type. - `dns: Optional[SettingsByRuleTypeDNS]` Configure logging settings for DNS firewall. - `log_all: Optional[bool]` Specify whether to log all requests to this service. - `log_blocks: Optional[bool]` Specify whether to log only blocking requests to this service. - `http: Optional[SettingsByRuleTypeHTTP]` Configure logging settings for HTTP/HTTPS firewall. - `log_all: Optional[bool]` Specify whether to log all requests to this service. - `log_blocks: Optional[bool]` Specify whether to log only blocking requests to this service. - `l4: Optional[SettingsByRuleTypeL4]` Configure logging settings for Network firewall. - `log_all: Optional[bool]` Specify whether to log all requests to this service. - `log_blocks: Optional[bool]` Specify whether to log only blocking requests to this service. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) logging_setting = client.zero_trust.gateway.logging.update( account_id="699d98642c564d2e855e9661899b7252", ) print(logging_setting.redact_pii) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "redact_pii": true, "settings_by_rule_type": { "dns": { "log_all": false, "log_blocks": true }, "http": { "log_all": false, "log_blocks": true }, "l4": { "log_all": false, "log_blocks": true } } } } ``` ## Domain Types ### Logging Setting - `class LoggingSetting: …` - `redact_pii: Optional[bool]` Indicate whether to redact personally identifiable information from activity logging (PII fields include source IP, user email, user ID, device ID, URL, referrer, and user agent). - `settings_by_rule_type: Optional[SettingsByRuleType]` Configure logging settings for each rule type. - `dns: Optional[SettingsByRuleTypeDNS]` Configure logging settings for DNS firewall. - `log_all: Optional[bool]` Specify whether to log all requests to this service. - `log_blocks: Optional[bool]` Specify whether to log only blocking requests to this service. - `http: Optional[SettingsByRuleTypeHTTP]` Configure logging settings for HTTP/HTTPS firewall. - `log_all: Optional[bool]` Specify whether to log all requests to this service. - `log_blocks: Optional[bool]` Specify whether to log only blocking requests to this service. - `l4: Optional[SettingsByRuleTypeL4]` Configure logging settings for Network firewall. - `log_all: Optional[bool]` Specify whether to log all requests to this service. - `log_blocks: Optional[bool]` Specify whether to log only blocking requests to this service. # Proxy Endpoints ## List proxy endpoints `zero_trust.gateway.proxy_endpoints.list(ProxyEndpointListParams**kwargs) -> SyncSinglePage[ProxyEndpoint]` **get** `/accounts/{account_id}/gateway/proxy_endpoints` List all Zero Trust Gateway proxy endpoints for an account. ### Parameters - `account_id: str` ### Returns - `ProxyEndpoint` - `class ZeroTrustGatewayProxyEndpointIP: …` - `ips: List[GatewayIPs]` Specify the list of CIDRs to restrict ingress connections. - `name: str` Specify the name of the proxy endpoint. - `id: Optional[str]` - `created_at: Optional[datetime]` - `kind: Optional[Literal["ip"]]` The proxy endpoint kind - `"ip"` - `subdomain: Optional[str]` Specify the subdomain to use as the destination in the proxy client. - `updated_at: Optional[datetime]` - `class ZeroTrustGatewayProxyEndpointIdentity: …` - `kind: Literal["identity"]` The proxy endpoint kind - `"identity"` - `name: str` Specify the name of the proxy endpoint. - `id: Optional[str]` - `created_at: Optional[datetime]` - `subdomain: Optional[str]` Specify the subdomain to use as the destination in the proxy client. - `updated_at: Optional[datetime]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.zero_trust.gateway.proxy_endpoints.list( account_id="699d98642c564d2e855e9661899b7252", ) page = page.result[0] print(page) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "ips": [ "192.0.2.1/32" ], "name": "Devops team", "id": "ed35569b41ce4d1facfe683550f54086", "created_at": "2014-01-01T05:20:00.12345Z", "kind": "ip", "subdomain": "oli3n9zkz5.proxy.cloudflare-gateway.com", "updated_at": "2014-01-01T05:20:00.12345Z" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Get a proxy endpoint `zero_trust.gateway.proxy_endpoints.get(strproxy_endpoint_id, ProxyEndpointGetParams**kwargs) -> ProxyEndpoint` **get** `/accounts/{account_id}/gateway/proxy_endpoints/{proxy_endpoint_id}` Get a single Zero Trust Gateway proxy endpoint. ### Parameters - `account_id: str` - `proxy_endpoint_id: str` ### Returns - `ProxyEndpoint` - `class ZeroTrustGatewayProxyEndpointIP: …` - `ips: List[GatewayIPs]` Specify the list of CIDRs to restrict ingress connections. - `name: str` Specify the name of the proxy endpoint. - `id: Optional[str]` - `created_at: Optional[datetime]` - `kind: Optional[Literal["ip"]]` The proxy endpoint kind - `"ip"` - `subdomain: Optional[str]` Specify the subdomain to use as the destination in the proxy client. - `updated_at: Optional[datetime]` - `class ZeroTrustGatewayProxyEndpointIdentity: …` - `kind: Literal["identity"]` The proxy endpoint kind - `"identity"` - `name: str` Specify the name of the proxy endpoint. - `id: Optional[str]` - `created_at: Optional[datetime]` - `subdomain: Optional[str]` Specify the subdomain to use as the destination in the proxy client. - `updated_at: Optional[datetime]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) proxy_endpoint = client.zero_trust.gateway.proxy_endpoints.get( proxy_endpoint_id="ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", ) print(proxy_endpoint) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "ips": [ "192.0.2.1/32" ], "name": "Devops team", "id": "ed35569b41ce4d1facfe683550f54086", "created_at": "2014-01-01T05:20:00.12345Z", "kind": "ip", "subdomain": "oli3n9zkz5.proxy.cloudflare-gateway.com", "updated_at": "2014-01-01T05:20:00.12345Z" } } ``` ## Create a proxy endpoint `zero_trust.gateway.proxy_endpoints.create(ProxyEndpointCreateParams**kwargs) -> ProxyEndpoint` **post** `/accounts/{account_id}/gateway/proxy_endpoints` Create a new Zero Trust Gateway proxy endpoint. ### Parameters - `account_id: str` - `name: str` Specify the name of the proxy endpoint. - `kind: Optional[Literal["ip"]]` The proxy endpoint kind - `"ip"` ### Returns - `ProxyEndpoint` - `class ZeroTrustGatewayProxyEndpointIP: …` - `ips: List[GatewayIPs]` Specify the list of CIDRs to restrict ingress connections. - `name: str` Specify the name of the proxy endpoint. - `id: Optional[str]` - `created_at: Optional[datetime]` - `kind: Optional[Literal["ip"]]` The proxy endpoint kind - `"ip"` - `subdomain: Optional[str]` Specify the subdomain to use as the destination in the proxy client. - `updated_at: Optional[datetime]` - `class ZeroTrustGatewayProxyEndpointIdentity: …` - `kind: Literal["identity"]` The proxy endpoint kind - `"identity"` - `name: str` Specify the name of the proxy endpoint. - `id: Optional[str]` - `created_at: Optional[datetime]` - `subdomain: Optional[str]` Specify the subdomain to use as the destination in the proxy client. - `updated_at: Optional[datetime]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) proxy_endpoint = client.zero_trust.gateway.proxy_endpoints.create( account_id="699d98642c564d2e855e9661899b7252", name="Devops team", ) print(proxy_endpoint) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "ips": [ "192.0.2.1/32" ], "name": "Devops team", "id": "ed35569b41ce4d1facfe683550f54086", "created_at": "2014-01-01T05:20:00.12345Z", "kind": "ip", "subdomain": "oli3n9zkz5.proxy.cloudflare-gateway.com", "updated_at": "2014-01-01T05:20:00.12345Z" } } ``` ## Update a proxy endpoint `zero_trust.gateway.proxy_endpoints.edit(strproxy_endpoint_id, ProxyEndpointEditParams**kwargs) -> ProxyEndpoint` **patch** `/accounts/{account_id}/gateway/proxy_endpoints/{proxy_endpoint_id}` Update a configured Zero Trust Gateway proxy endpoint. ### Parameters - `account_id: str` - `proxy_endpoint_id: str` - `ips: Optional[SequenceNotStr[GatewayIPs]]` Specify the list of CIDRs to restrict ingress connections. - `name: Optional[str]` Specify the name of the proxy endpoint. ### Returns - `ProxyEndpoint` - `class ZeroTrustGatewayProxyEndpointIP: …` - `ips: List[GatewayIPs]` Specify the list of CIDRs to restrict ingress connections. - `name: str` Specify the name of the proxy endpoint. - `id: Optional[str]` - `created_at: Optional[datetime]` - `kind: Optional[Literal["ip"]]` The proxy endpoint kind - `"ip"` - `subdomain: Optional[str]` Specify the subdomain to use as the destination in the proxy client. - `updated_at: Optional[datetime]` - `class ZeroTrustGatewayProxyEndpointIdentity: …` - `kind: Literal["identity"]` The proxy endpoint kind - `"identity"` - `name: str` Specify the name of the proxy endpoint. - `id: Optional[str]` - `created_at: Optional[datetime]` - `subdomain: Optional[str]` Specify the subdomain to use as the destination in the proxy client. - `updated_at: Optional[datetime]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) proxy_endpoint = client.zero_trust.gateway.proxy_endpoints.edit( proxy_endpoint_id="ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", ) print(proxy_endpoint) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "ips": [ "192.0.2.1/32" ], "name": "Devops team", "id": "ed35569b41ce4d1facfe683550f54086", "created_at": "2014-01-01T05:20:00.12345Z", "kind": "ip", "subdomain": "oli3n9zkz5.proxy.cloudflare-gateway.com", "updated_at": "2014-01-01T05:20:00.12345Z" } } ``` ## Delete a proxy endpoint `zero_trust.gateway.proxy_endpoints.delete(strproxy_endpoint_id, ProxyEndpointDeleteParams**kwargs) -> object` **delete** `/accounts/{account_id}/gateway/proxy_endpoints/{proxy_endpoint_id}` Delete a configured Zero Trust Gateway proxy endpoint. ### Parameters - `account_id: str` - `proxy_endpoint_id: str` ### Returns - `object` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) proxy_endpoint = client.zero_trust.gateway.proxy_endpoints.delete( proxy_endpoint_id="ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", ) print(proxy_endpoint) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": {} } ``` ## Domain Types ### Gateway IPs - `str` Specify an IPv4 or IPv6 CIDR. Limit IPv6 to a maximum of /109 and IPv4 to a maximum of /25. ### Proxy Endpoint - `ProxyEndpoint` - `class ZeroTrustGatewayProxyEndpointIP: …` - `ips: List[GatewayIPs]` Specify the list of CIDRs to restrict ingress connections. - `name: str` Specify the name of the proxy endpoint. - `id: Optional[str]` - `created_at: Optional[datetime]` - `kind: Optional[Literal["ip"]]` The proxy endpoint kind - `"ip"` - `subdomain: Optional[str]` Specify the subdomain to use as the destination in the proxy client. - `updated_at: Optional[datetime]` - `class ZeroTrustGatewayProxyEndpointIdentity: …` - `kind: Literal["identity"]` The proxy endpoint kind - `"identity"` - `name: str` Specify the name of the proxy endpoint. - `id: Optional[str]` - `created_at: Optional[datetime]` - `subdomain: Optional[str]` Specify the subdomain to use as the destination in the proxy client. - `updated_at: Optional[datetime]` # Rules ## List Zero Trust Gateway rules `zero_trust.gateway.rules.list(RuleListParams**kwargs) -> SyncSinglePage[GatewayRule]` **get** `/accounts/{account_id}/gateway/rules` List Zero Trust Gateway rules for an account. ### Parameters - `account_id: str` ### Returns - `class GatewayRule: …` - `action: Literal["on", "off", "allow", 13 more]` Specify the action to perform when the associated traffic, identity, and device posture expressions either absent or evaluate to `true`. - `"on"` - `"off"` - `"allow"` - `"block"` - `"scan"` - `"noscan"` - `"safesearch"` - `"ytrestricted"` - `"isolate"` - `"noisolate"` - `"override"` - `"l4_override"` - `"egress"` - `"resolve"` - `"quarantine"` - `"redirect"` - `enabled: bool` Specify whether the rule is enabled. - `filters: List[GatewayFilter]` Specify the protocol or layer to evaluate the traffic, identity, and device posture expressions. Can only contain a single value. - `"http"` - `"dns"` - `"l4"` - `"egress"` - `"dns_resolver"` - `name: str` Specify the rule name. - `precedence: int` Set the order of your rules. Lower values indicate higher precedence. At each processing phase, evaluate applicable rules in ascending order of this value. Refer to [Order of enforcement](http://developers.cloudflare.com/learning-paths/secure-internet-traffic/understand-policies/order-of-enforcement/#manage-precedence-with-terraform) to manage precedence via Terraform. - `traffic: str` Specify the wirefilter expression used for traffic matching. The API automatically formats and sanitizes expressions before storing them. To prevent Terraform state drift, use the formatted expression returned in the API response. - `id: Optional[str]` Identify the API resource with a UUID. - `created_at: Optional[datetime]` - `deleted_at: Optional[datetime]` Indicate the date of deletion, if any. - `description: Optional[str]` Specify the rule description. - `device_posture: Optional[str]` Specify the wirefilter expression used for device posture check. The API automatically formats and sanitizes expressions before storing them. To prevent Terraform state drift, use the formatted expression returned in the API response. - `expiration: Optional[Expiration]` Defines the expiration time stamp and default duration of a DNS policy. Takes precedence over the policy's `schedule` configuration, if any. This does not apply to HTTP or network policies. Settable only for `dns` rules. - `expires_at: datetime` Show the timestamp when the policy expires and stops applying. The value must follow RFC 3339 and include a UTC offset. The system accepts non-zero offsets but converts them to the equivalent UTC+00:00 value and returns timestamps with a trailing Z. Expiration policies ignore client timezones and expire globally at the specified expires_at time. - `duration: Optional[int]` Defines the default duration a policy active in minutes. Must set in order to use the `reset_expiration` endpoint on this rule. - `expired: Optional[bool]` Indicates whether the policy is expired. - `identity: Optional[str]` Specify the wirefilter expression used for identity matching. The API automatically formats and sanitizes expressions before storing them. To prevent Terraform state drift, use the formatted expression returned in the API response. - `read_only: Optional[bool]` Indicate that this rule is shared via the Orgs API and read only. - `rule_settings: Optional[RuleSetting]` Defines settings for this rule. Settings apply only to specific rule types and must use compatible selectors. If Terraform detects drift, confirm the setting supports your rule type and check whether the API modifies the value. Use API-returned values in your configuration to prevent drift. - `add_headers: Optional[Dict[str, List[str]]]` Add custom headers to allowed requests as key-value pairs. Use header names as keys that map to arrays of header values. Settable only for `http` rules with the action set to `allow`. - `allow_child_bypass: Optional[bool]` Set to enable MSP children to bypass this rule. Only parent MSP accounts can set this. this rule. Settable for all types of rules. - `audit_ssh: Optional[AuditSSH]` Define the settings for the Audit SSH action. Settable only for `l4` rules with `audit_ssh` action. - `command_logging: Optional[bool]` Enable SSH command logging. - `biso_admin_controls: Optional[BISOAdminControls]` Configure browser isolation behavior. Settable only for `http` rules with the action set to `isolate`. - `copy: Optional[Literal["enabled", "disabled", "remote_only"]]` Configure copy behavior. If set to remote_only, users cannot copy isolated content from the remote browser to the local clipboard. If this field is absent, copying remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `"remote_only"` - `dcp: Optional[bool]` Set to false to enable copy-pasting. Only applies when `version == "v1"`. - `dd: Optional[bool]` Set to false to enable downloading. Only applies when `version == "v1"`. - `dk: Optional[bool]` Set to false to enable keyboard usage. Only applies when `version == "v1"`. - `download: Optional[Literal["enabled", "disabled", "remote_only"]]` Configure download behavior. When set to remote_only, users can view downloads but cannot save them. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `"remote_only"` - `dp: Optional[bool]` Set to false to enable printing. Only applies when `version == "v1"`. - `du: Optional[bool]` Set to false to enable uploading. Only applies when `version == "v1"`. - `keyboard: Optional[Literal["enabled", "disabled"]]` Configure keyboard usage behavior. If this field is absent, keyboard usage remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `paste: Optional[Literal["enabled", "disabled", "remote_only"]]` Configure paste behavior. If set to remote_only, users cannot paste content from the local clipboard into isolated pages. If this field is absent, pasting remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `"remote_only"` - `printing: Optional[Literal["enabled", "disabled"]]` Configure print behavior. Default, Printing is enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `upload: Optional[Literal["enabled", "disabled"]]` Configure upload behavior. If this field is absent, uploading remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `version: Optional[Literal["v1", "v2"]]` Indicate which version of the browser isolation controls should apply. - `"v1"` - `"v2"` - `block_page: Optional[BlockPage]` Configure custom block page settings. If missing or null, use the account settings. Settable only for `http` rules with the action set to `block`. - `target_uri: str` Specify the URI to which the user is redirected. - `include_context: Optional[bool]` Specify whether to pass the context information as query parameters. - `block_page_enabled: Optional[bool]` Enable the custom block page. Settable only for `dns` rules with action `block`. - `block_reason: Optional[str]` Explain why the rule blocks the request. The custom block page shows this text (if enabled). Settable only for `dns`, `l4`, and `http` rules when the action set to `block`. - `bypass_parent_rule: Optional[bool]` Set to enable MSP accounts to bypass their parent's rules. Only MSP child accounts can set this. Settable for all types of rules. - `check_session: Optional[CheckSession]` Configure session check behavior. Settable only for `l4` and `http` rules with the action set to `allow`. - `duration: Optional[str]` Sets the required session freshness threshold. The API returns a normalized version of this value. - `enforce: Optional[bool]` Enable session enforcement. - `dns_resolvers: Optional[DNSResolvers]` Configure custom resolvers to route queries that match the resolver policy. Unused with 'resolve_dns_through_cloudflare' or 'resolve_dns_internally' settings. DNS queries get routed to the address closest to their origin. Only valid when a rule's action set to 'resolve'. Settable only for `dns_resolver` rules. - `ipv4: Optional[List[DNSResolverSettingsV4]]` - `ip: str` Specify the IPv4 address of the upstream resolver. - `port: Optional[int]` Specify a port number to use for the upstream resolver. Defaults to 53 if unspecified. - `route_through_private_network: Optional[bool]` Indicate whether to connect to this resolver over a private network. Must set when vnet_id set. - `vnet_id: Optional[str]` Specify an optional virtual network for this resolver. Uses default virtual network id if omitted. - `ipv6: Optional[List[DNSResolverSettingsV6]]` - `ip: str` Specify the IPv6 address of the upstream resolver. - `port: Optional[int]` Specify a port number to use for the upstream resolver. Defaults to 53 if unspecified. - `route_through_private_network: Optional[bool]` Indicate whether to connect to this resolver over a private network. Must set when vnet_id set. - `vnet_id: Optional[str]` Specify an optional virtual network for this resolver. Uses default virtual network id if omitted. - `egress: Optional[Egress]` Configure how Gateway Proxy traffic egresses. You can enable this setting for rules with Egress actions and filters, or omit it to indicate local egress via WARP IPs. Settable only for `egress` rules. - `ipv4: Optional[str]` Specify the IPv4 address to use for egress. - `ipv4_fallback: Optional[str]` Specify the fallback IPv4 address to use for egress when the primary IPv4 fails. Set '0.0.0.0' to indicate local egress via WARP IPs. - `ipv6: Optional[str]` Specify the IPv6 range to use for egress. - `forensic_copy: Optional[ForensicCopy]` Configure whether a copy of the HTTP request will be sent to storage when the rule matches. - `enabled: Optional[bool]` Enable sending the copy to storage. - `ignore_cname_category_matches: Optional[bool]` Ignore category matches at CNAME domains in a response. When off, evaluate categories in this rule against all CNAME domain categories in the response. Settable only for `dns` and `dns_resolver` rules. - `insecure_disable_dnssec_validation: Optional[bool]` Specify whether to disable DNSSEC validation (for Allow actions) [INSECURE]. Settable only for `dns` rules. - `ip_categories: Optional[bool]` Enable IPs in DNS resolver category blocks. The system blocks only domain name categories unless you enable this setting. Settable only for `dns` and `dns_resolver` rules. - `ip_indicator_feeds: Optional[bool]` Indicates whether to include IPs in DNS resolver indicator feed blocks. Default, indicator feeds block only domain names. Settable only for `dns` and `dns_resolver` rules. - `l4override: Optional[L4override]` Send matching traffic to the supplied destination IP address and port. Settable only for `l4` rules with the action set to `l4_override`. - `ip: Optional[str]` Defines the IPv4 or IPv6 address. - `port: Optional[int]` Defines a port number to use for TCP/UDP overrides. - `notification_settings: Optional[NotificationSettings]` Configure a notification to display on the user's device when this rule matched. Settable for all types of rules with the action set to `block`. - `enabled: Optional[bool]` Enable notification. - `include_context: Optional[bool]` Indicates whether to pass the context information as query parameters. - `msg: Optional[str]` Customize the message shown in the notification. - `support_url: Optional[str]` Defines an optional URL to direct users to additional information. If unset, the notification opens a block page. - `override_host: Optional[str]` Defines a hostname for override, for the matching DNS queries. Settable only for `dns` rules with the action set to `override`. - `override_ips: Optional[List[str]]` Defines a an IP or set of IPs for overriding matched DNS queries. Settable only for `dns` rules with the action set to `override`. - `payload_log: Optional[PayloadLog]` Configure DLP payload logging. Settable only for `http` rules. - `enabled: Optional[bool]` Enable DLP payload logging for this rule. - `quarantine: Optional[Quarantine]` Configure settings that apply to quarantine rules. Settable only for `http` rules. - `file_types: Optional[List[Literal["exe", "pdf", "doc", 10 more]]]` Specify the types of files to sandbox. - `"exe"` - `"pdf"` - `"doc"` - `"docm"` - `"docx"` - `"rtf"` - `"ppt"` - `"pptx"` - `"xls"` - `"xlsm"` - `"xlsx"` - `"zip"` - `"rar"` - `redirect: Optional[Redirect]` Apply settings to redirect rules. Settable only for `http` rules with the action set to `redirect`. - `target_uri: str` Specify the URI to which the user is redirected. - `include_context: Optional[bool]` Specify whether to pass the context information as query parameters. - `preserve_path_and_query: Optional[bool]` Specify whether to append the path and query parameters from the original request to target_uri. - `resolve_dns_internally: Optional[ResolveDNSInternally]` Configure to forward the query to the internal DNS service, passing the specified 'view_id' as input. Not used when 'dns_resolvers' is specified or 'resolve_dns_through_cloudflare' is set. Only valid when a rule's action set to 'resolve'. Settable only for `dns_resolver` rules. - `fallback: Optional[Literal["none", "public_dns"]]` Specify the fallback behavior to apply when the internal DNS response code differs from 'NOERROR' or when the response data contains only CNAME records for 'A' or 'AAAA' queries. - `"none"` - `"public_dns"` - `view_id: Optional[str]` Specify the internal DNS view identifier to pass to the internal DNS service. - `resolve_dns_through_cloudflare: Optional[bool]` Enable to send queries that match the policy to Cloudflare's default 1.1.1.1 DNS resolver. Cannot set when 'dns_resolvers' specified or 'resolve_dns_internally' is set. Only valid when a rule's action set to 'resolve'. Settable only for `dns_resolver` rules. - `untrusted_cert: Optional[UntrustedCERT]` Configure behavior when an upstream certificate is invalid or an SSL error occurs. Settable only for `http` rules with the action set to `allow`. - `action: Optional[Literal["pass_through", "block", "error"]]` Defines the action performed when an untrusted certificate seen. The default action an error with HTTP code 526. - `"pass_through"` - `"block"` - `"error"` - `schedule: Optional[Schedule]` Defines the schedule for activating DNS policies. Settable only for `dns` and `dns_resolver` rules. - `fri: Optional[str]` Specify the time intervals when the rule is active on Fridays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Fridays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `mon: Optional[str]` Specify the time intervals when the rule is active on Mondays, in the increasing order from 00:00-24:00(capped at maximum of 6 time splits). If this parameter omitted, the rule is deactivated on Mondays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `sat: Optional[str]` Specify the time intervals when the rule is active on Saturdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Saturdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `sun: Optional[str]` Specify the time intervals when the rule is active on Sundays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Sundays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `thu: Optional[str]` Specify the time intervals when the rule is active on Thursdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Thursdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `time_zone: Optional[str]` Specify the time zone for rule evaluation. When a [valid time zone city name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) is provided, Gateway always uses the current time for that time zone. When this parameter is omitted, Gateway uses the time zone determined from the user's IP address. Colo time zone is used when the user's IP address does not resolve to a location. - `tue: Optional[str]` Specify the time intervals when the rule is active on Tuesdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Tuesdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `wed: Optional[str]` Specify the time intervals when the rule is active on Wednesdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Wednesdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `sharable: Optional[bool]` Indicate that this rule is sharable via the Orgs API. - `source_account: Optional[str]` Provide the account tag of the account that created the rule. - `updated_at: Optional[datetime]` - `version: Optional[int]` Indicate the version number of the rule(read-only). - `warning_status: Optional[str]` Indicate a warning for a misconfigured rule, if any. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.zero_trust.gateway.rules.list( account_id="699d98642c564d2e855e9661899b7252", ) page = page.result[0] print(page.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "action": "allow", "enabled": true, "filters": [ "http" ], "name": "block bad websites", "precedence": 0, "traffic": "http.request.uri matches \".*a/partial/uri.*\" and http.request.host in $01302951-49f9-47c9-a400-0297e60b6a10", "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "created_at": "2014-01-01T05:20:00.12345Z", "deleted_at": "2019-12-27T18:11:19.117Z", "description": "Block bad websites based on their host name.", "device_posture": "any(device_posture.checks.passed[*] in {\"1308749e-fcfb-4ebc-b051-fe022b632644\"})", "expiration": { "expires_at": "2014-01-01T05:20:20Z", "duration": 10, "expired": false }, "identity": "any(identity.groups.name[*] in {\"finance\"})", "read_only": true, "rule_settings": { "add_headers": { "My-Next-Header": [ "foo", "bar" ], "X-Custom-Header-Name": [ "somecustomvalue" ] }, "allow_child_bypass": false, "audit_ssh": { "command_logging": false }, "biso_admin_controls": { "copy": "remote_only", "dcp": true, "dd": true, "dk": true, "download": "enabled", "dp": false, "du": true, "keyboard": "enabled", "paste": "enabled", "printing": "enabled", "upload": "enabled", "version": "v1" }, "block_page": { "target_uri": "https://example.com", "include_context": true }, "block_page_enabled": true, "block_reason": "This website is a security risk", "bypass_parent_rule": false, "check_session": { "duration": "300s", "enforce": true }, "dns_resolvers": { "ipv4": [ { "ip": "2.2.2.2", "port": 5053, "route_through_private_network": true, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415" } ], "ipv6": [ { "ip": "2001:DB8::", "port": 5053, "route_through_private_network": true, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415" } ] }, "egress": { "ipv4": "192.0.2.2", "ipv4_fallback": "192.0.2.3", "ipv6": "2001:DB8::/64" }, "forensic_copy": { "enabled": true }, "ignore_cname_category_matches": true, "insecure_disable_dnssec_validation": false, "ip_categories": true, "ip_indicator_feeds": true, "l4override": { "ip": "1.1.1.1", "port": 0 }, "notification_settings": { "enabled": true, "include_context": true, "msg": "msg", "support_url": "support_url" }, "override_host": "example.com", "override_ips": [ "1.1.1.1", "2.2.2.2" ], "payload_log": { "enabled": true }, "quarantine": { "file_types": [ "exe" ] }, "redirect": { "target_uri": "https://example.com", "include_context": true, "preserve_path_and_query": true }, "resolve_dns_internally": { "fallback": "none", "view_id": "view_id" }, "resolve_dns_through_cloudflare": true, "untrusted_cert": { "action": "error" } }, "schedule": { "fri": "08:00-12:30,13:30-17:00", "mon": "08:00-12:30,13:30-17:00", "sat": "08:00-12:30,13:30-17:00", "sun": "08:00-12:30,13:30-17:00", "thu": "08:00-12:30,13:30-17:00", "time_zone": "America/New York", "tue": "08:00-12:30,13:30-17:00", "wed": "08:00-12:30,13:30-17:00" }, "sharable": true, "source_account": "source_account", "updated_at": "2014-01-01T05:20:00.12345Z", "version": 1, "warning_status": "warning_status" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Get Zero Trust Gateway rule details. `zero_trust.gateway.rules.get(strrule_id, RuleGetParams**kwargs) -> GatewayRule` **get** `/accounts/{account_id}/gateway/rules/{rule_id}` Get a single Zero Trust Gateway rule. ### Parameters - `account_id: str` - `rule_id: str` Identify the API resource with a UUID. ### Returns - `class GatewayRule: …` - `action: Literal["on", "off", "allow", 13 more]` Specify the action to perform when the associated traffic, identity, and device posture expressions either absent or evaluate to `true`. - `"on"` - `"off"` - `"allow"` - `"block"` - `"scan"` - `"noscan"` - `"safesearch"` - `"ytrestricted"` - `"isolate"` - `"noisolate"` - `"override"` - `"l4_override"` - `"egress"` - `"resolve"` - `"quarantine"` - `"redirect"` - `enabled: bool` Specify whether the rule is enabled. - `filters: List[GatewayFilter]` Specify the protocol or layer to evaluate the traffic, identity, and device posture expressions. Can only contain a single value. - `"http"` - `"dns"` - `"l4"` - `"egress"` - `"dns_resolver"` - `name: str` Specify the rule name. - `precedence: int` Set the order of your rules. Lower values indicate higher precedence. At each processing phase, evaluate applicable rules in ascending order of this value. Refer to [Order of enforcement](http://developers.cloudflare.com/learning-paths/secure-internet-traffic/understand-policies/order-of-enforcement/#manage-precedence-with-terraform) to manage precedence via Terraform. - `traffic: str` Specify the wirefilter expression used for traffic matching. The API automatically formats and sanitizes expressions before storing them. To prevent Terraform state drift, use the formatted expression returned in the API response. - `id: Optional[str]` Identify the API resource with a UUID. - `created_at: Optional[datetime]` - `deleted_at: Optional[datetime]` Indicate the date of deletion, if any. - `description: Optional[str]` Specify the rule description. - `device_posture: Optional[str]` Specify the wirefilter expression used for device posture check. The API automatically formats and sanitizes expressions before storing them. To prevent Terraform state drift, use the formatted expression returned in the API response. - `expiration: Optional[Expiration]` Defines the expiration time stamp and default duration of a DNS policy. Takes precedence over the policy's `schedule` configuration, if any. This does not apply to HTTP or network policies. Settable only for `dns` rules. - `expires_at: datetime` Show the timestamp when the policy expires and stops applying. The value must follow RFC 3339 and include a UTC offset. The system accepts non-zero offsets but converts them to the equivalent UTC+00:00 value and returns timestamps with a trailing Z. Expiration policies ignore client timezones and expire globally at the specified expires_at time. - `duration: Optional[int]` Defines the default duration a policy active in minutes. Must set in order to use the `reset_expiration` endpoint on this rule. - `expired: Optional[bool]` Indicates whether the policy is expired. - `identity: Optional[str]` Specify the wirefilter expression used for identity matching. The API automatically formats and sanitizes expressions before storing them. To prevent Terraform state drift, use the formatted expression returned in the API response. - `read_only: Optional[bool]` Indicate that this rule is shared via the Orgs API and read only. - `rule_settings: Optional[RuleSetting]` Defines settings for this rule. Settings apply only to specific rule types and must use compatible selectors. If Terraform detects drift, confirm the setting supports your rule type and check whether the API modifies the value. Use API-returned values in your configuration to prevent drift. - `add_headers: Optional[Dict[str, List[str]]]` Add custom headers to allowed requests as key-value pairs. Use header names as keys that map to arrays of header values. Settable only for `http` rules with the action set to `allow`. - `allow_child_bypass: Optional[bool]` Set to enable MSP children to bypass this rule. Only parent MSP accounts can set this. this rule. Settable for all types of rules. - `audit_ssh: Optional[AuditSSH]` Define the settings for the Audit SSH action. Settable only for `l4` rules with `audit_ssh` action. - `command_logging: Optional[bool]` Enable SSH command logging. - `biso_admin_controls: Optional[BISOAdminControls]` Configure browser isolation behavior. Settable only for `http` rules with the action set to `isolate`. - `copy: Optional[Literal["enabled", "disabled", "remote_only"]]` Configure copy behavior. If set to remote_only, users cannot copy isolated content from the remote browser to the local clipboard. If this field is absent, copying remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `"remote_only"` - `dcp: Optional[bool]` Set to false to enable copy-pasting. Only applies when `version == "v1"`. - `dd: Optional[bool]` Set to false to enable downloading. Only applies when `version == "v1"`. - `dk: Optional[bool]` Set to false to enable keyboard usage. Only applies when `version == "v1"`. - `download: Optional[Literal["enabled", "disabled", "remote_only"]]` Configure download behavior. When set to remote_only, users can view downloads but cannot save them. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `"remote_only"` - `dp: Optional[bool]` Set to false to enable printing. Only applies when `version == "v1"`. - `du: Optional[bool]` Set to false to enable uploading. Only applies when `version == "v1"`. - `keyboard: Optional[Literal["enabled", "disabled"]]` Configure keyboard usage behavior. If this field is absent, keyboard usage remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `paste: Optional[Literal["enabled", "disabled", "remote_only"]]` Configure paste behavior. If set to remote_only, users cannot paste content from the local clipboard into isolated pages. If this field is absent, pasting remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `"remote_only"` - `printing: Optional[Literal["enabled", "disabled"]]` Configure print behavior. Default, Printing is enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `upload: Optional[Literal["enabled", "disabled"]]` Configure upload behavior. If this field is absent, uploading remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `version: Optional[Literal["v1", "v2"]]` Indicate which version of the browser isolation controls should apply. - `"v1"` - `"v2"` - `block_page: Optional[BlockPage]` Configure custom block page settings. If missing or null, use the account settings. Settable only for `http` rules with the action set to `block`. - `target_uri: str` Specify the URI to which the user is redirected. - `include_context: Optional[bool]` Specify whether to pass the context information as query parameters. - `block_page_enabled: Optional[bool]` Enable the custom block page. Settable only for `dns` rules with action `block`. - `block_reason: Optional[str]` Explain why the rule blocks the request. The custom block page shows this text (if enabled). Settable only for `dns`, `l4`, and `http` rules when the action set to `block`. - `bypass_parent_rule: Optional[bool]` Set to enable MSP accounts to bypass their parent's rules. Only MSP child accounts can set this. Settable for all types of rules. - `check_session: Optional[CheckSession]` Configure session check behavior. Settable only for `l4` and `http` rules with the action set to `allow`. - `duration: Optional[str]` Sets the required session freshness threshold. The API returns a normalized version of this value. - `enforce: Optional[bool]` Enable session enforcement. - `dns_resolvers: Optional[DNSResolvers]` Configure custom resolvers to route queries that match the resolver policy. Unused with 'resolve_dns_through_cloudflare' or 'resolve_dns_internally' settings. DNS queries get routed to the address closest to their origin. Only valid when a rule's action set to 'resolve'. Settable only for `dns_resolver` rules. - `ipv4: Optional[List[DNSResolverSettingsV4]]` - `ip: str` Specify the IPv4 address of the upstream resolver. - `port: Optional[int]` Specify a port number to use for the upstream resolver. Defaults to 53 if unspecified. - `route_through_private_network: Optional[bool]` Indicate whether to connect to this resolver over a private network. Must set when vnet_id set. - `vnet_id: Optional[str]` Specify an optional virtual network for this resolver. Uses default virtual network id if omitted. - `ipv6: Optional[List[DNSResolverSettingsV6]]` - `ip: str` Specify the IPv6 address of the upstream resolver. - `port: Optional[int]` Specify a port number to use for the upstream resolver. Defaults to 53 if unspecified. - `route_through_private_network: Optional[bool]` Indicate whether to connect to this resolver over a private network. Must set when vnet_id set. - `vnet_id: Optional[str]` Specify an optional virtual network for this resolver. Uses default virtual network id if omitted. - `egress: Optional[Egress]` Configure how Gateway Proxy traffic egresses. You can enable this setting for rules with Egress actions and filters, or omit it to indicate local egress via WARP IPs. Settable only for `egress` rules. - `ipv4: Optional[str]` Specify the IPv4 address to use for egress. - `ipv4_fallback: Optional[str]` Specify the fallback IPv4 address to use for egress when the primary IPv4 fails. Set '0.0.0.0' to indicate local egress via WARP IPs. - `ipv6: Optional[str]` Specify the IPv6 range to use for egress. - `forensic_copy: Optional[ForensicCopy]` Configure whether a copy of the HTTP request will be sent to storage when the rule matches. - `enabled: Optional[bool]` Enable sending the copy to storage. - `ignore_cname_category_matches: Optional[bool]` Ignore category matches at CNAME domains in a response. When off, evaluate categories in this rule against all CNAME domain categories in the response. Settable only for `dns` and `dns_resolver` rules. - `insecure_disable_dnssec_validation: Optional[bool]` Specify whether to disable DNSSEC validation (for Allow actions) [INSECURE]. Settable only for `dns` rules. - `ip_categories: Optional[bool]` Enable IPs in DNS resolver category blocks. The system blocks only domain name categories unless you enable this setting. Settable only for `dns` and `dns_resolver` rules. - `ip_indicator_feeds: Optional[bool]` Indicates whether to include IPs in DNS resolver indicator feed blocks. Default, indicator feeds block only domain names. Settable only for `dns` and `dns_resolver` rules. - `l4override: Optional[L4override]` Send matching traffic to the supplied destination IP address and port. Settable only for `l4` rules with the action set to `l4_override`. - `ip: Optional[str]` Defines the IPv4 or IPv6 address. - `port: Optional[int]` Defines a port number to use for TCP/UDP overrides. - `notification_settings: Optional[NotificationSettings]` Configure a notification to display on the user's device when this rule matched. Settable for all types of rules with the action set to `block`. - `enabled: Optional[bool]` Enable notification. - `include_context: Optional[bool]` Indicates whether to pass the context information as query parameters. - `msg: Optional[str]` Customize the message shown in the notification. - `support_url: Optional[str]` Defines an optional URL to direct users to additional information. If unset, the notification opens a block page. - `override_host: Optional[str]` Defines a hostname for override, for the matching DNS queries. Settable only for `dns` rules with the action set to `override`. - `override_ips: Optional[List[str]]` Defines a an IP or set of IPs for overriding matched DNS queries. Settable only for `dns` rules with the action set to `override`. - `payload_log: Optional[PayloadLog]` Configure DLP payload logging. Settable only for `http` rules. - `enabled: Optional[bool]` Enable DLP payload logging for this rule. - `quarantine: Optional[Quarantine]` Configure settings that apply to quarantine rules. Settable only for `http` rules. - `file_types: Optional[List[Literal["exe", "pdf", "doc", 10 more]]]` Specify the types of files to sandbox. - `"exe"` - `"pdf"` - `"doc"` - `"docm"` - `"docx"` - `"rtf"` - `"ppt"` - `"pptx"` - `"xls"` - `"xlsm"` - `"xlsx"` - `"zip"` - `"rar"` - `redirect: Optional[Redirect]` Apply settings to redirect rules. Settable only for `http` rules with the action set to `redirect`. - `target_uri: str` Specify the URI to which the user is redirected. - `include_context: Optional[bool]` Specify whether to pass the context information as query parameters. - `preserve_path_and_query: Optional[bool]` Specify whether to append the path and query parameters from the original request to target_uri. - `resolve_dns_internally: Optional[ResolveDNSInternally]` Configure to forward the query to the internal DNS service, passing the specified 'view_id' as input. Not used when 'dns_resolvers' is specified or 'resolve_dns_through_cloudflare' is set. Only valid when a rule's action set to 'resolve'. Settable only for `dns_resolver` rules. - `fallback: Optional[Literal["none", "public_dns"]]` Specify the fallback behavior to apply when the internal DNS response code differs from 'NOERROR' or when the response data contains only CNAME records for 'A' or 'AAAA' queries. - `"none"` - `"public_dns"` - `view_id: Optional[str]` Specify the internal DNS view identifier to pass to the internal DNS service. - `resolve_dns_through_cloudflare: Optional[bool]` Enable to send queries that match the policy to Cloudflare's default 1.1.1.1 DNS resolver. Cannot set when 'dns_resolvers' specified or 'resolve_dns_internally' is set. Only valid when a rule's action set to 'resolve'. Settable only for `dns_resolver` rules. - `untrusted_cert: Optional[UntrustedCERT]` Configure behavior when an upstream certificate is invalid or an SSL error occurs. Settable only for `http` rules with the action set to `allow`. - `action: Optional[Literal["pass_through", "block", "error"]]` Defines the action performed when an untrusted certificate seen. The default action an error with HTTP code 526. - `"pass_through"` - `"block"` - `"error"` - `schedule: Optional[Schedule]` Defines the schedule for activating DNS policies. Settable only for `dns` and `dns_resolver` rules. - `fri: Optional[str]` Specify the time intervals when the rule is active on Fridays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Fridays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `mon: Optional[str]` Specify the time intervals when the rule is active on Mondays, in the increasing order from 00:00-24:00(capped at maximum of 6 time splits). If this parameter omitted, the rule is deactivated on Mondays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `sat: Optional[str]` Specify the time intervals when the rule is active on Saturdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Saturdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `sun: Optional[str]` Specify the time intervals when the rule is active on Sundays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Sundays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `thu: Optional[str]` Specify the time intervals when the rule is active on Thursdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Thursdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `time_zone: Optional[str]` Specify the time zone for rule evaluation. When a [valid time zone city name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) is provided, Gateway always uses the current time for that time zone. When this parameter is omitted, Gateway uses the time zone determined from the user's IP address. Colo time zone is used when the user's IP address does not resolve to a location. - `tue: Optional[str]` Specify the time intervals when the rule is active on Tuesdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Tuesdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `wed: Optional[str]` Specify the time intervals when the rule is active on Wednesdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Wednesdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `sharable: Optional[bool]` Indicate that this rule is sharable via the Orgs API. - `source_account: Optional[str]` Provide the account tag of the account that created the rule. - `updated_at: Optional[datetime]` - `version: Optional[int]` Indicate the version number of the rule(read-only). - `warning_status: Optional[str]` Indicate a warning for a misconfigured rule, if any. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) gateway_rule = client.zero_trust.gateway.rules.get( rule_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) print(gateway_rule.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "action": "allow", "enabled": true, "filters": [ "http" ], "name": "block bad websites", "precedence": 0, "traffic": "http.request.uri matches \".*a/partial/uri.*\" and http.request.host in $01302951-49f9-47c9-a400-0297e60b6a10", "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "created_at": "2014-01-01T05:20:00.12345Z", "deleted_at": "2019-12-27T18:11:19.117Z", "description": "Block bad websites based on their host name.", "device_posture": "any(device_posture.checks.passed[*] in {\"1308749e-fcfb-4ebc-b051-fe022b632644\"})", "expiration": { "expires_at": "2014-01-01T05:20:20Z", "duration": 10, "expired": false }, "identity": "any(identity.groups.name[*] in {\"finance\"})", "read_only": true, "rule_settings": { "add_headers": { "My-Next-Header": [ "foo", "bar" ], "X-Custom-Header-Name": [ "somecustomvalue" ] }, "allow_child_bypass": false, "audit_ssh": { "command_logging": false }, "biso_admin_controls": { "copy": "remote_only", "dcp": true, "dd": true, "dk": true, "download": "enabled", "dp": false, "du": true, "keyboard": "enabled", "paste": "enabled", "printing": "enabled", "upload": "enabled", "version": "v1" }, "block_page": { "target_uri": "https://example.com", "include_context": true }, "block_page_enabled": true, "block_reason": "This website is a security risk", "bypass_parent_rule": false, "check_session": { "duration": "300s", "enforce": true }, "dns_resolvers": { "ipv4": [ { "ip": "2.2.2.2", "port": 5053, "route_through_private_network": true, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415" } ], "ipv6": [ { "ip": "2001:DB8::", "port": 5053, "route_through_private_network": true, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415" } ] }, "egress": { "ipv4": "192.0.2.2", "ipv4_fallback": "192.0.2.3", "ipv6": "2001:DB8::/64" }, "forensic_copy": { "enabled": true }, "ignore_cname_category_matches": true, "insecure_disable_dnssec_validation": false, "ip_categories": true, "ip_indicator_feeds": true, "l4override": { "ip": "1.1.1.1", "port": 0 }, "notification_settings": { "enabled": true, "include_context": true, "msg": "msg", "support_url": "support_url" }, "override_host": "example.com", "override_ips": [ "1.1.1.1", "2.2.2.2" ], "payload_log": { "enabled": true }, "quarantine": { "file_types": [ "exe" ] }, "redirect": { "target_uri": "https://example.com", "include_context": true, "preserve_path_and_query": true }, "resolve_dns_internally": { "fallback": "none", "view_id": "view_id" }, "resolve_dns_through_cloudflare": true, "untrusted_cert": { "action": "error" } }, "schedule": { "fri": "08:00-12:30,13:30-17:00", "mon": "08:00-12:30,13:30-17:00", "sat": "08:00-12:30,13:30-17:00", "sun": "08:00-12:30,13:30-17:00", "thu": "08:00-12:30,13:30-17:00", "time_zone": "America/New York", "tue": "08:00-12:30,13:30-17:00", "wed": "08:00-12:30,13:30-17:00" }, "sharable": true, "source_account": "source_account", "updated_at": "2014-01-01T05:20:00.12345Z", "version": 1, "warning_status": "warning_status" } } ``` ## Create a Zero Trust Gateway rule `zero_trust.gateway.rules.create(RuleCreateParams**kwargs) -> GatewayRule` **post** `/accounts/{account_id}/gateway/rules` Create a new Zero Trust Gateway rule. ### Parameters - `account_id: str` - `action: Literal["on", "off", "allow", 13 more]` Specify the action to perform when the associated traffic, identity, and device posture expressions either absent or evaluate to `true`. - `"on"` - `"off"` - `"allow"` - `"block"` - `"scan"` - `"noscan"` - `"safesearch"` - `"ytrestricted"` - `"isolate"` - `"noisolate"` - `"override"` - `"l4_override"` - `"egress"` - `"resolve"` - `"quarantine"` - `"redirect"` - `name: str` Specify the rule name. - `description: Optional[str]` Specify the rule description. - `device_posture: Optional[str]` Specify the wirefilter expression used for device posture check. The API automatically formats and sanitizes expressions before storing them. To prevent Terraform state drift, use the formatted expression returned in the API response. - `enabled: Optional[bool]` Specify whether the rule is enabled. - `expiration: Optional[Expiration]` Defines the expiration time stamp and default duration of a DNS policy. Takes precedence over the policy's `schedule` configuration, if any. This does not apply to HTTP or network policies. Settable only for `dns` rules. - `expires_at: Union[str, datetime]` Show the timestamp when the policy expires and stops applying. The value must follow RFC 3339 and include a UTC offset. The system accepts non-zero offsets but converts them to the equivalent UTC+00:00 value and returns timestamps with a trailing Z. Expiration policies ignore client timezones and expire globally at the specified expires_at time. - `duration: Optional[int]` Defines the default duration a policy active in minutes. Must set in order to use the `reset_expiration` endpoint on this rule. - `expired: Optional[bool]` Indicates whether the policy is expired. - `filters: Optional[List[GatewayFilter]]` Specify the protocol or layer to evaluate the traffic, identity, and device posture expressions. Can only contain a single value. - `"http"` - `"dns"` - `"l4"` - `"egress"` - `"dns_resolver"` - `identity: Optional[str]` Specify the wirefilter expression used for identity matching. The API automatically formats and sanitizes expressions before storing them. To prevent Terraform state drift, use the formatted expression returned in the API response. - `precedence: Optional[int]` Set the order of your rules. Lower values indicate higher precedence. At each processing phase, evaluate applicable rules in ascending order of this value. Refer to [Order of enforcement](http://developers.cloudflare.com/learning-paths/secure-internet-traffic/understand-policies/order-of-enforcement/#manage-precedence-with-terraform) to manage precedence via Terraform. - `rule_settings: Optional[RuleSettingParam]` Defines settings for this rule. Settings apply only to specific rule types and must use compatible selectors. If Terraform detects drift, confirm the setting supports your rule type and check whether the API modifies the value. Use API-returned values in your configuration to prevent drift. - `add_headers: Optional[Dict[str, List[str]]]` Add custom headers to allowed requests as key-value pairs. Use header names as keys that map to arrays of header values. Settable only for `http` rules with the action set to `allow`. - `allow_child_bypass: Optional[bool]` Set to enable MSP children to bypass this rule. Only parent MSP accounts can set this. this rule. Settable for all types of rules. - `audit_ssh: Optional[AuditSSH]` Define the settings for the Audit SSH action. Settable only for `l4` rules with `audit_ssh` action. - `command_logging: Optional[bool]` Enable SSH command logging. - `biso_admin_controls: Optional[BISOAdminControls]` Configure browser isolation behavior. Settable only for `http` rules with the action set to `isolate`. - `copy: Optional[Literal["enabled", "disabled", "remote_only"]]` Configure copy behavior. If set to remote_only, users cannot copy isolated content from the remote browser to the local clipboard. If this field is absent, copying remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `"remote_only"` - `dcp: Optional[bool]` Set to false to enable copy-pasting. Only applies when `version == "v1"`. - `dd: Optional[bool]` Set to false to enable downloading. Only applies when `version == "v1"`. - `dk: Optional[bool]` Set to false to enable keyboard usage. Only applies when `version == "v1"`. - `download: Optional[Literal["enabled", "disabled", "remote_only"]]` Configure download behavior. When set to remote_only, users can view downloads but cannot save them. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `"remote_only"` - `dp: Optional[bool]` Set to false to enable printing. Only applies when `version == "v1"`. - `du: Optional[bool]` Set to false to enable uploading. Only applies when `version == "v1"`. - `keyboard: Optional[Literal["enabled", "disabled"]]` Configure keyboard usage behavior. If this field is absent, keyboard usage remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `paste: Optional[Literal["enabled", "disabled", "remote_only"]]` Configure paste behavior. If set to remote_only, users cannot paste content from the local clipboard into isolated pages. If this field is absent, pasting remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `"remote_only"` - `printing: Optional[Literal["enabled", "disabled"]]` Configure print behavior. Default, Printing is enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `upload: Optional[Literal["enabled", "disabled"]]` Configure upload behavior. If this field is absent, uploading remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `version: Optional[Literal["v1", "v2"]]` Indicate which version of the browser isolation controls should apply. - `"v1"` - `"v2"` - `block_page: Optional[BlockPage]` Configure custom block page settings. If missing or null, use the account settings. Settable only for `http` rules with the action set to `block`. - `target_uri: str` Specify the URI to which the user is redirected. - `include_context: Optional[bool]` Specify whether to pass the context information as query parameters. - `block_page_enabled: Optional[bool]` Enable the custom block page. Settable only for `dns` rules with action `block`. - `block_reason: Optional[str]` Explain why the rule blocks the request. The custom block page shows this text (if enabled). Settable only for `dns`, `l4`, and `http` rules when the action set to `block`. - `bypass_parent_rule: Optional[bool]` Set to enable MSP accounts to bypass their parent's rules. Only MSP child accounts can set this. Settable for all types of rules. - `check_session: Optional[CheckSession]` Configure session check behavior. Settable only for `l4` and `http` rules with the action set to `allow`. - `duration: Optional[str]` Sets the required session freshness threshold. The API returns a normalized version of this value. - `enforce: Optional[bool]` Enable session enforcement. - `dns_resolvers: Optional[DNSResolvers]` Configure custom resolvers to route queries that match the resolver policy. Unused with 'resolve_dns_through_cloudflare' or 'resolve_dns_internally' settings. DNS queries get routed to the address closest to their origin. Only valid when a rule's action set to 'resolve'. Settable only for `dns_resolver` rules. - `ipv4: Optional[List[DNSResolverSettingsV4]]` - `ip: str` Specify the IPv4 address of the upstream resolver. - `port: Optional[int]` Specify a port number to use for the upstream resolver. Defaults to 53 if unspecified. - `route_through_private_network: Optional[bool]` Indicate whether to connect to this resolver over a private network. Must set when vnet_id set. - `vnet_id: Optional[str]` Specify an optional virtual network for this resolver. Uses default virtual network id if omitted. - `ipv6: Optional[List[DNSResolverSettingsV6]]` - `ip: str` Specify the IPv6 address of the upstream resolver. - `port: Optional[int]` Specify a port number to use for the upstream resolver. Defaults to 53 if unspecified. - `route_through_private_network: Optional[bool]` Indicate whether to connect to this resolver over a private network. Must set when vnet_id set. - `vnet_id: Optional[str]` Specify an optional virtual network for this resolver. Uses default virtual network id if omitted. - `egress: Optional[Egress]` Configure how Gateway Proxy traffic egresses. You can enable this setting for rules with Egress actions and filters, or omit it to indicate local egress via WARP IPs. Settable only for `egress` rules. - `ipv4: Optional[str]` Specify the IPv4 address to use for egress. - `ipv4_fallback: Optional[str]` Specify the fallback IPv4 address to use for egress when the primary IPv4 fails. Set '0.0.0.0' to indicate local egress via WARP IPs. - `ipv6: Optional[str]` Specify the IPv6 range to use for egress. - `forensic_copy: Optional[ForensicCopy]` Configure whether a copy of the HTTP request will be sent to storage when the rule matches. - `enabled: Optional[bool]` Enable sending the copy to storage. - `ignore_cname_category_matches: Optional[bool]` Ignore category matches at CNAME domains in a response. When off, evaluate categories in this rule against all CNAME domain categories in the response. Settable only for `dns` and `dns_resolver` rules. - `insecure_disable_dnssec_validation: Optional[bool]` Specify whether to disable DNSSEC validation (for Allow actions) [INSECURE]. Settable only for `dns` rules. - `ip_categories: Optional[bool]` Enable IPs in DNS resolver category blocks. The system blocks only domain name categories unless you enable this setting. Settable only for `dns` and `dns_resolver` rules. - `ip_indicator_feeds: Optional[bool]` Indicates whether to include IPs in DNS resolver indicator feed blocks. Default, indicator feeds block only domain names. Settable only for `dns` and `dns_resolver` rules. - `l4override: Optional[L4override]` Send matching traffic to the supplied destination IP address and port. Settable only for `l4` rules with the action set to `l4_override`. - `ip: Optional[str]` Defines the IPv4 or IPv6 address. - `port: Optional[int]` Defines a port number to use for TCP/UDP overrides. - `notification_settings: Optional[NotificationSettings]` Configure a notification to display on the user's device when this rule matched. Settable for all types of rules with the action set to `block`. - `enabled: Optional[bool]` Enable notification. - `include_context: Optional[bool]` Indicates whether to pass the context information as query parameters. - `msg: Optional[str]` Customize the message shown in the notification. - `support_url: Optional[str]` Defines an optional URL to direct users to additional information. If unset, the notification opens a block page. - `override_host: Optional[str]` Defines a hostname for override, for the matching DNS queries. Settable only for `dns` rules with the action set to `override`. - `override_ips: Optional[List[str]]` Defines a an IP or set of IPs for overriding matched DNS queries. Settable only for `dns` rules with the action set to `override`. - `payload_log: Optional[PayloadLog]` Configure DLP payload logging. Settable only for `http` rules. - `enabled: Optional[bool]` Enable DLP payload logging for this rule. - `quarantine: Optional[Quarantine]` Configure settings that apply to quarantine rules. Settable only for `http` rules. - `file_types: Optional[List[Literal["exe", "pdf", "doc", 10 more]]]` Specify the types of files to sandbox. - `"exe"` - `"pdf"` - `"doc"` - `"docm"` - `"docx"` - `"rtf"` - `"ppt"` - `"pptx"` - `"xls"` - `"xlsm"` - `"xlsx"` - `"zip"` - `"rar"` - `redirect: Optional[Redirect]` Apply settings to redirect rules. Settable only for `http` rules with the action set to `redirect`. - `target_uri: str` Specify the URI to which the user is redirected. - `include_context: Optional[bool]` Specify whether to pass the context information as query parameters. - `preserve_path_and_query: Optional[bool]` Specify whether to append the path and query parameters from the original request to target_uri. - `resolve_dns_internally: Optional[ResolveDNSInternally]` Configure to forward the query to the internal DNS service, passing the specified 'view_id' as input. Not used when 'dns_resolvers' is specified or 'resolve_dns_through_cloudflare' is set. Only valid when a rule's action set to 'resolve'. Settable only for `dns_resolver` rules. - `fallback: Optional[Literal["none", "public_dns"]]` Specify the fallback behavior to apply when the internal DNS response code differs from 'NOERROR' or when the response data contains only CNAME records for 'A' or 'AAAA' queries. - `"none"` - `"public_dns"` - `view_id: Optional[str]` Specify the internal DNS view identifier to pass to the internal DNS service. - `resolve_dns_through_cloudflare: Optional[bool]` Enable to send queries that match the policy to Cloudflare's default 1.1.1.1 DNS resolver. Cannot set when 'dns_resolvers' specified or 'resolve_dns_internally' is set. Only valid when a rule's action set to 'resolve'. Settable only for `dns_resolver` rules. - `untrusted_cert: Optional[UntrustedCERT]` Configure behavior when an upstream certificate is invalid or an SSL error occurs. Settable only for `http` rules with the action set to `allow`. - `action: Optional[Literal["pass_through", "block", "error"]]` Defines the action performed when an untrusted certificate seen. The default action an error with HTTP code 526. - `"pass_through"` - `"block"` - `"error"` - `schedule: Optional[ScheduleParam]` Defines the schedule for activating DNS policies. Settable only for `dns` and `dns_resolver` rules. - `fri: Optional[str]` Specify the time intervals when the rule is active on Fridays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Fridays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `mon: Optional[str]` Specify the time intervals when the rule is active on Mondays, in the increasing order from 00:00-24:00(capped at maximum of 6 time splits). If this parameter omitted, the rule is deactivated on Mondays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `sat: Optional[str]` Specify the time intervals when the rule is active on Saturdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Saturdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `sun: Optional[str]` Specify the time intervals when the rule is active on Sundays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Sundays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `thu: Optional[str]` Specify the time intervals when the rule is active on Thursdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Thursdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `time_zone: Optional[str]` Specify the time zone for rule evaluation. When a [valid time zone city name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) is provided, Gateway always uses the current time for that time zone. When this parameter is omitted, Gateway uses the time zone determined from the user's IP address. Colo time zone is used when the user's IP address does not resolve to a location. - `tue: Optional[str]` Specify the time intervals when the rule is active on Tuesdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Tuesdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `wed: Optional[str]` Specify the time intervals when the rule is active on Wednesdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Wednesdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `traffic: Optional[str]` Specify the wirefilter expression used for traffic matching. The API automatically formats and sanitizes expressions before storing them. To prevent Terraform state drift, use the formatted expression returned in the API response. ### Returns - `class GatewayRule: …` - `action: Literal["on", "off", "allow", 13 more]` Specify the action to perform when the associated traffic, identity, and device posture expressions either absent or evaluate to `true`. - `"on"` - `"off"` - `"allow"` - `"block"` - `"scan"` - `"noscan"` - `"safesearch"` - `"ytrestricted"` - `"isolate"` - `"noisolate"` - `"override"` - `"l4_override"` - `"egress"` - `"resolve"` - `"quarantine"` - `"redirect"` - `enabled: bool` Specify whether the rule is enabled. - `filters: List[GatewayFilter]` Specify the protocol or layer to evaluate the traffic, identity, and device posture expressions. Can only contain a single value. - `"http"` - `"dns"` - `"l4"` - `"egress"` - `"dns_resolver"` - `name: str` Specify the rule name. - `precedence: int` Set the order of your rules. Lower values indicate higher precedence. At each processing phase, evaluate applicable rules in ascending order of this value. Refer to [Order of enforcement](http://developers.cloudflare.com/learning-paths/secure-internet-traffic/understand-policies/order-of-enforcement/#manage-precedence-with-terraform) to manage precedence via Terraform. - `traffic: str` Specify the wirefilter expression used for traffic matching. The API automatically formats and sanitizes expressions before storing them. To prevent Terraform state drift, use the formatted expression returned in the API response. - `id: Optional[str]` Identify the API resource with a UUID. - `created_at: Optional[datetime]` - `deleted_at: Optional[datetime]` Indicate the date of deletion, if any. - `description: Optional[str]` Specify the rule description. - `device_posture: Optional[str]` Specify the wirefilter expression used for device posture check. The API automatically formats and sanitizes expressions before storing them. To prevent Terraform state drift, use the formatted expression returned in the API response. - `expiration: Optional[Expiration]` Defines the expiration time stamp and default duration of a DNS policy. Takes precedence over the policy's `schedule` configuration, if any. This does not apply to HTTP or network policies. Settable only for `dns` rules. - `expires_at: datetime` Show the timestamp when the policy expires and stops applying. The value must follow RFC 3339 and include a UTC offset. The system accepts non-zero offsets but converts them to the equivalent UTC+00:00 value and returns timestamps with a trailing Z. Expiration policies ignore client timezones and expire globally at the specified expires_at time. - `duration: Optional[int]` Defines the default duration a policy active in minutes. Must set in order to use the `reset_expiration` endpoint on this rule. - `expired: Optional[bool]` Indicates whether the policy is expired. - `identity: Optional[str]` Specify the wirefilter expression used for identity matching. The API automatically formats and sanitizes expressions before storing them. To prevent Terraform state drift, use the formatted expression returned in the API response. - `read_only: Optional[bool]` Indicate that this rule is shared via the Orgs API and read only. - `rule_settings: Optional[RuleSetting]` Defines settings for this rule. Settings apply only to specific rule types and must use compatible selectors. If Terraform detects drift, confirm the setting supports your rule type and check whether the API modifies the value. Use API-returned values in your configuration to prevent drift. - `add_headers: Optional[Dict[str, List[str]]]` Add custom headers to allowed requests as key-value pairs. Use header names as keys that map to arrays of header values. Settable only for `http` rules with the action set to `allow`. - `allow_child_bypass: Optional[bool]` Set to enable MSP children to bypass this rule. Only parent MSP accounts can set this. this rule. Settable for all types of rules. - `audit_ssh: Optional[AuditSSH]` Define the settings for the Audit SSH action. Settable only for `l4` rules with `audit_ssh` action. - `command_logging: Optional[bool]` Enable SSH command logging. - `biso_admin_controls: Optional[BISOAdminControls]` Configure browser isolation behavior. Settable only for `http` rules with the action set to `isolate`. - `copy: Optional[Literal["enabled", "disabled", "remote_only"]]` Configure copy behavior. If set to remote_only, users cannot copy isolated content from the remote browser to the local clipboard. If this field is absent, copying remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `"remote_only"` - `dcp: Optional[bool]` Set to false to enable copy-pasting. Only applies when `version == "v1"`. - `dd: Optional[bool]` Set to false to enable downloading. Only applies when `version == "v1"`. - `dk: Optional[bool]` Set to false to enable keyboard usage. Only applies when `version == "v1"`. - `download: Optional[Literal["enabled", "disabled", "remote_only"]]` Configure download behavior. When set to remote_only, users can view downloads but cannot save them. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `"remote_only"` - `dp: Optional[bool]` Set to false to enable printing. Only applies when `version == "v1"`. - `du: Optional[bool]` Set to false to enable uploading. Only applies when `version == "v1"`. - `keyboard: Optional[Literal["enabled", "disabled"]]` Configure keyboard usage behavior. If this field is absent, keyboard usage remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `paste: Optional[Literal["enabled", "disabled", "remote_only"]]` Configure paste behavior. If set to remote_only, users cannot paste content from the local clipboard into isolated pages. If this field is absent, pasting remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `"remote_only"` - `printing: Optional[Literal["enabled", "disabled"]]` Configure print behavior. Default, Printing is enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `upload: Optional[Literal["enabled", "disabled"]]` Configure upload behavior. If this field is absent, uploading remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `version: Optional[Literal["v1", "v2"]]` Indicate which version of the browser isolation controls should apply. - `"v1"` - `"v2"` - `block_page: Optional[BlockPage]` Configure custom block page settings. If missing or null, use the account settings. Settable only for `http` rules with the action set to `block`. - `target_uri: str` Specify the URI to which the user is redirected. - `include_context: Optional[bool]` Specify whether to pass the context information as query parameters. - `block_page_enabled: Optional[bool]` Enable the custom block page. Settable only for `dns` rules with action `block`. - `block_reason: Optional[str]` Explain why the rule blocks the request. The custom block page shows this text (if enabled). Settable only for `dns`, `l4`, and `http` rules when the action set to `block`. - `bypass_parent_rule: Optional[bool]` Set to enable MSP accounts to bypass their parent's rules. Only MSP child accounts can set this. Settable for all types of rules. - `check_session: Optional[CheckSession]` Configure session check behavior. Settable only for `l4` and `http` rules with the action set to `allow`. - `duration: Optional[str]` Sets the required session freshness threshold. The API returns a normalized version of this value. - `enforce: Optional[bool]` Enable session enforcement. - `dns_resolvers: Optional[DNSResolvers]` Configure custom resolvers to route queries that match the resolver policy. Unused with 'resolve_dns_through_cloudflare' or 'resolve_dns_internally' settings. DNS queries get routed to the address closest to their origin. Only valid when a rule's action set to 'resolve'. Settable only for `dns_resolver` rules. - `ipv4: Optional[List[DNSResolverSettingsV4]]` - `ip: str` Specify the IPv4 address of the upstream resolver. - `port: Optional[int]` Specify a port number to use for the upstream resolver. Defaults to 53 if unspecified. - `route_through_private_network: Optional[bool]` Indicate whether to connect to this resolver over a private network. Must set when vnet_id set. - `vnet_id: Optional[str]` Specify an optional virtual network for this resolver. Uses default virtual network id if omitted. - `ipv6: Optional[List[DNSResolverSettingsV6]]` - `ip: str` Specify the IPv6 address of the upstream resolver. - `port: Optional[int]` Specify a port number to use for the upstream resolver. Defaults to 53 if unspecified. - `route_through_private_network: Optional[bool]` Indicate whether to connect to this resolver over a private network. Must set when vnet_id set. - `vnet_id: Optional[str]` Specify an optional virtual network for this resolver. Uses default virtual network id if omitted. - `egress: Optional[Egress]` Configure how Gateway Proxy traffic egresses. You can enable this setting for rules with Egress actions and filters, or omit it to indicate local egress via WARP IPs. Settable only for `egress` rules. - `ipv4: Optional[str]` Specify the IPv4 address to use for egress. - `ipv4_fallback: Optional[str]` Specify the fallback IPv4 address to use for egress when the primary IPv4 fails. Set '0.0.0.0' to indicate local egress via WARP IPs. - `ipv6: Optional[str]` Specify the IPv6 range to use for egress. - `forensic_copy: Optional[ForensicCopy]` Configure whether a copy of the HTTP request will be sent to storage when the rule matches. - `enabled: Optional[bool]` Enable sending the copy to storage. - `ignore_cname_category_matches: Optional[bool]` Ignore category matches at CNAME domains in a response. When off, evaluate categories in this rule against all CNAME domain categories in the response. Settable only for `dns` and `dns_resolver` rules. - `insecure_disable_dnssec_validation: Optional[bool]` Specify whether to disable DNSSEC validation (for Allow actions) [INSECURE]. Settable only for `dns` rules. - `ip_categories: Optional[bool]` Enable IPs in DNS resolver category blocks. The system blocks only domain name categories unless you enable this setting. Settable only for `dns` and `dns_resolver` rules. - `ip_indicator_feeds: Optional[bool]` Indicates whether to include IPs in DNS resolver indicator feed blocks. Default, indicator feeds block only domain names. Settable only for `dns` and `dns_resolver` rules. - `l4override: Optional[L4override]` Send matching traffic to the supplied destination IP address and port. Settable only for `l4` rules with the action set to `l4_override`. - `ip: Optional[str]` Defines the IPv4 or IPv6 address. - `port: Optional[int]` Defines a port number to use for TCP/UDP overrides. - `notification_settings: Optional[NotificationSettings]` Configure a notification to display on the user's device when this rule matched. Settable for all types of rules with the action set to `block`. - `enabled: Optional[bool]` Enable notification. - `include_context: Optional[bool]` Indicates whether to pass the context information as query parameters. - `msg: Optional[str]` Customize the message shown in the notification. - `support_url: Optional[str]` Defines an optional URL to direct users to additional information. If unset, the notification opens a block page. - `override_host: Optional[str]` Defines a hostname for override, for the matching DNS queries. Settable only for `dns` rules with the action set to `override`. - `override_ips: Optional[List[str]]` Defines a an IP or set of IPs for overriding matched DNS queries. Settable only for `dns` rules with the action set to `override`. - `payload_log: Optional[PayloadLog]` Configure DLP payload logging. Settable only for `http` rules. - `enabled: Optional[bool]` Enable DLP payload logging for this rule. - `quarantine: Optional[Quarantine]` Configure settings that apply to quarantine rules. Settable only for `http` rules. - `file_types: Optional[List[Literal["exe", "pdf", "doc", 10 more]]]` Specify the types of files to sandbox. - `"exe"` - `"pdf"` - `"doc"` - `"docm"` - `"docx"` - `"rtf"` - `"ppt"` - `"pptx"` - `"xls"` - `"xlsm"` - `"xlsx"` - `"zip"` - `"rar"` - `redirect: Optional[Redirect]` Apply settings to redirect rules. Settable only for `http` rules with the action set to `redirect`. - `target_uri: str` Specify the URI to which the user is redirected. - `include_context: Optional[bool]` Specify whether to pass the context information as query parameters. - `preserve_path_and_query: Optional[bool]` Specify whether to append the path and query parameters from the original request to target_uri. - `resolve_dns_internally: Optional[ResolveDNSInternally]` Configure to forward the query to the internal DNS service, passing the specified 'view_id' as input. Not used when 'dns_resolvers' is specified or 'resolve_dns_through_cloudflare' is set. Only valid when a rule's action set to 'resolve'. Settable only for `dns_resolver` rules. - `fallback: Optional[Literal["none", "public_dns"]]` Specify the fallback behavior to apply when the internal DNS response code differs from 'NOERROR' or when the response data contains only CNAME records for 'A' or 'AAAA' queries. - `"none"` - `"public_dns"` - `view_id: Optional[str]` Specify the internal DNS view identifier to pass to the internal DNS service. - `resolve_dns_through_cloudflare: Optional[bool]` Enable to send queries that match the policy to Cloudflare's default 1.1.1.1 DNS resolver. Cannot set when 'dns_resolvers' specified or 'resolve_dns_internally' is set. Only valid when a rule's action set to 'resolve'. Settable only for `dns_resolver` rules. - `untrusted_cert: Optional[UntrustedCERT]` Configure behavior when an upstream certificate is invalid or an SSL error occurs. Settable only for `http` rules with the action set to `allow`. - `action: Optional[Literal["pass_through", "block", "error"]]` Defines the action performed when an untrusted certificate seen. The default action an error with HTTP code 526. - `"pass_through"` - `"block"` - `"error"` - `schedule: Optional[Schedule]` Defines the schedule for activating DNS policies. Settable only for `dns` and `dns_resolver` rules. - `fri: Optional[str]` Specify the time intervals when the rule is active on Fridays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Fridays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `mon: Optional[str]` Specify the time intervals when the rule is active on Mondays, in the increasing order from 00:00-24:00(capped at maximum of 6 time splits). If this parameter omitted, the rule is deactivated on Mondays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `sat: Optional[str]` Specify the time intervals when the rule is active on Saturdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Saturdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `sun: Optional[str]` Specify the time intervals when the rule is active on Sundays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Sundays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `thu: Optional[str]` Specify the time intervals when the rule is active on Thursdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Thursdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `time_zone: Optional[str]` Specify the time zone for rule evaluation. When a [valid time zone city name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) is provided, Gateway always uses the current time for that time zone. When this parameter is omitted, Gateway uses the time zone determined from the user's IP address. Colo time zone is used when the user's IP address does not resolve to a location. - `tue: Optional[str]` Specify the time intervals when the rule is active on Tuesdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Tuesdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `wed: Optional[str]` Specify the time intervals when the rule is active on Wednesdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Wednesdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `sharable: Optional[bool]` Indicate that this rule is sharable via the Orgs API. - `source_account: Optional[str]` Provide the account tag of the account that created the rule. - `updated_at: Optional[datetime]` - `version: Optional[int]` Indicate the version number of the rule(read-only). - `warning_status: Optional[str]` Indicate a warning for a misconfigured rule, if any. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) gateway_rule = client.zero_trust.gateway.rules.create( account_id="699d98642c564d2e855e9661899b7252", action="allow", name="block bad websites", ) print(gateway_rule.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "action": "allow", "enabled": true, "filters": [ "http" ], "name": "block bad websites", "precedence": 0, "traffic": "http.request.uri matches \".*a/partial/uri.*\" and http.request.host in $01302951-49f9-47c9-a400-0297e60b6a10", "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "created_at": "2014-01-01T05:20:00.12345Z", "deleted_at": "2019-12-27T18:11:19.117Z", "description": "Block bad websites based on their host name.", "device_posture": "any(device_posture.checks.passed[*] in {\"1308749e-fcfb-4ebc-b051-fe022b632644\"})", "expiration": { "expires_at": "2014-01-01T05:20:20Z", "duration": 10, "expired": false }, "identity": "any(identity.groups.name[*] in {\"finance\"})", "read_only": true, "rule_settings": { "add_headers": { "My-Next-Header": [ "foo", "bar" ], "X-Custom-Header-Name": [ "somecustomvalue" ] }, "allow_child_bypass": false, "audit_ssh": { "command_logging": false }, "biso_admin_controls": { "copy": "remote_only", "dcp": true, "dd": true, "dk": true, "download": "enabled", "dp": false, "du": true, "keyboard": "enabled", "paste": "enabled", "printing": "enabled", "upload": "enabled", "version": "v1" }, "block_page": { "target_uri": "https://example.com", "include_context": true }, "block_page_enabled": true, "block_reason": "This website is a security risk", "bypass_parent_rule": false, "check_session": { "duration": "300s", "enforce": true }, "dns_resolvers": { "ipv4": [ { "ip": "2.2.2.2", "port": 5053, "route_through_private_network": true, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415" } ], "ipv6": [ { "ip": "2001:DB8::", "port": 5053, "route_through_private_network": true, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415" } ] }, "egress": { "ipv4": "192.0.2.2", "ipv4_fallback": "192.0.2.3", "ipv6": "2001:DB8::/64" }, "forensic_copy": { "enabled": true }, "ignore_cname_category_matches": true, "insecure_disable_dnssec_validation": false, "ip_categories": true, "ip_indicator_feeds": true, "l4override": { "ip": "1.1.1.1", "port": 0 }, "notification_settings": { "enabled": true, "include_context": true, "msg": "msg", "support_url": "support_url" }, "override_host": "example.com", "override_ips": [ "1.1.1.1", "2.2.2.2" ], "payload_log": { "enabled": true }, "quarantine": { "file_types": [ "exe" ] }, "redirect": { "target_uri": "https://example.com", "include_context": true, "preserve_path_and_query": true }, "resolve_dns_internally": { "fallback": "none", "view_id": "view_id" }, "resolve_dns_through_cloudflare": true, "untrusted_cert": { "action": "error" } }, "schedule": { "fri": "08:00-12:30,13:30-17:00", "mon": "08:00-12:30,13:30-17:00", "sat": "08:00-12:30,13:30-17:00", "sun": "08:00-12:30,13:30-17:00", "thu": "08:00-12:30,13:30-17:00", "time_zone": "America/New York", "tue": "08:00-12:30,13:30-17:00", "wed": "08:00-12:30,13:30-17:00" }, "sharable": true, "source_account": "source_account", "updated_at": "2014-01-01T05:20:00.12345Z", "version": 1, "warning_status": "warning_status" } } ``` ## Update a Zero Trust Gateway rule `zero_trust.gateway.rules.update(strrule_id, RuleUpdateParams**kwargs) -> GatewayRule` **put** `/accounts/{account_id}/gateway/rules/{rule_id}` Update a configured Zero Trust Gateway rule. ### Parameters - `account_id: str` - `rule_id: str` Identify the API resource with a UUID. - `action: Literal["on", "off", "allow", 13 more]` Specify the action to perform when the associated traffic, identity, and device posture expressions either absent or evaluate to `true`. - `"on"` - `"off"` - `"allow"` - `"block"` - `"scan"` - `"noscan"` - `"safesearch"` - `"ytrestricted"` - `"isolate"` - `"noisolate"` - `"override"` - `"l4_override"` - `"egress"` - `"resolve"` - `"quarantine"` - `"redirect"` - `name: str` Specify the rule name. - `description: Optional[str]` Specify the rule description. - `device_posture: Optional[str]` Specify the wirefilter expression used for device posture check. The API automatically formats and sanitizes expressions before storing them. To prevent Terraform state drift, use the formatted expression returned in the API response. - `enabled: Optional[bool]` Specify whether the rule is enabled. - `expiration: Optional[Expiration]` Defines the expiration time stamp and default duration of a DNS policy. Takes precedence over the policy's `schedule` configuration, if any. This does not apply to HTTP or network policies. Settable only for `dns` rules. - `expires_at: Union[str, datetime]` Show the timestamp when the policy expires and stops applying. The value must follow RFC 3339 and include a UTC offset. The system accepts non-zero offsets but converts them to the equivalent UTC+00:00 value and returns timestamps with a trailing Z. Expiration policies ignore client timezones and expire globally at the specified expires_at time. - `duration: Optional[int]` Defines the default duration a policy active in minutes. Must set in order to use the `reset_expiration` endpoint on this rule. - `expired: Optional[bool]` Indicates whether the policy is expired. - `filters: Optional[List[GatewayFilter]]` Specify the protocol or layer to evaluate the traffic, identity, and device posture expressions. Can only contain a single value. - `"http"` - `"dns"` - `"l4"` - `"egress"` - `"dns_resolver"` - `identity: Optional[str]` Specify the wirefilter expression used for identity matching. The API automatically formats and sanitizes expressions before storing them. To prevent Terraform state drift, use the formatted expression returned in the API response. - `precedence: Optional[int]` Set the order of your rules. Lower values indicate higher precedence. At each processing phase, evaluate applicable rules in ascending order of this value. Refer to [Order of enforcement](http://developers.cloudflare.com/learning-paths/secure-internet-traffic/understand-policies/order-of-enforcement/#manage-precedence-with-terraform) to manage precedence via Terraform. - `rule_settings: Optional[RuleSettingParam]` Defines settings for this rule. Settings apply only to specific rule types and must use compatible selectors. If Terraform detects drift, confirm the setting supports your rule type and check whether the API modifies the value. Use API-returned values in your configuration to prevent drift. - `add_headers: Optional[Dict[str, List[str]]]` Add custom headers to allowed requests as key-value pairs. Use header names as keys that map to arrays of header values. Settable only for `http` rules with the action set to `allow`. - `allow_child_bypass: Optional[bool]` Set to enable MSP children to bypass this rule. Only parent MSP accounts can set this. this rule. Settable for all types of rules. - `audit_ssh: Optional[AuditSSH]` Define the settings for the Audit SSH action. Settable only for `l4` rules with `audit_ssh` action. - `command_logging: Optional[bool]` Enable SSH command logging. - `biso_admin_controls: Optional[BISOAdminControls]` Configure browser isolation behavior. Settable only for `http` rules with the action set to `isolate`. - `copy: Optional[Literal["enabled", "disabled", "remote_only"]]` Configure copy behavior. If set to remote_only, users cannot copy isolated content from the remote browser to the local clipboard. If this field is absent, copying remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `"remote_only"` - `dcp: Optional[bool]` Set to false to enable copy-pasting. Only applies when `version == "v1"`. - `dd: Optional[bool]` Set to false to enable downloading. Only applies when `version == "v1"`. - `dk: Optional[bool]` Set to false to enable keyboard usage. Only applies when `version == "v1"`. - `download: Optional[Literal["enabled", "disabled", "remote_only"]]` Configure download behavior. When set to remote_only, users can view downloads but cannot save them. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `"remote_only"` - `dp: Optional[bool]` Set to false to enable printing. Only applies when `version == "v1"`. - `du: Optional[bool]` Set to false to enable uploading. Only applies when `version == "v1"`. - `keyboard: Optional[Literal["enabled", "disabled"]]` Configure keyboard usage behavior. If this field is absent, keyboard usage remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `paste: Optional[Literal["enabled", "disabled", "remote_only"]]` Configure paste behavior. If set to remote_only, users cannot paste content from the local clipboard into isolated pages. If this field is absent, pasting remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `"remote_only"` - `printing: Optional[Literal["enabled", "disabled"]]` Configure print behavior. Default, Printing is enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `upload: Optional[Literal["enabled", "disabled"]]` Configure upload behavior. If this field is absent, uploading remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `version: Optional[Literal["v1", "v2"]]` Indicate which version of the browser isolation controls should apply. - `"v1"` - `"v2"` - `block_page: Optional[BlockPage]` Configure custom block page settings. If missing or null, use the account settings. Settable only for `http` rules with the action set to `block`. - `target_uri: str` Specify the URI to which the user is redirected. - `include_context: Optional[bool]` Specify whether to pass the context information as query parameters. - `block_page_enabled: Optional[bool]` Enable the custom block page. Settable only for `dns` rules with action `block`. - `block_reason: Optional[str]` Explain why the rule blocks the request. The custom block page shows this text (if enabled). Settable only for `dns`, `l4`, and `http` rules when the action set to `block`. - `bypass_parent_rule: Optional[bool]` Set to enable MSP accounts to bypass their parent's rules. Only MSP child accounts can set this. Settable for all types of rules. - `check_session: Optional[CheckSession]` Configure session check behavior. Settable only for `l4` and `http` rules with the action set to `allow`. - `duration: Optional[str]` Sets the required session freshness threshold. The API returns a normalized version of this value. - `enforce: Optional[bool]` Enable session enforcement. - `dns_resolvers: Optional[DNSResolvers]` Configure custom resolvers to route queries that match the resolver policy. Unused with 'resolve_dns_through_cloudflare' or 'resolve_dns_internally' settings. DNS queries get routed to the address closest to their origin. Only valid when a rule's action set to 'resolve'. Settable only for `dns_resolver` rules. - `ipv4: Optional[List[DNSResolverSettingsV4]]` - `ip: str` Specify the IPv4 address of the upstream resolver. - `port: Optional[int]` Specify a port number to use for the upstream resolver. Defaults to 53 if unspecified. - `route_through_private_network: Optional[bool]` Indicate whether to connect to this resolver over a private network. Must set when vnet_id set. - `vnet_id: Optional[str]` Specify an optional virtual network for this resolver. Uses default virtual network id if omitted. - `ipv6: Optional[List[DNSResolverSettingsV6]]` - `ip: str` Specify the IPv6 address of the upstream resolver. - `port: Optional[int]` Specify a port number to use for the upstream resolver. Defaults to 53 if unspecified. - `route_through_private_network: Optional[bool]` Indicate whether to connect to this resolver over a private network. Must set when vnet_id set. - `vnet_id: Optional[str]` Specify an optional virtual network for this resolver. Uses default virtual network id if omitted. - `egress: Optional[Egress]` Configure how Gateway Proxy traffic egresses. You can enable this setting for rules with Egress actions and filters, or omit it to indicate local egress via WARP IPs. Settable only for `egress` rules. - `ipv4: Optional[str]` Specify the IPv4 address to use for egress. - `ipv4_fallback: Optional[str]` Specify the fallback IPv4 address to use for egress when the primary IPv4 fails. Set '0.0.0.0' to indicate local egress via WARP IPs. - `ipv6: Optional[str]` Specify the IPv6 range to use for egress. - `forensic_copy: Optional[ForensicCopy]` Configure whether a copy of the HTTP request will be sent to storage when the rule matches. - `enabled: Optional[bool]` Enable sending the copy to storage. - `ignore_cname_category_matches: Optional[bool]` Ignore category matches at CNAME domains in a response. When off, evaluate categories in this rule against all CNAME domain categories in the response. Settable only for `dns` and `dns_resolver` rules. - `insecure_disable_dnssec_validation: Optional[bool]` Specify whether to disable DNSSEC validation (for Allow actions) [INSECURE]. Settable only for `dns` rules. - `ip_categories: Optional[bool]` Enable IPs in DNS resolver category blocks. The system blocks only domain name categories unless you enable this setting. Settable only for `dns` and `dns_resolver` rules. - `ip_indicator_feeds: Optional[bool]` Indicates whether to include IPs in DNS resolver indicator feed blocks. Default, indicator feeds block only domain names. Settable only for `dns` and `dns_resolver` rules. - `l4override: Optional[L4override]` Send matching traffic to the supplied destination IP address and port. Settable only for `l4` rules with the action set to `l4_override`. - `ip: Optional[str]` Defines the IPv4 or IPv6 address. - `port: Optional[int]` Defines a port number to use for TCP/UDP overrides. - `notification_settings: Optional[NotificationSettings]` Configure a notification to display on the user's device when this rule matched. Settable for all types of rules with the action set to `block`. - `enabled: Optional[bool]` Enable notification. - `include_context: Optional[bool]` Indicates whether to pass the context information as query parameters. - `msg: Optional[str]` Customize the message shown in the notification. - `support_url: Optional[str]` Defines an optional URL to direct users to additional information. If unset, the notification opens a block page. - `override_host: Optional[str]` Defines a hostname for override, for the matching DNS queries. Settable only for `dns` rules with the action set to `override`. - `override_ips: Optional[List[str]]` Defines a an IP or set of IPs for overriding matched DNS queries. Settable only for `dns` rules with the action set to `override`. - `payload_log: Optional[PayloadLog]` Configure DLP payload logging. Settable only for `http` rules. - `enabled: Optional[bool]` Enable DLP payload logging for this rule. - `quarantine: Optional[Quarantine]` Configure settings that apply to quarantine rules. Settable only for `http` rules. - `file_types: Optional[List[Literal["exe", "pdf", "doc", 10 more]]]` Specify the types of files to sandbox. - `"exe"` - `"pdf"` - `"doc"` - `"docm"` - `"docx"` - `"rtf"` - `"ppt"` - `"pptx"` - `"xls"` - `"xlsm"` - `"xlsx"` - `"zip"` - `"rar"` - `redirect: Optional[Redirect]` Apply settings to redirect rules. Settable only for `http` rules with the action set to `redirect`. - `target_uri: str` Specify the URI to which the user is redirected. - `include_context: Optional[bool]` Specify whether to pass the context information as query parameters. - `preserve_path_and_query: Optional[bool]` Specify whether to append the path and query parameters from the original request to target_uri. - `resolve_dns_internally: Optional[ResolveDNSInternally]` Configure to forward the query to the internal DNS service, passing the specified 'view_id' as input. Not used when 'dns_resolvers' is specified or 'resolve_dns_through_cloudflare' is set. Only valid when a rule's action set to 'resolve'. Settable only for `dns_resolver` rules. - `fallback: Optional[Literal["none", "public_dns"]]` Specify the fallback behavior to apply when the internal DNS response code differs from 'NOERROR' or when the response data contains only CNAME records for 'A' or 'AAAA' queries. - `"none"` - `"public_dns"` - `view_id: Optional[str]` Specify the internal DNS view identifier to pass to the internal DNS service. - `resolve_dns_through_cloudflare: Optional[bool]` Enable to send queries that match the policy to Cloudflare's default 1.1.1.1 DNS resolver. Cannot set when 'dns_resolvers' specified or 'resolve_dns_internally' is set. Only valid when a rule's action set to 'resolve'. Settable only for `dns_resolver` rules. - `untrusted_cert: Optional[UntrustedCERT]` Configure behavior when an upstream certificate is invalid or an SSL error occurs. Settable only for `http` rules with the action set to `allow`. - `action: Optional[Literal["pass_through", "block", "error"]]` Defines the action performed when an untrusted certificate seen. The default action an error with HTTP code 526. - `"pass_through"` - `"block"` - `"error"` - `schedule: Optional[ScheduleParam]` Defines the schedule for activating DNS policies. Settable only for `dns` and `dns_resolver` rules. - `fri: Optional[str]` Specify the time intervals when the rule is active on Fridays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Fridays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `mon: Optional[str]` Specify the time intervals when the rule is active on Mondays, in the increasing order from 00:00-24:00(capped at maximum of 6 time splits). If this parameter omitted, the rule is deactivated on Mondays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `sat: Optional[str]` Specify the time intervals when the rule is active on Saturdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Saturdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `sun: Optional[str]` Specify the time intervals when the rule is active on Sundays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Sundays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `thu: Optional[str]` Specify the time intervals when the rule is active on Thursdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Thursdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `time_zone: Optional[str]` Specify the time zone for rule evaluation. When a [valid time zone city name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) is provided, Gateway always uses the current time for that time zone. When this parameter is omitted, Gateway uses the time zone determined from the user's IP address. Colo time zone is used when the user's IP address does not resolve to a location. - `tue: Optional[str]` Specify the time intervals when the rule is active on Tuesdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Tuesdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `wed: Optional[str]` Specify the time intervals when the rule is active on Wednesdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Wednesdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `traffic: Optional[str]` Specify the wirefilter expression used for traffic matching. The API automatically formats and sanitizes expressions before storing them. To prevent Terraform state drift, use the formatted expression returned in the API response. ### Returns - `class GatewayRule: …` - `action: Literal["on", "off", "allow", 13 more]` Specify the action to perform when the associated traffic, identity, and device posture expressions either absent or evaluate to `true`. - `"on"` - `"off"` - `"allow"` - `"block"` - `"scan"` - `"noscan"` - `"safesearch"` - `"ytrestricted"` - `"isolate"` - `"noisolate"` - `"override"` - `"l4_override"` - `"egress"` - `"resolve"` - `"quarantine"` - `"redirect"` - `enabled: bool` Specify whether the rule is enabled. - `filters: List[GatewayFilter]` Specify the protocol or layer to evaluate the traffic, identity, and device posture expressions. Can only contain a single value. - `"http"` - `"dns"` - `"l4"` - `"egress"` - `"dns_resolver"` - `name: str` Specify the rule name. - `precedence: int` Set the order of your rules. Lower values indicate higher precedence. At each processing phase, evaluate applicable rules in ascending order of this value. Refer to [Order of enforcement](http://developers.cloudflare.com/learning-paths/secure-internet-traffic/understand-policies/order-of-enforcement/#manage-precedence-with-terraform) to manage precedence via Terraform. - `traffic: str` Specify the wirefilter expression used for traffic matching. The API automatically formats and sanitizes expressions before storing them. To prevent Terraform state drift, use the formatted expression returned in the API response. - `id: Optional[str]` Identify the API resource with a UUID. - `created_at: Optional[datetime]` - `deleted_at: Optional[datetime]` Indicate the date of deletion, if any. - `description: Optional[str]` Specify the rule description. - `device_posture: Optional[str]` Specify the wirefilter expression used for device posture check. The API automatically formats and sanitizes expressions before storing them. To prevent Terraform state drift, use the formatted expression returned in the API response. - `expiration: Optional[Expiration]` Defines the expiration time stamp and default duration of a DNS policy. Takes precedence over the policy's `schedule` configuration, if any. This does not apply to HTTP or network policies. Settable only for `dns` rules. - `expires_at: datetime` Show the timestamp when the policy expires and stops applying. The value must follow RFC 3339 and include a UTC offset. The system accepts non-zero offsets but converts them to the equivalent UTC+00:00 value and returns timestamps with a trailing Z. Expiration policies ignore client timezones and expire globally at the specified expires_at time. - `duration: Optional[int]` Defines the default duration a policy active in minutes. Must set in order to use the `reset_expiration` endpoint on this rule. - `expired: Optional[bool]` Indicates whether the policy is expired. - `identity: Optional[str]` Specify the wirefilter expression used for identity matching. The API automatically formats and sanitizes expressions before storing them. To prevent Terraform state drift, use the formatted expression returned in the API response. - `read_only: Optional[bool]` Indicate that this rule is shared via the Orgs API and read only. - `rule_settings: Optional[RuleSetting]` Defines settings for this rule. Settings apply only to specific rule types and must use compatible selectors. If Terraform detects drift, confirm the setting supports your rule type and check whether the API modifies the value. Use API-returned values in your configuration to prevent drift. - `add_headers: Optional[Dict[str, List[str]]]` Add custom headers to allowed requests as key-value pairs. Use header names as keys that map to arrays of header values. Settable only for `http` rules with the action set to `allow`. - `allow_child_bypass: Optional[bool]` Set to enable MSP children to bypass this rule. Only parent MSP accounts can set this. this rule. Settable for all types of rules. - `audit_ssh: Optional[AuditSSH]` Define the settings for the Audit SSH action. Settable only for `l4` rules with `audit_ssh` action. - `command_logging: Optional[bool]` Enable SSH command logging. - `biso_admin_controls: Optional[BISOAdminControls]` Configure browser isolation behavior. Settable only for `http` rules with the action set to `isolate`. - `copy: Optional[Literal["enabled", "disabled", "remote_only"]]` Configure copy behavior. If set to remote_only, users cannot copy isolated content from the remote browser to the local clipboard. If this field is absent, copying remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `"remote_only"` - `dcp: Optional[bool]` Set to false to enable copy-pasting. Only applies when `version == "v1"`. - `dd: Optional[bool]` Set to false to enable downloading. Only applies when `version == "v1"`. - `dk: Optional[bool]` Set to false to enable keyboard usage. Only applies when `version == "v1"`. - `download: Optional[Literal["enabled", "disabled", "remote_only"]]` Configure download behavior. When set to remote_only, users can view downloads but cannot save them. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `"remote_only"` - `dp: Optional[bool]` Set to false to enable printing. Only applies when `version == "v1"`. - `du: Optional[bool]` Set to false to enable uploading. Only applies when `version == "v1"`. - `keyboard: Optional[Literal["enabled", "disabled"]]` Configure keyboard usage behavior. If this field is absent, keyboard usage remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `paste: Optional[Literal["enabled", "disabled", "remote_only"]]` Configure paste behavior. If set to remote_only, users cannot paste content from the local clipboard into isolated pages. If this field is absent, pasting remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `"remote_only"` - `printing: Optional[Literal["enabled", "disabled"]]` Configure print behavior. Default, Printing is enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `upload: Optional[Literal["enabled", "disabled"]]` Configure upload behavior. If this field is absent, uploading remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `version: Optional[Literal["v1", "v2"]]` Indicate which version of the browser isolation controls should apply. - `"v1"` - `"v2"` - `block_page: Optional[BlockPage]` Configure custom block page settings. If missing or null, use the account settings. Settable only for `http` rules with the action set to `block`. - `target_uri: str` Specify the URI to which the user is redirected. - `include_context: Optional[bool]` Specify whether to pass the context information as query parameters. - `block_page_enabled: Optional[bool]` Enable the custom block page. Settable only for `dns` rules with action `block`. - `block_reason: Optional[str]` Explain why the rule blocks the request. The custom block page shows this text (if enabled). Settable only for `dns`, `l4`, and `http` rules when the action set to `block`. - `bypass_parent_rule: Optional[bool]` Set to enable MSP accounts to bypass their parent's rules. Only MSP child accounts can set this. Settable for all types of rules. - `check_session: Optional[CheckSession]` Configure session check behavior. Settable only for `l4` and `http` rules with the action set to `allow`. - `duration: Optional[str]` Sets the required session freshness threshold. The API returns a normalized version of this value. - `enforce: Optional[bool]` Enable session enforcement. - `dns_resolvers: Optional[DNSResolvers]` Configure custom resolvers to route queries that match the resolver policy. Unused with 'resolve_dns_through_cloudflare' or 'resolve_dns_internally' settings. DNS queries get routed to the address closest to their origin. Only valid when a rule's action set to 'resolve'. Settable only for `dns_resolver` rules. - `ipv4: Optional[List[DNSResolverSettingsV4]]` - `ip: str` Specify the IPv4 address of the upstream resolver. - `port: Optional[int]` Specify a port number to use for the upstream resolver. Defaults to 53 if unspecified. - `route_through_private_network: Optional[bool]` Indicate whether to connect to this resolver over a private network. Must set when vnet_id set. - `vnet_id: Optional[str]` Specify an optional virtual network for this resolver. Uses default virtual network id if omitted. - `ipv6: Optional[List[DNSResolverSettingsV6]]` - `ip: str` Specify the IPv6 address of the upstream resolver. - `port: Optional[int]` Specify a port number to use for the upstream resolver. Defaults to 53 if unspecified. - `route_through_private_network: Optional[bool]` Indicate whether to connect to this resolver over a private network. Must set when vnet_id set. - `vnet_id: Optional[str]` Specify an optional virtual network for this resolver. Uses default virtual network id if omitted. - `egress: Optional[Egress]` Configure how Gateway Proxy traffic egresses. You can enable this setting for rules with Egress actions and filters, or omit it to indicate local egress via WARP IPs. Settable only for `egress` rules. - `ipv4: Optional[str]` Specify the IPv4 address to use for egress. - `ipv4_fallback: Optional[str]` Specify the fallback IPv4 address to use for egress when the primary IPv4 fails. Set '0.0.0.0' to indicate local egress via WARP IPs. - `ipv6: Optional[str]` Specify the IPv6 range to use for egress. - `forensic_copy: Optional[ForensicCopy]` Configure whether a copy of the HTTP request will be sent to storage when the rule matches. - `enabled: Optional[bool]` Enable sending the copy to storage. - `ignore_cname_category_matches: Optional[bool]` Ignore category matches at CNAME domains in a response. When off, evaluate categories in this rule against all CNAME domain categories in the response. Settable only for `dns` and `dns_resolver` rules. - `insecure_disable_dnssec_validation: Optional[bool]` Specify whether to disable DNSSEC validation (for Allow actions) [INSECURE]. Settable only for `dns` rules. - `ip_categories: Optional[bool]` Enable IPs in DNS resolver category blocks. The system blocks only domain name categories unless you enable this setting. Settable only for `dns` and `dns_resolver` rules. - `ip_indicator_feeds: Optional[bool]` Indicates whether to include IPs in DNS resolver indicator feed blocks. Default, indicator feeds block only domain names. Settable only for `dns` and `dns_resolver` rules. - `l4override: Optional[L4override]` Send matching traffic to the supplied destination IP address and port. Settable only for `l4` rules with the action set to `l4_override`. - `ip: Optional[str]` Defines the IPv4 or IPv6 address. - `port: Optional[int]` Defines a port number to use for TCP/UDP overrides. - `notification_settings: Optional[NotificationSettings]` Configure a notification to display on the user's device when this rule matched. Settable for all types of rules with the action set to `block`. - `enabled: Optional[bool]` Enable notification. - `include_context: Optional[bool]` Indicates whether to pass the context information as query parameters. - `msg: Optional[str]` Customize the message shown in the notification. - `support_url: Optional[str]` Defines an optional URL to direct users to additional information. If unset, the notification opens a block page. - `override_host: Optional[str]` Defines a hostname for override, for the matching DNS queries. Settable only for `dns` rules with the action set to `override`. - `override_ips: Optional[List[str]]` Defines a an IP or set of IPs for overriding matched DNS queries. Settable only for `dns` rules with the action set to `override`. - `payload_log: Optional[PayloadLog]` Configure DLP payload logging. Settable only for `http` rules. - `enabled: Optional[bool]` Enable DLP payload logging for this rule. - `quarantine: Optional[Quarantine]` Configure settings that apply to quarantine rules. Settable only for `http` rules. - `file_types: Optional[List[Literal["exe", "pdf", "doc", 10 more]]]` Specify the types of files to sandbox. - `"exe"` - `"pdf"` - `"doc"` - `"docm"` - `"docx"` - `"rtf"` - `"ppt"` - `"pptx"` - `"xls"` - `"xlsm"` - `"xlsx"` - `"zip"` - `"rar"` - `redirect: Optional[Redirect]` Apply settings to redirect rules. Settable only for `http` rules with the action set to `redirect`. - `target_uri: str` Specify the URI to which the user is redirected. - `include_context: Optional[bool]` Specify whether to pass the context information as query parameters. - `preserve_path_and_query: Optional[bool]` Specify whether to append the path and query parameters from the original request to target_uri. - `resolve_dns_internally: Optional[ResolveDNSInternally]` Configure to forward the query to the internal DNS service, passing the specified 'view_id' as input. Not used when 'dns_resolvers' is specified or 'resolve_dns_through_cloudflare' is set. Only valid when a rule's action set to 'resolve'. Settable only for `dns_resolver` rules. - `fallback: Optional[Literal["none", "public_dns"]]` Specify the fallback behavior to apply when the internal DNS response code differs from 'NOERROR' or when the response data contains only CNAME records for 'A' or 'AAAA' queries. - `"none"` - `"public_dns"` - `view_id: Optional[str]` Specify the internal DNS view identifier to pass to the internal DNS service. - `resolve_dns_through_cloudflare: Optional[bool]` Enable to send queries that match the policy to Cloudflare's default 1.1.1.1 DNS resolver. Cannot set when 'dns_resolvers' specified or 'resolve_dns_internally' is set. Only valid when a rule's action set to 'resolve'. Settable only for `dns_resolver` rules. - `untrusted_cert: Optional[UntrustedCERT]` Configure behavior when an upstream certificate is invalid or an SSL error occurs. Settable only for `http` rules with the action set to `allow`. - `action: Optional[Literal["pass_through", "block", "error"]]` Defines the action performed when an untrusted certificate seen. The default action an error with HTTP code 526. - `"pass_through"` - `"block"` - `"error"` - `schedule: Optional[Schedule]` Defines the schedule for activating DNS policies. Settable only for `dns` and `dns_resolver` rules. - `fri: Optional[str]` Specify the time intervals when the rule is active on Fridays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Fridays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `mon: Optional[str]` Specify the time intervals when the rule is active on Mondays, in the increasing order from 00:00-24:00(capped at maximum of 6 time splits). If this parameter omitted, the rule is deactivated on Mondays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `sat: Optional[str]` Specify the time intervals when the rule is active on Saturdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Saturdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `sun: Optional[str]` Specify the time intervals when the rule is active on Sundays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Sundays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `thu: Optional[str]` Specify the time intervals when the rule is active on Thursdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Thursdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `time_zone: Optional[str]` Specify the time zone for rule evaluation. When a [valid time zone city name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) is provided, Gateway always uses the current time for that time zone. When this parameter is omitted, Gateway uses the time zone determined from the user's IP address. Colo time zone is used when the user's IP address does not resolve to a location. - `tue: Optional[str]` Specify the time intervals when the rule is active on Tuesdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Tuesdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `wed: Optional[str]` Specify the time intervals when the rule is active on Wednesdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Wednesdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `sharable: Optional[bool]` Indicate that this rule is sharable via the Orgs API. - `source_account: Optional[str]` Provide the account tag of the account that created the rule. - `updated_at: Optional[datetime]` - `version: Optional[int]` Indicate the version number of the rule(read-only). - `warning_status: Optional[str]` Indicate a warning for a misconfigured rule, if any. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) gateway_rule = client.zero_trust.gateway.rules.update( rule_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", action="allow", name="block bad websites", ) print(gateway_rule.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "action": "allow", "enabled": true, "filters": [ "http" ], "name": "block bad websites", "precedence": 0, "traffic": "http.request.uri matches \".*a/partial/uri.*\" and http.request.host in $01302951-49f9-47c9-a400-0297e60b6a10", "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "created_at": "2014-01-01T05:20:00.12345Z", "deleted_at": "2019-12-27T18:11:19.117Z", "description": "Block bad websites based on their host name.", "device_posture": "any(device_posture.checks.passed[*] in {\"1308749e-fcfb-4ebc-b051-fe022b632644\"})", "expiration": { "expires_at": "2014-01-01T05:20:20Z", "duration": 10, "expired": false }, "identity": "any(identity.groups.name[*] in {\"finance\"})", "read_only": true, "rule_settings": { "add_headers": { "My-Next-Header": [ "foo", "bar" ], "X-Custom-Header-Name": [ "somecustomvalue" ] }, "allow_child_bypass": false, "audit_ssh": { "command_logging": false }, "biso_admin_controls": { "copy": "remote_only", "dcp": true, "dd": true, "dk": true, "download": "enabled", "dp": false, "du": true, "keyboard": "enabled", "paste": "enabled", "printing": "enabled", "upload": "enabled", "version": "v1" }, "block_page": { "target_uri": "https://example.com", "include_context": true }, "block_page_enabled": true, "block_reason": "This website is a security risk", "bypass_parent_rule": false, "check_session": { "duration": "300s", "enforce": true }, "dns_resolvers": { "ipv4": [ { "ip": "2.2.2.2", "port": 5053, "route_through_private_network": true, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415" } ], "ipv6": [ { "ip": "2001:DB8::", "port": 5053, "route_through_private_network": true, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415" } ] }, "egress": { "ipv4": "192.0.2.2", "ipv4_fallback": "192.0.2.3", "ipv6": "2001:DB8::/64" }, "forensic_copy": { "enabled": true }, "ignore_cname_category_matches": true, "insecure_disable_dnssec_validation": false, "ip_categories": true, "ip_indicator_feeds": true, "l4override": { "ip": "1.1.1.1", "port": 0 }, "notification_settings": { "enabled": true, "include_context": true, "msg": "msg", "support_url": "support_url" }, "override_host": "example.com", "override_ips": [ "1.1.1.1", "2.2.2.2" ], "payload_log": { "enabled": true }, "quarantine": { "file_types": [ "exe" ] }, "redirect": { "target_uri": "https://example.com", "include_context": true, "preserve_path_and_query": true }, "resolve_dns_internally": { "fallback": "none", "view_id": "view_id" }, "resolve_dns_through_cloudflare": true, "untrusted_cert": { "action": "error" } }, "schedule": { "fri": "08:00-12:30,13:30-17:00", "mon": "08:00-12:30,13:30-17:00", "sat": "08:00-12:30,13:30-17:00", "sun": "08:00-12:30,13:30-17:00", "thu": "08:00-12:30,13:30-17:00", "time_zone": "America/New York", "tue": "08:00-12:30,13:30-17:00", "wed": "08:00-12:30,13:30-17:00" }, "sharable": true, "source_account": "source_account", "updated_at": "2014-01-01T05:20:00.12345Z", "version": 1, "warning_status": "warning_status" } } ``` ## Delete a Zero Trust Gateway rule `zero_trust.gateway.rules.delete(strrule_id, RuleDeleteParams**kwargs) -> object` **delete** `/accounts/{account_id}/gateway/rules/{rule_id}` Delete a Zero Trust Gateway rule. ### Parameters - `account_id: str` - `rule_id: str` Identify the API resource with a UUID. ### Returns - `object` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) rule = client.zero_trust.gateway.rules.delete( rule_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) print(rule) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": {} } ``` ## List Zero Trust Gateway rules inherited from the parent account `zero_trust.gateway.rules.list_tenant(RuleListTenantParams**kwargs) -> SyncSinglePage[GatewayRule]` **get** `/accounts/{account_id}/gateway/rules/tenant` List Zero Trust Gateway rules for the parent account of an account in the MSP configuration. ### Parameters - `account_id: str` ### Returns - `class GatewayRule: …` - `action: Literal["on", "off", "allow", 13 more]` Specify the action to perform when the associated traffic, identity, and device posture expressions either absent or evaluate to `true`. - `"on"` - `"off"` - `"allow"` - `"block"` - `"scan"` - `"noscan"` - `"safesearch"` - `"ytrestricted"` - `"isolate"` - `"noisolate"` - `"override"` - `"l4_override"` - `"egress"` - `"resolve"` - `"quarantine"` - `"redirect"` - `enabled: bool` Specify whether the rule is enabled. - `filters: List[GatewayFilter]` Specify the protocol or layer to evaluate the traffic, identity, and device posture expressions. Can only contain a single value. - `"http"` - `"dns"` - `"l4"` - `"egress"` - `"dns_resolver"` - `name: str` Specify the rule name. - `precedence: int` Set the order of your rules. Lower values indicate higher precedence. At each processing phase, evaluate applicable rules in ascending order of this value. Refer to [Order of enforcement](http://developers.cloudflare.com/learning-paths/secure-internet-traffic/understand-policies/order-of-enforcement/#manage-precedence-with-terraform) to manage precedence via Terraform. - `traffic: str` Specify the wirefilter expression used for traffic matching. The API automatically formats and sanitizes expressions before storing them. To prevent Terraform state drift, use the formatted expression returned in the API response. - `id: Optional[str]` Identify the API resource with a UUID. - `created_at: Optional[datetime]` - `deleted_at: Optional[datetime]` Indicate the date of deletion, if any. - `description: Optional[str]` Specify the rule description. - `device_posture: Optional[str]` Specify the wirefilter expression used for device posture check. The API automatically formats and sanitizes expressions before storing them. To prevent Terraform state drift, use the formatted expression returned in the API response. - `expiration: Optional[Expiration]` Defines the expiration time stamp and default duration of a DNS policy. Takes precedence over the policy's `schedule` configuration, if any. This does not apply to HTTP or network policies. Settable only for `dns` rules. - `expires_at: datetime` Show the timestamp when the policy expires and stops applying. The value must follow RFC 3339 and include a UTC offset. The system accepts non-zero offsets but converts them to the equivalent UTC+00:00 value and returns timestamps with a trailing Z. Expiration policies ignore client timezones and expire globally at the specified expires_at time. - `duration: Optional[int]` Defines the default duration a policy active in minutes. Must set in order to use the `reset_expiration` endpoint on this rule. - `expired: Optional[bool]` Indicates whether the policy is expired. - `identity: Optional[str]` Specify the wirefilter expression used for identity matching. The API automatically formats and sanitizes expressions before storing them. To prevent Terraform state drift, use the formatted expression returned in the API response. - `read_only: Optional[bool]` Indicate that this rule is shared via the Orgs API and read only. - `rule_settings: Optional[RuleSetting]` Defines settings for this rule. Settings apply only to specific rule types and must use compatible selectors. If Terraform detects drift, confirm the setting supports your rule type and check whether the API modifies the value. Use API-returned values in your configuration to prevent drift. - `add_headers: Optional[Dict[str, List[str]]]` Add custom headers to allowed requests as key-value pairs. Use header names as keys that map to arrays of header values. Settable only for `http` rules with the action set to `allow`. - `allow_child_bypass: Optional[bool]` Set to enable MSP children to bypass this rule. Only parent MSP accounts can set this. this rule. Settable for all types of rules. - `audit_ssh: Optional[AuditSSH]` Define the settings for the Audit SSH action. Settable only for `l4` rules with `audit_ssh` action. - `command_logging: Optional[bool]` Enable SSH command logging. - `biso_admin_controls: Optional[BISOAdminControls]` Configure browser isolation behavior. Settable only for `http` rules with the action set to `isolate`. - `copy: Optional[Literal["enabled", "disabled", "remote_only"]]` Configure copy behavior. If set to remote_only, users cannot copy isolated content from the remote browser to the local clipboard. If this field is absent, copying remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `"remote_only"` - `dcp: Optional[bool]` Set to false to enable copy-pasting. Only applies when `version == "v1"`. - `dd: Optional[bool]` Set to false to enable downloading. Only applies when `version == "v1"`. - `dk: Optional[bool]` Set to false to enable keyboard usage. Only applies when `version == "v1"`. - `download: Optional[Literal["enabled", "disabled", "remote_only"]]` Configure download behavior. When set to remote_only, users can view downloads but cannot save them. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `"remote_only"` - `dp: Optional[bool]` Set to false to enable printing. Only applies when `version == "v1"`. - `du: Optional[bool]` Set to false to enable uploading. Only applies when `version == "v1"`. - `keyboard: Optional[Literal["enabled", "disabled"]]` Configure keyboard usage behavior. If this field is absent, keyboard usage remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `paste: Optional[Literal["enabled", "disabled", "remote_only"]]` Configure paste behavior. If set to remote_only, users cannot paste content from the local clipboard into isolated pages. If this field is absent, pasting remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `"remote_only"` - `printing: Optional[Literal["enabled", "disabled"]]` Configure print behavior. Default, Printing is enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `upload: Optional[Literal["enabled", "disabled"]]` Configure upload behavior. If this field is absent, uploading remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `version: Optional[Literal["v1", "v2"]]` Indicate which version of the browser isolation controls should apply. - `"v1"` - `"v2"` - `block_page: Optional[BlockPage]` Configure custom block page settings. If missing or null, use the account settings. Settable only for `http` rules with the action set to `block`. - `target_uri: str` Specify the URI to which the user is redirected. - `include_context: Optional[bool]` Specify whether to pass the context information as query parameters. - `block_page_enabled: Optional[bool]` Enable the custom block page. Settable only for `dns` rules with action `block`. - `block_reason: Optional[str]` Explain why the rule blocks the request. The custom block page shows this text (if enabled). Settable only for `dns`, `l4`, and `http` rules when the action set to `block`. - `bypass_parent_rule: Optional[bool]` Set to enable MSP accounts to bypass their parent's rules. Only MSP child accounts can set this. Settable for all types of rules. - `check_session: Optional[CheckSession]` Configure session check behavior. Settable only for `l4` and `http` rules with the action set to `allow`. - `duration: Optional[str]` Sets the required session freshness threshold. The API returns a normalized version of this value. - `enforce: Optional[bool]` Enable session enforcement. - `dns_resolvers: Optional[DNSResolvers]` Configure custom resolvers to route queries that match the resolver policy. Unused with 'resolve_dns_through_cloudflare' or 'resolve_dns_internally' settings. DNS queries get routed to the address closest to their origin. Only valid when a rule's action set to 'resolve'. Settable only for `dns_resolver` rules. - `ipv4: Optional[List[DNSResolverSettingsV4]]` - `ip: str` Specify the IPv4 address of the upstream resolver. - `port: Optional[int]` Specify a port number to use for the upstream resolver. Defaults to 53 if unspecified. - `route_through_private_network: Optional[bool]` Indicate whether to connect to this resolver over a private network. Must set when vnet_id set. - `vnet_id: Optional[str]` Specify an optional virtual network for this resolver. Uses default virtual network id if omitted. - `ipv6: Optional[List[DNSResolverSettingsV6]]` - `ip: str` Specify the IPv6 address of the upstream resolver. - `port: Optional[int]` Specify a port number to use for the upstream resolver. Defaults to 53 if unspecified. - `route_through_private_network: Optional[bool]` Indicate whether to connect to this resolver over a private network. Must set when vnet_id set. - `vnet_id: Optional[str]` Specify an optional virtual network for this resolver. Uses default virtual network id if omitted. - `egress: Optional[Egress]` Configure how Gateway Proxy traffic egresses. You can enable this setting for rules with Egress actions and filters, or omit it to indicate local egress via WARP IPs. Settable only for `egress` rules. - `ipv4: Optional[str]` Specify the IPv4 address to use for egress. - `ipv4_fallback: Optional[str]` Specify the fallback IPv4 address to use for egress when the primary IPv4 fails. Set '0.0.0.0' to indicate local egress via WARP IPs. - `ipv6: Optional[str]` Specify the IPv6 range to use for egress. - `forensic_copy: Optional[ForensicCopy]` Configure whether a copy of the HTTP request will be sent to storage when the rule matches. - `enabled: Optional[bool]` Enable sending the copy to storage. - `ignore_cname_category_matches: Optional[bool]` Ignore category matches at CNAME domains in a response. When off, evaluate categories in this rule against all CNAME domain categories in the response. Settable only for `dns` and `dns_resolver` rules. - `insecure_disable_dnssec_validation: Optional[bool]` Specify whether to disable DNSSEC validation (for Allow actions) [INSECURE]. Settable only for `dns` rules. - `ip_categories: Optional[bool]` Enable IPs in DNS resolver category blocks. The system blocks only domain name categories unless you enable this setting. Settable only for `dns` and `dns_resolver` rules. - `ip_indicator_feeds: Optional[bool]` Indicates whether to include IPs in DNS resolver indicator feed blocks. Default, indicator feeds block only domain names. Settable only for `dns` and `dns_resolver` rules. - `l4override: Optional[L4override]` Send matching traffic to the supplied destination IP address and port. Settable only for `l4` rules with the action set to `l4_override`. - `ip: Optional[str]` Defines the IPv4 or IPv6 address. - `port: Optional[int]` Defines a port number to use for TCP/UDP overrides. - `notification_settings: Optional[NotificationSettings]` Configure a notification to display on the user's device when this rule matched. Settable for all types of rules with the action set to `block`. - `enabled: Optional[bool]` Enable notification. - `include_context: Optional[bool]` Indicates whether to pass the context information as query parameters. - `msg: Optional[str]` Customize the message shown in the notification. - `support_url: Optional[str]` Defines an optional URL to direct users to additional information. If unset, the notification opens a block page. - `override_host: Optional[str]` Defines a hostname for override, for the matching DNS queries. Settable only for `dns` rules with the action set to `override`. - `override_ips: Optional[List[str]]` Defines a an IP or set of IPs for overriding matched DNS queries. Settable only for `dns` rules with the action set to `override`. - `payload_log: Optional[PayloadLog]` Configure DLP payload logging. Settable only for `http` rules. - `enabled: Optional[bool]` Enable DLP payload logging for this rule. - `quarantine: Optional[Quarantine]` Configure settings that apply to quarantine rules. Settable only for `http` rules. - `file_types: Optional[List[Literal["exe", "pdf", "doc", 10 more]]]` Specify the types of files to sandbox. - `"exe"` - `"pdf"` - `"doc"` - `"docm"` - `"docx"` - `"rtf"` - `"ppt"` - `"pptx"` - `"xls"` - `"xlsm"` - `"xlsx"` - `"zip"` - `"rar"` - `redirect: Optional[Redirect]` Apply settings to redirect rules. Settable only for `http` rules with the action set to `redirect`. - `target_uri: str` Specify the URI to which the user is redirected. - `include_context: Optional[bool]` Specify whether to pass the context information as query parameters. - `preserve_path_and_query: Optional[bool]` Specify whether to append the path and query parameters from the original request to target_uri. - `resolve_dns_internally: Optional[ResolveDNSInternally]` Configure to forward the query to the internal DNS service, passing the specified 'view_id' as input. Not used when 'dns_resolvers' is specified or 'resolve_dns_through_cloudflare' is set. Only valid when a rule's action set to 'resolve'. Settable only for `dns_resolver` rules. - `fallback: Optional[Literal["none", "public_dns"]]` Specify the fallback behavior to apply when the internal DNS response code differs from 'NOERROR' or when the response data contains only CNAME records for 'A' or 'AAAA' queries. - `"none"` - `"public_dns"` - `view_id: Optional[str]` Specify the internal DNS view identifier to pass to the internal DNS service. - `resolve_dns_through_cloudflare: Optional[bool]` Enable to send queries that match the policy to Cloudflare's default 1.1.1.1 DNS resolver. Cannot set when 'dns_resolvers' specified or 'resolve_dns_internally' is set. Only valid when a rule's action set to 'resolve'. Settable only for `dns_resolver` rules. - `untrusted_cert: Optional[UntrustedCERT]` Configure behavior when an upstream certificate is invalid or an SSL error occurs. Settable only for `http` rules with the action set to `allow`. - `action: Optional[Literal["pass_through", "block", "error"]]` Defines the action performed when an untrusted certificate seen. The default action an error with HTTP code 526. - `"pass_through"` - `"block"` - `"error"` - `schedule: Optional[Schedule]` Defines the schedule for activating DNS policies. Settable only for `dns` and `dns_resolver` rules. - `fri: Optional[str]` Specify the time intervals when the rule is active on Fridays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Fridays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `mon: Optional[str]` Specify the time intervals when the rule is active on Mondays, in the increasing order from 00:00-24:00(capped at maximum of 6 time splits). If this parameter omitted, the rule is deactivated on Mondays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `sat: Optional[str]` Specify the time intervals when the rule is active on Saturdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Saturdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `sun: Optional[str]` Specify the time intervals when the rule is active on Sundays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Sundays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `thu: Optional[str]` Specify the time intervals when the rule is active on Thursdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Thursdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `time_zone: Optional[str]` Specify the time zone for rule evaluation. When a [valid time zone city name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) is provided, Gateway always uses the current time for that time zone. When this parameter is omitted, Gateway uses the time zone determined from the user's IP address. Colo time zone is used when the user's IP address does not resolve to a location. - `tue: Optional[str]` Specify the time intervals when the rule is active on Tuesdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Tuesdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `wed: Optional[str]` Specify the time intervals when the rule is active on Wednesdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Wednesdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `sharable: Optional[bool]` Indicate that this rule is sharable via the Orgs API. - `source_account: Optional[str]` Provide the account tag of the account that created the rule. - `updated_at: Optional[datetime]` - `version: Optional[int]` Indicate the version number of the rule(read-only). - `warning_status: Optional[str]` Indicate a warning for a misconfigured rule, if any. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.zero_trust.gateway.rules.list_tenant( account_id="699d98642c564d2e855e9661899b7252", ) page = page.result[0] print(page.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "action": "allow", "enabled": true, "filters": [ "http" ], "name": "block bad websites", "precedence": 0, "traffic": "http.request.uri matches \".*a/partial/uri.*\" and http.request.host in $01302951-49f9-47c9-a400-0297e60b6a10", "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "created_at": "2014-01-01T05:20:00.12345Z", "deleted_at": "2019-12-27T18:11:19.117Z", "description": "Block bad websites based on their host name.", "device_posture": "any(device_posture.checks.passed[*] in {\"1308749e-fcfb-4ebc-b051-fe022b632644\"})", "expiration": { "expires_at": "2014-01-01T05:20:20Z", "duration": 10, "expired": false }, "identity": "any(identity.groups.name[*] in {\"finance\"})", "read_only": true, "rule_settings": { "add_headers": { "My-Next-Header": [ "foo", "bar" ], "X-Custom-Header-Name": [ "somecustomvalue" ] }, "allow_child_bypass": false, "audit_ssh": { "command_logging": false }, "biso_admin_controls": { "copy": "remote_only", "dcp": true, "dd": true, "dk": true, "download": "enabled", "dp": false, "du": true, "keyboard": "enabled", "paste": "enabled", "printing": "enabled", "upload": "enabled", "version": "v1" }, "block_page": { "target_uri": "https://example.com", "include_context": true }, "block_page_enabled": true, "block_reason": "This website is a security risk", "bypass_parent_rule": false, "check_session": { "duration": "300s", "enforce": true }, "dns_resolvers": { "ipv4": [ { "ip": "2.2.2.2", "port": 5053, "route_through_private_network": true, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415" } ], "ipv6": [ { "ip": "2001:DB8::", "port": 5053, "route_through_private_network": true, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415" } ] }, "egress": { "ipv4": "192.0.2.2", "ipv4_fallback": "192.0.2.3", "ipv6": "2001:DB8::/64" }, "forensic_copy": { "enabled": true }, "ignore_cname_category_matches": true, "insecure_disable_dnssec_validation": false, "ip_categories": true, "ip_indicator_feeds": true, "l4override": { "ip": "1.1.1.1", "port": 0 }, "notification_settings": { "enabled": true, "include_context": true, "msg": "msg", "support_url": "support_url" }, "override_host": "example.com", "override_ips": [ "1.1.1.1", "2.2.2.2" ], "payload_log": { "enabled": true }, "quarantine": { "file_types": [ "exe" ] }, "redirect": { "target_uri": "https://example.com", "include_context": true, "preserve_path_and_query": true }, "resolve_dns_internally": { "fallback": "none", "view_id": "view_id" }, "resolve_dns_through_cloudflare": true, "untrusted_cert": { "action": "error" } }, "schedule": { "fri": "08:00-12:30,13:30-17:00", "mon": "08:00-12:30,13:30-17:00", "sat": "08:00-12:30,13:30-17:00", "sun": "08:00-12:30,13:30-17:00", "thu": "08:00-12:30,13:30-17:00", "time_zone": "America/New York", "tue": "08:00-12:30,13:30-17:00", "wed": "08:00-12:30,13:30-17:00" }, "sharable": true, "source_account": "source_account", "updated_at": "2014-01-01T05:20:00.12345Z", "version": 1, "warning_status": "warning_status" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Reset the expiration of a Zero Trust Gateway Rule `zero_trust.gateway.rules.reset_expiration(strrule_id, RuleResetExpirationParams**kwargs) -> GatewayRule` **post** `/accounts/{account_id}/gateway/rules/{rule_id}/reset_expiration` Resets the expiration of a Zero Trust Gateway Rule if its duration elapsed and it has a default duration. The Zero Trust Gateway Rule must have values for both `expiration.expires_at` and `expiration.duration`. ### Parameters - `account_id: str` - `rule_id: str` Identify the API resource with a UUID. ### Returns - `class GatewayRule: …` - `action: Literal["on", "off", "allow", 13 more]` Specify the action to perform when the associated traffic, identity, and device posture expressions either absent or evaluate to `true`. - `"on"` - `"off"` - `"allow"` - `"block"` - `"scan"` - `"noscan"` - `"safesearch"` - `"ytrestricted"` - `"isolate"` - `"noisolate"` - `"override"` - `"l4_override"` - `"egress"` - `"resolve"` - `"quarantine"` - `"redirect"` - `enabled: bool` Specify whether the rule is enabled. - `filters: List[GatewayFilter]` Specify the protocol or layer to evaluate the traffic, identity, and device posture expressions. Can only contain a single value. - `"http"` - `"dns"` - `"l4"` - `"egress"` - `"dns_resolver"` - `name: str` Specify the rule name. - `precedence: int` Set the order of your rules. Lower values indicate higher precedence. At each processing phase, evaluate applicable rules in ascending order of this value. Refer to [Order of enforcement](http://developers.cloudflare.com/learning-paths/secure-internet-traffic/understand-policies/order-of-enforcement/#manage-precedence-with-terraform) to manage precedence via Terraform. - `traffic: str` Specify the wirefilter expression used for traffic matching. The API automatically formats and sanitizes expressions before storing them. To prevent Terraform state drift, use the formatted expression returned in the API response. - `id: Optional[str]` Identify the API resource with a UUID. - `created_at: Optional[datetime]` - `deleted_at: Optional[datetime]` Indicate the date of deletion, if any. - `description: Optional[str]` Specify the rule description. - `device_posture: Optional[str]` Specify the wirefilter expression used for device posture check. The API automatically formats and sanitizes expressions before storing them. To prevent Terraform state drift, use the formatted expression returned in the API response. - `expiration: Optional[Expiration]` Defines the expiration time stamp and default duration of a DNS policy. Takes precedence over the policy's `schedule` configuration, if any. This does not apply to HTTP or network policies. Settable only for `dns` rules. - `expires_at: datetime` Show the timestamp when the policy expires and stops applying. The value must follow RFC 3339 and include a UTC offset. The system accepts non-zero offsets but converts them to the equivalent UTC+00:00 value and returns timestamps with a trailing Z. Expiration policies ignore client timezones and expire globally at the specified expires_at time. - `duration: Optional[int]` Defines the default duration a policy active in minutes. Must set in order to use the `reset_expiration` endpoint on this rule. - `expired: Optional[bool]` Indicates whether the policy is expired. - `identity: Optional[str]` Specify the wirefilter expression used for identity matching. The API automatically formats and sanitizes expressions before storing them. To prevent Terraform state drift, use the formatted expression returned in the API response. - `read_only: Optional[bool]` Indicate that this rule is shared via the Orgs API and read only. - `rule_settings: Optional[RuleSetting]` Defines settings for this rule. Settings apply only to specific rule types and must use compatible selectors. If Terraform detects drift, confirm the setting supports your rule type and check whether the API modifies the value. Use API-returned values in your configuration to prevent drift. - `add_headers: Optional[Dict[str, List[str]]]` Add custom headers to allowed requests as key-value pairs. Use header names as keys that map to arrays of header values. Settable only for `http` rules with the action set to `allow`. - `allow_child_bypass: Optional[bool]` Set to enable MSP children to bypass this rule. Only parent MSP accounts can set this. this rule. Settable for all types of rules. - `audit_ssh: Optional[AuditSSH]` Define the settings for the Audit SSH action. Settable only for `l4` rules with `audit_ssh` action. - `command_logging: Optional[bool]` Enable SSH command logging. - `biso_admin_controls: Optional[BISOAdminControls]` Configure browser isolation behavior. Settable only for `http` rules with the action set to `isolate`. - `copy: Optional[Literal["enabled", "disabled", "remote_only"]]` Configure copy behavior. If set to remote_only, users cannot copy isolated content from the remote browser to the local clipboard. If this field is absent, copying remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `"remote_only"` - `dcp: Optional[bool]` Set to false to enable copy-pasting. Only applies when `version == "v1"`. - `dd: Optional[bool]` Set to false to enable downloading. Only applies when `version == "v1"`. - `dk: Optional[bool]` Set to false to enable keyboard usage. Only applies when `version == "v1"`. - `download: Optional[Literal["enabled", "disabled", "remote_only"]]` Configure download behavior. When set to remote_only, users can view downloads but cannot save them. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `"remote_only"` - `dp: Optional[bool]` Set to false to enable printing. Only applies when `version == "v1"`. - `du: Optional[bool]` Set to false to enable uploading. Only applies when `version == "v1"`. - `keyboard: Optional[Literal["enabled", "disabled"]]` Configure keyboard usage behavior. If this field is absent, keyboard usage remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `paste: Optional[Literal["enabled", "disabled", "remote_only"]]` Configure paste behavior. If set to remote_only, users cannot paste content from the local clipboard into isolated pages. If this field is absent, pasting remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `"remote_only"` - `printing: Optional[Literal["enabled", "disabled"]]` Configure print behavior. Default, Printing is enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `upload: Optional[Literal["enabled", "disabled"]]` Configure upload behavior. If this field is absent, uploading remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `version: Optional[Literal["v1", "v2"]]` Indicate which version of the browser isolation controls should apply. - `"v1"` - `"v2"` - `block_page: Optional[BlockPage]` Configure custom block page settings. If missing or null, use the account settings. Settable only for `http` rules with the action set to `block`. - `target_uri: str` Specify the URI to which the user is redirected. - `include_context: Optional[bool]` Specify whether to pass the context information as query parameters. - `block_page_enabled: Optional[bool]` Enable the custom block page. Settable only for `dns` rules with action `block`. - `block_reason: Optional[str]` Explain why the rule blocks the request. The custom block page shows this text (if enabled). Settable only for `dns`, `l4`, and `http` rules when the action set to `block`. - `bypass_parent_rule: Optional[bool]` Set to enable MSP accounts to bypass their parent's rules. Only MSP child accounts can set this. Settable for all types of rules. - `check_session: Optional[CheckSession]` Configure session check behavior. Settable only for `l4` and `http` rules with the action set to `allow`. - `duration: Optional[str]` Sets the required session freshness threshold. The API returns a normalized version of this value. - `enforce: Optional[bool]` Enable session enforcement. - `dns_resolvers: Optional[DNSResolvers]` Configure custom resolvers to route queries that match the resolver policy. Unused with 'resolve_dns_through_cloudflare' or 'resolve_dns_internally' settings. DNS queries get routed to the address closest to their origin. Only valid when a rule's action set to 'resolve'. Settable only for `dns_resolver` rules. - `ipv4: Optional[List[DNSResolverSettingsV4]]` - `ip: str` Specify the IPv4 address of the upstream resolver. - `port: Optional[int]` Specify a port number to use for the upstream resolver. Defaults to 53 if unspecified. - `route_through_private_network: Optional[bool]` Indicate whether to connect to this resolver over a private network. Must set when vnet_id set. - `vnet_id: Optional[str]` Specify an optional virtual network for this resolver. Uses default virtual network id if omitted. - `ipv6: Optional[List[DNSResolverSettingsV6]]` - `ip: str` Specify the IPv6 address of the upstream resolver. - `port: Optional[int]` Specify a port number to use for the upstream resolver. Defaults to 53 if unspecified. - `route_through_private_network: Optional[bool]` Indicate whether to connect to this resolver over a private network. Must set when vnet_id set. - `vnet_id: Optional[str]` Specify an optional virtual network for this resolver. Uses default virtual network id if omitted. - `egress: Optional[Egress]` Configure how Gateway Proxy traffic egresses. You can enable this setting for rules with Egress actions and filters, or omit it to indicate local egress via WARP IPs. Settable only for `egress` rules. - `ipv4: Optional[str]` Specify the IPv4 address to use for egress. - `ipv4_fallback: Optional[str]` Specify the fallback IPv4 address to use for egress when the primary IPv4 fails. Set '0.0.0.0' to indicate local egress via WARP IPs. - `ipv6: Optional[str]` Specify the IPv6 range to use for egress. - `forensic_copy: Optional[ForensicCopy]` Configure whether a copy of the HTTP request will be sent to storage when the rule matches. - `enabled: Optional[bool]` Enable sending the copy to storage. - `ignore_cname_category_matches: Optional[bool]` Ignore category matches at CNAME domains in a response. When off, evaluate categories in this rule against all CNAME domain categories in the response. Settable only for `dns` and `dns_resolver` rules. - `insecure_disable_dnssec_validation: Optional[bool]` Specify whether to disable DNSSEC validation (for Allow actions) [INSECURE]. Settable only for `dns` rules. - `ip_categories: Optional[bool]` Enable IPs in DNS resolver category blocks. The system blocks only domain name categories unless you enable this setting. Settable only for `dns` and `dns_resolver` rules. - `ip_indicator_feeds: Optional[bool]` Indicates whether to include IPs in DNS resolver indicator feed blocks. Default, indicator feeds block only domain names. Settable only for `dns` and `dns_resolver` rules. - `l4override: Optional[L4override]` Send matching traffic to the supplied destination IP address and port. Settable only for `l4` rules with the action set to `l4_override`. - `ip: Optional[str]` Defines the IPv4 or IPv6 address. - `port: Optional[int]` Defines a port number to use for TCP/UDP overrides. - `notification_settings: Optional[NotificationSettings]` Configure a notification to display on the user's device when this rule matched. Settable for all types of rules with the action set to `block`. - `enabled: Optional[bool]` Enable notification. - `include_context: Optional[bool]` Indicates whether to pass the context information as query parameters. - `msg: Optional[str]` Customize the message shown in the notification. - `support_url: Optional[str]` Defines an optional URL to direct users to additional information. If unset, the notification opens a block page. - `override_host: Optional[str]` Defines a hostname for override, for the matching DNS queries. Settable only for `dns` rules with the action set to `override`. - `override_ips: Optional[List[str]]` Defines a an IP or set of IPs for overriding matched DNS queries. Settable only for `dns` rules with the action set to `override`. - `payload_log: Optional[PayloadLog]` Configure DLP payload logging. Settable only for `http` rules. - `enabled: Optional[bool]` Enable DLP payload logging for this rule. - `quarantine: Optional[Quarantine]` Configure settings that apply to quarantine rules. Settable only for `http` rules. - `file_types: Optional[List[Literal["exe", "pdf", "doc", 10 more]]]` Specify the types of files to sandbox. - `"exe"` - `"pdf"` - `"doc"` - `"docm"` - `"docx"` - `"rtf"` - `"ppt"` - `"pptx"` - `"xls"` - `"xlsm"` - `"xlsx"` - `"zip"` - `"rar"` - `redirect: Optional[Redirect]` Apply settings to redirect rules. Settable only for `http` rules with the action set to `redirect`. - `target_uri: str` Specify the URI to which the user is redirected. - `include_context: Optional[bool]` Specify whether to pass the context information as query parameters. - `preserve_path_and_query: Optional[bool]` Specify whether to append the path and query parameters from the original request to target_uri. - `resolve_dns_internally: Optional[ResolveDNSInternally]` Configure to forward the query to the internal DNS service, passing the specified 'view_id' as input. Not used when 'dns_resolvers' is specified or 'resolve_dns_through_cloudflare' is set. Only valid when a rule's action set to 'resolve'. Settable only for `dns_resolver` rules. - `fallback: Optional[Literal["none", "public_dns"]]` Specify the fallback behavior to apply when the internal DNS response code differs from 'NOERROR' or when the response data contains only CNAME records for 'A' or 'AAAA' queries. - `"none"` - `"public_dns"` - `view_id: Optional[str]` Specify the internal DNS view identifier to pass to the internal DNS service. - `resolve_dns_through_cloudflare: Optional[bool]` Enable to send queries that match the policy to Cloudflare's default 1.1.1.1 DNS resolver. Cannot set when 'dns_resolvers' specified or 'resolve_dns_internally' is set. Only valid when a rule's action set to 'resolve'. Settable only for `dns_resolver` rules. - `untrusted_cert: Optional[UntrustedCERT]` Configure behavior when an upstream certificate is invalid or an SSL error occurs. Settable only for `http` rules with the action set to `allow`. - `action: Optional[Literal["pass_through", "block", "error"]]` Defines the action performed when an untrusted certificate seen. The default action an error with HTTP code 526. - `"pass_through"` - `"block"` - `"error"` - `schedule: Optional[Schedule]` Defines the schedule for activating DNS policies. Settable only for `dns` and `dns_resolver` rules. - `fri: Optional[str]` Specify the time intervals when the rule is active on Fridays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Fridays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `mon: Optional[str]` Specify the time intervals when the rule is active on Mondays, in the increasing order from 00:00-24:00(capped at maximum of 6 time splits). If this parameter omitted, the rule is deactivated on Mondays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `sat: Optional[str]` Specify the time intervals when the rule is active on Saturdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Saturdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `sun: Optional[str]` Specify the time intervals when the rule is active on Sundays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Sundays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `thu: Optional[str]` Specify the time intervals when the rule is active on Thursdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Thursdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `time_zone: Optional[str]` Specify the time zone for rule evaluation. When a [valid time zone city name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) is provided, Gateway always uses the current time for that time zone. When this parameter is omitted, Gateway uses the time zone determined from the user's IP address. Colo time zone is used when the user's IP address does not resolve to a location. - `tue: Optional[str]` Specify the time intervals when the rule is active on Tuesdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Tuesdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `wed: Optional[str]` Specify the time intervals when the rule is active on Wednesdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Wednesdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `sharable: Optional[bool]` Indicate that this rule is sharable via the Orgs API. - `source_account: Optional[str]` Provide the account tag of the account that created the rule. - `updated_at: Optional[datetime]` - `version: Optional[int]` Indicate the version number of the rule(read-only). - `warning_status: Optional[str]` Indicate a warning for a misconfigured rule, if any. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) gateway_rule = client.zero_trust.gateway.rules.reset_expiration( rule_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) print(gateway_rule.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "action": "allow", "enabled": true, "filters": [ "http" ], "name": "block bad websites", "precedence": 0, "traffic": "http.request.uri matches \".*a/partial/uri.*\" and http.request.host in $01302951-49f9-47c9-a400-0297e60b6a10", "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "created_at": "2014-01-01T05:20:00.12345Z", "deleted_at": "2019-12-27T18:11:19.117Z", "description": "Block bad websites based on their host name.", "device_posture": "any(device_posture.checks.passed[*] in {\"1308749e-fcfb-4ebc-b051-fe022b632644\"})", "expiration": { "expires_at": "2014-01-01T05:20:20Z", "duration": 10, "expired": false }, "identity": "any(identity.groups.name[*] in {\"finance\"})", "read_only": true, "rule_settings": { "add_headers": { "My-Next-Header": [ "foo", "bar" ], "X-Custom-Header-Name": [ "somecustomvalue" ] }, "allow_child_bypass": false, "audit_ssh": { "command_logging": false }, "biso_admin_controls": { "copy": "remote_only", "dcp": true, "dd": true, "dk": true, "download": "enabled", "dp": false, "du": true, "keyboard": "enabled", "paste": "enabled", "printing": "enabled", "upload": "enabled", "version": "v1" }, "block_page": { "target_uri": "https://example.com", "include_context": true }, "block_page_enabled": true, "block_reason": "This website is a security risk", "bypass_parent_rule": false, "check_session": { "duration": "300s", "enforce": true }, "dns_resolvers": { "ipv4": [ { "ip": "2.2.2.2", "port": 5053, "route_through_private_network": true, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415" } ], "ipv6": [ { "ip": "2001:DB8::", "port": 5053, "route_through_private_network": true, "vnet_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415" } ] }, "egress": { "ipv4": "192.0.2.2", "ipv4_fallback": "192.0.2.3", "ipv6": "2001:DB8::/64" }, "forensic_copy": { "enabled": true }, "ignore_cname_category_matches": true, "insecure_disable_dnssec_validation": false, "ip_categories": true, "ip_indicator_feeds": true, "l4override": { "ip": "1.1.1.1", "port": 0 }, "notification_settings": { "enabled": true, "include_context": true, "msg": "msg", "support_url": "support_url" }, "override_host": "example.com", "override_ips": [ "1.1.1.1", "2.2.2.2" ], "payload_log": { "enabled": true }, "quarantine": { "file_types": [ "exe" ] }, "redirect": { "target_uri": "https://example.com", "include_context": true, "preserve_path_and_query": true }, "resolve_dns_internally": { "fallback": "none", "view_id": "view_id" }, "resolve_dns_through_cloudflare": true, "untrusted_cert": { "action": "error" } }, "schedule": { "fri": "08:00-12:30,13:30-17:00", "mon": "08:00-12:30,13:30-17:00", "sat": "08:00-12:30,13:30-17:00", "sun": "08:00-12:30,13:30-17:00", "thu": "08:00-12:30,13:30-17:00", "time_zone": "America/New York", "tue": "08:00-12:30,13:30-17:00", "wed": "08:00-12:30,13:30-17:00" }, "sharable": true, "source_account": "source_account", "updated_at": "2014-01-01T05:20:00.12345Z", "version": 1, "warning_status": "warning_status" } } ``` ## Domain Types ### DNS Resolver Settings V4 - `class DNSResolverSettingsV4: …` - `ip: str` Specify the IPv4 address of the upstream resolver. - `port: Optional[int]` Specify a port number to use for the upstream resolver. Defaults to 53 if unspecified. - `route_through_private_network: Optional[bool]` Indicate whether to connect to this resolver over a private network. Must set when vnet_id set. - `vnet_id: Optional[str]` Specify an optional virtual network for this resolver. Uses default virtual network id if omitted. ### DNS Resolver Settings V6 - `class DNSResolverSettingsV6: …` - `ip: str` Specify the IPv6 address of the upstream resolver. - `port: Optional[int]` Specify a port number to use for the upstream resolver. Defaults to 53 if unspecified. - `route_through_private_network: Optional[bool]` Indicate whether to connect to this resolver over a private network. Must set when vnet_id set. - `vnet_id: Optional[str]` Specify an optional virtual network for this resolver. Uses default virtual network id if omitted. ### Gateway Filter - `Literal["http", "dns", "l4", 2 more]` Specify the protocol or layer to use. - `"http"` - `"dns"` - `"l4"` - `"egress"` - `"dns_resolver"` ### Gateway Rule - `class GatewayRule: …` - `action: Literal["on", "off", "allow", 13 more]` Specify the action to perform when the associated traffic, identity, and device posture expressions either absent or evaluate to `true`. - `"on"` - `"off"` - `"allow"` - `"block"` - `"scan"` - `"noscan"` - `"safesearch"` - `"ytrestricted"` - `"isolate"` - `"noisolate"` - `"override"` - `"l4_override"` - `"egress"` - `"resolve"` - `"quarantine"` - `"redirect"` - `enabled: bool` Specify whether the rule is enabled. - `filters: List[GatewayFilter]` Specify the protocol or layer to evaluate the traffic, identity, and device posture expressions. Can only contain a single value. - `"http"` - `"dns"` - `"l4"` - `"egress"` - `"dns_resolver"` - `name: str` Specify the rule name. - `precedence: int` Set the order of your rules. Lower values indicate higher precedence. At each processing phase, evaluate applicable rules in ascending order of this value. Refer to [Order of enforcement](http://developers.cloudflare.com/learning-paths/secure-internet-traffic/understand-policies/order-of-enforcement/#manage-precedence-with-terraform) to manage precedence via Terraform. - `traffic: str` Specify the wirefilter expression used for traffic matching. The API automatically formats and sanitizes expressions before storing them. To prevent Terraform state drift, use the formatted expression returned in the API response. - `id: Optional[str]` Identify the API resource with a UUID. - `created_at: Optional[datetime]` - `deleted_at: Optional[datetime]` Indicate the date of deletion, if any. - `description: Optional[str]` Specify the rule description. - `device_posture: Optional[str]` Specify the wirefilter expression used for device posture check. The API automatically formats and sanitizes expressions before storing them. To prevent Terraform state drift, use the formatted expression returned in the API response. - `expiration: Optional[Expiration]` Defines the expiration time stamp and default duration of a DNS policy. Takes precedence over the policy's `schedule` configuration, if any. This does not apply to HTTP or network policies. Settable only for `dns` rules. - `expires_at: datetime` Show the timestamp when the policy expires and stops applying. The value must follow RFC 3339 and include a UTC offset. The system accepts non-zero offsets but converts them to the equivalent UTC+00:00 value and returns timestamps with a trailing Z. Expiration policies ignore client timezones and expire globally at the specified expires_at time. - `duration: Optional[int]` Defines the default duration a policy active in minutes. Must set in order to use the `reset_expiration` endpoint on this rule. - `expired: Optional[bool]` Indicates whether the policy is expired. - `identity: Optional[str]` Specify the wirefilter expression used for identity matching. The API automatically formats and sanitizes expressions before storing them. To prevent Terraform state drift, use the formatted expression returned in the API response. - `read_only: Optional[bool]` Indicate that this rule is shared via the Orgs API and read only. - `rule_settings: Optional[RuleSetting]` Defines settings for this rule. Settings apply only to specific rule types and must use compatible selectors. If Terraform detects drift, confirm the setting supports your rule type and check whether the API modifies the value. Use API-returned values in your configuration to prevent drift. - `add_headers: Optional[Dict[str, List[str]]]` Add custom headers to allowed requests as key-value pairs. Use header names as keys that map to arrays of header values. Settable only for `http` rules with the action set to `allow`. - `allow_child_bypass: Optional[bool]` Set to enable MSP children to bypass this rule. Only parent MSP accounts can set this. this rule. Settable for all types of rules. - `audit_ssh: Optional[AuditSSH]` Define the settings for the Audit SSH action. Settable only for `l4` rules with `audit_ssh` action. - `command_logging: Optional[bool]` Enable SSH command logging. - `biso_admin_controls: Optional[BISOAdminControls]` Configure browser isolation behavior. Settable only for `http` rules with the action set to `isolate`. - `copy: Optional[Literal["enabled", "disabled", "remote_only"]]` Configure copy behavior. If set to remote_only, users cannot copy isolated content from the remote browser to the local clipboard. If this field is absent, copying remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `"remote_only"` - `dcp: Optional[bool]` Set to false to enable copy-pasting. Only applies when `version == "v1"`. - `dd: Optional[bool]` Set to false to enable downloading. Only applies when `version == "v1"`. - `dk: Optional[bool]` Set to false to enable keyboard usage. Only applies when `version == "v1"`. - `download: Optional[Literal["enabled", "disabled", "remote_only"]]` Configure download behavior. When set to remote_only, users can view downloads but cannot save them. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `"remote_only"` - `dp: Optional[bool]` Set to false to enable printing. Only applies when `version == "v1"`. - `du: Optional[bool]` Set to false to enable uploading. Only applies when `version == "v1"`. - `keyboard: Optional[Literal["enabled", "disabled"]]` Configure keyboard usage behavior. If this field is absent, keyboard usage remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `paste: Optional[Literal["enabled", "disabled", "remote_only"]]` Configure paste behavior. If set to remote_only, users cannot paste content from the local clipboard into isolated pages. If this field is absent, pasting remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `"remote_only"` - `printing: Optional[Literal["enabled", "disabled"]]` Configure print behavior. Default, Printing is enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `upload: Optional[Literal["enabled", "disabled"]]` Configure upload behavior. If this field is absent, uploading remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `version: Optional[Literal["v1", "v2"]]` Indicate which version of the browser isolation controls should apply. - `"v1"` - `"v2"` - `block_page: Optional[BlockPage]` Configure custom block page settings. If missing or null, use the account settings. Settable only for `http` rules with the action set to `block`. - `target_uri: str` Specify the URI to which the user is redirected. - `include_context: Optional[bool]` Specify whether to pass the context information as query parameters. - `block_page_enabled: Optional[bool]` Enable the custom block page. Settable only for `dns` rules with action `block`. - `block_reason: Optional[str]` Explain why the rule blocks the request. The custom block page shows this text (if enabled). Settable only for `dns`, `l4`, and `http` rules when the action set to `block`. - `bypass_parent_rule: Optional[bool]` Set to enable MSP accounts to bypass their parent's rules. Only MSP child accounts can set this. Settable for all types of rules. - `check_session: Optional[CheckSession]` Configure session check behavior. Settable only for `l4` and `http` rules with the action set to `allow`. - `duration: Optional[str]` Sets the required session freshness threshold. The API returns a normalized version of this value. - `enforce: Optional[bool]` Enable session enforcement. - `dns_resolvers: Optional[DNSResolvers]` Configure custom resolvers to route queries that match the resolver policy. Unused with 'resolve_dns_through_cloudflare' or 'resolve_dns_internally' settings. DNS queries get routed to the address closest to their origin. Only valid when a rule's action set to 'resolve'. Settable only for `dns_resolver` rules. - `ipv4: Optional[List[DNSResolverSettingsV4]]` - `ip: str` Specify the IPv4 address of the upstream resolver. - `port: Optional[int]` Specify a port number to use for the upstream resolver. Defaults to 53 if unspecified. - `route_through_private_network: Optional[bool]` Indicate whether to connect to this resolver over a private network. Must set when vnet_id set. - `vnet_id: Optional[str]` Specify an optional virtual network for this resolver. Uses default virtual network id if omitted. - `ipv6: Optional[List[DNSResolverSettingsV6]]` - `ip: str` Specify the IPv6 address of the upstream resolver. - `port: Optional[int]` Specify a port number to use for the upstream resolver. Defaults to 53 if unspecified. - `route_through_private_network: Optional[bool]` Indicate whether to connect to this resolver over a private network. Must set when vnet_id set. - `vnet_id: Optional[str]` Specify an optional virtual network for this resolver. Uses default virtual network id if omitted. - `egress: Optional[Egress]` Configure how Gateway Proxy traffic egresses. You can enable this setting for rules with Egress actions and filters, or omit it to indicate local egress via WARP IPs. Settable only for `egress` rules. - `ipv4: Optional[str]` Specify the IPv4 address to use for egress. - `ipv4_fallback: Optional[str]` Specify the fallback IPv4 address to use for egress when the primary IPv4 fails. Set '0.0.0.0' to indicate local egress via WARP IPs. - `ipv6: Optional[str]` Specify the IPv6 range to use for egress. - `forensic_copy: Optional[ForensicCopy]` Configure whether a copy of the HTTP request will be sent to storage when the rule matches. - `enabled: Optional[bool]` Enable sending the copy to storage. - `ignore_cname_category_matches: Optional[bool]` Ignore category matches at CNAME domains in a response. When off, evaluate categories in this rule against all CNAME domain categories in the response. Settable only for `dns` and `dns_resolver` rules. - `insecure_disable_dnssec_validation: Optional[bool]` Specify whether to disable DNSSEC validation (for Allow actions) [INSECURE]. Settable only for `dns` rules. - `ip_categories: Optional[bool]` Enable IPs in DNS resolver category blocks. The system blocks only domain name categories unless you enable this setting. Settable only for `dns` and `dns_resolver` rules. - `ip_indicator_feeds: Optional[bool]` Indicates whether to include IPs in DNS resolver indicator feed blocks. Default, indicator feeds block only domain names. Settable only for `dns` and `dns_resolver` rules. - `l4override: Optional[L4override]` Send matching traffic to the supplied destination IP address and port. Settable only for `l4` rules with the action set to `l4_override`. - `ip: Optional[str]` Defines the IPv4 or IPv6 address. - `port: Optional[int]` Defines a port number to use for TCP/UDP overrides. - `notification_settings: Optional[NotificationSettings]` Configure a notification to display on the user's device when this rule matched. Settable for all types of rules with the action set to `block`. - `enabled: Optional[bool]` Enable notification. - `include_context: Optional[bool]` Indicates whether to pass the context information as query parameters. - `msg: Optional[str]` Customize the message shown in the notification. - `support_url: Optional[str]` Defines an optional URL to direct users to additional information. If unset, the notification opens a block page. - `override_host: Optional[str]` Defines a hostname for override, for the matching DNS queries. Settable only for `dns` rules with the action set to `override`. - `override_ips: Optional[List[str]]` Defines a an IP or set of IPs for overriding matched DNS queries. Settable only for `dns` rules with the action set to `override`. - `payload_log: Optional[PayloadLog]` Configure DLP payload logging. Settable only for `http` rules. - `enabled: Optional[bool]` Enable DLP payload logging for this rule. - `quarantine: Optional[Quarantine]` Configure settings that apply to quarantine rules. Settable only for `http` rules. - `file_types: Optional[List[Literal["exe", "pdf", "doc", 10 more]]]` Specify the types of files to sandbox. - `"exe"` - `"pdf"` - `"doc"` - `"docm"` - `"docx"` - `"rtf"` - `"ppt"` - `"pptx"` - `"xls"` - `"xlsm"` - `"xlsx"` - `"zip"` - `"rar"` - `redirect: Optional[Redirect]` Apply settings to redirect rules. Settable only for `http` rules with the action set to `redirect`. - `target_uri: str` Specify the URI to which the user is redirected. - `include_context: Optional[bool]` Specify whether to pass the context information as query parameters. - `preserve_path_and_query: Optional[bool]` Specify whether to append the path and query parameters from the original request to target_uri. - `resolve_dns_internally: Optional[ResolveDNSInternally]` Configure to forward the query to the internal DNS service, passing the specified 'view_id' as input. Not used when 'dns_resolvers' is specified or 'resolve_dns_through_cloudflare' is set. Only valid when a rule's action set to 'resolve'. Settable only for `dns_resolver` rules. - `fallback: Optional[Literal["none", "public_dns"]]` Specify the fallback behavior to apply when the internal DNS response code differs from 'NOERROR' or when the response data contains only CNAME records for 'A' or 'AAAA' queries. - `"none"` - `"public_dns"` - `view_id: Optional[str]` Specify the internal DNS view identifier to pass to the internal DNS service. - `resolve_dns_through_cloudflare: Optional[bool]` Enable to send queries that match the policy to Cloudflare's default 1.1.1.1 DNS resolver. Cannot set when 'dns_resolvers' specified or 'resolve_dns_internally' is set. Only valid when a rule's action set to 'resolve'. Settable only for `dns_resolver` rules. - `untrusted_cert: Optional[UntrustedCERT]` Configure behavior when an upstream certificate is invalid or an SSL error occurs. Settable only for `http` rules with the action set to `allow`. - `action: Optional[Literal["pass_through", "block", "error"]]` Defines the action performed when an untrusted certificate seen. The default action an error with HTTP code 526. - `"pass_through"` - `"block"` - `"error"` - `schedule: Optional[Schedule]` Defines the schedule for activating DNS policies. Settable only for `dns` and `dns_resolver` rules. - `fri: Optional[str]` Specify the time intervals when the rule is active on Fridays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Fridays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `mon: Optional[str]` Specify the time intervals when the rule is active on Mondays, in the increasing order from 00:00-24:00(capped at maximum of 6 time splits). If this parameter omitted, the rule is deactivated on Mondays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `sat: Optional[str]` Specify the time intervals when the rule is active on Saturdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Saturdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `sun: Optional[str]` Specify the time intervals when the rule is active on Sundays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Sundays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `thu: Optional[str]` Specify the time intervals when the rule is active on Thursdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Thursdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `time_zone: Optional[str]` Specify the time zone for rule evaluation. When a [valid time zone city name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) is provided, Gateway always uses the current time for that time zone. When this parameter is omitted, Gateway uses the time zone determined from the user's IP address. Colo time zone is used when the user's IP address does not resolve to a location. - `tue: Optional[str]` Specify the time intervals when the rule is active on Tuesdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Tuesdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `wed: Optional[str]` Specify the time intervals when the rule is active on Wednesdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Wednesdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `sharable: Optional[bool]` Indicate that this rule is sharable via the Orgs API. - `source_account: Optional[str]` Provide the account tag of the account that created the rule. - `updated_at: Optional[datetime]` - `version: Optional[int]` Indicate the version number of the rule(read-only). - `warning_status: Optional[str]` Indicate a warning for a misconfigured rule, if any. ### Rule Setting - `class RuleSetting: …` Defines settings for this rule. Settings apply only to specific rule types and must use compatible selectors. If Terraform detects drift, confirm the setting supports your rule type and check whether the API modifies the value. Use API-returned values in your configuration to prevent drift. - `add_headers: Optional[Dict[str, List[str]]]` Add custom headers to allowed requests as key-value pairs. Use header names as keys that map to arrays of header values. Settable only for `http` rules with the action set to `allow`. - `allow_child_bypass: Optional[bool]` Set to enable MSP children to bypass this rule. Only parent MSP accounts can set this. this rule. Settable for all types of rules. - `audit_ssh: Optional[AuditSSH]` Define the settings for the Audit SSH action. Settable only for `l4` rules with `audit_ssh` action. - `command_logging: Optional[bool]` Enable SSH command logging. - `biso_admin_controls: Optional[BISOAdminControls]` Configure browser isolation behavior. Settable only for `http` rules with the action set to `isolate`. - `copy: Optional[Literal["enabled", "disabled", "remote_only"]]` Configure copy behavior. If set to remote_only, users cannot copy isolated content from the remote browser to the local clipboard. If this field is absent, copying remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `"remote_only"` - `dcp: Optional[bool]` Set to false to enable copy-pasting. Only applies when `version == "v1"`. - `dd: Optional[bool]` Set to false to enable downloading. Only applies when `version == "v1"`. - `dk: Optional[bool]` Set to false to enable keyboard usage. Only applies when `version == "v1"`. - `download: Optional[Literal["enabled", "disabled", "remote_only"]]` Configure download behavior. When set to remote_only, users can view downloads but cannot save them. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `"remote_only"` - `dp: Optional[bool]` Set to false to enable printing. Only applies when `version == "v1"`. - `du: Optional[bool]` Set to false to enable uploading. Only applies when `version == "v1"`. - `keyboard: Optional[Literal["enabled", "disabled"]]` Configure keyboard usage behavior. If this field is absent, keyboard usage remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `paste: Optional[Literal["enabled", "disabled", "remote_only"]]` Configure paste behavior. If set to remote_only, users cannot paste content from the local clipboard into isolated pages. If this field is absent, pasting remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `"remote_only"` - `printing: Optional[Literal["enabled", "disabled"]]` Configure print behavior. Default, Printing is enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `upload: Optional[Literal["enabled", "disabled"]]` Configure upload behavior. If this field is absent, uploading remains enabled. Applies only when version == "v2". - `"enabled"` - `"disabled"` - `version: Optional[Literal["v1", "v2"]]` Indicate which version of the browser isolation controls should apply. - `"v1"` - `"v2"` - `block_page: Optional[BlockPage]` Configure custom block page settings. If missing or null, use the account settings. Settable only for `http` rules with the action set to `block`. - `target_uri: str` Specify the URI to which the user is redirected. - `include_context: Optional[bool]` Specify whether to pass the context information as query parameters. - `block_page_enabled: Optional[bool]` Enable the custom block page. Settable only for `dns` rules with action `block`. - `block_reason: Optional[str]` Explain why the rule blocks the request. The custom block page shows this text (if enabled). Settable only for `dns`, `l4`, and `http` rules when the action set to `block`. - `bypass_parent_rule: Optional[bool]` Set to enable MSP accounts to bypass their parent's rules. Only MSP child accounts can set this. Settable for all types of rules. - `check_session: Optional[CheckSession]` Configure session check behavior. Settable only for `l4` and `http` rules with the action set to `allow`. - `duration: Optional[str]` Sets the required session freshness threshold. The API returns a normalized version of this value. - `enforce: Optional[bool]` Enable session enforcement. - `dns_resolvers: Optional[DNSResolvers]` Configure custom resolvers to route queries that match the resolver policy. Unused with 'resolve_dns_through_cloudflare' or 'resolve_dns_internally' settings. DNS queries get routed to the address closest to their origin. Only valid when a rule's action set to 'resolve'. Settable only for `dns_resolver` rules. - `ipv4: Optional[List[DNSResolverSettingsV4]]` - `ip: str` Specify the IPv4 address of the upstream resolver. - `port: Optional[int]` Specify a port number to use for the upstream resolver. Defaults to 53 if unspecified. - `route_through_private_network: Optional[bool]` Indicate whether to connect to this resolver over a private network. Must set when vnet_id set. - `vnet_id: Optional[str]` Specify an optional virtual network for this resolver. Uses default virtual network id if omitted. - `ipv6: Optional[List[DNSResolverSettingsV6]]` - `ip: str` Specify the IPv6 address of the upstream resolver. - `port: Optional[int]` Specify a port number to use for the upstream resolver. Defaults to 53 if unspecified. - `route_through_private_network: Optional[bool]` Indicate whether to connect to this resolver over a private network. Must set when vnet_id set. - `vnet_id: Optional[str]` Specify an optional virtual network for this resolver. Uses default virtual network id if omitted. - `egress: Optional[Egress]` Configure how Gateway Proxy traffic egresses. You can enable this setting for rules with Egress actions and filters, or omit it to indicate local egress via WARP IPs. Settable only for `egress` rules. - `ipv4: Optional[str]` Specify the IPv4 address to use for egress. - `ipv4_fallback: Optional[str]` Specify the fallback IPv4 address to use for egress when the primary IPv4 fails. Set '0.0.0.0' to indicate local egress via WARP IPs. - `ipv6: Optional[str]` Specify the IPv6 range to use for egress. - `forensic_copy: Optional[ForensicCopy]` Configure whether a copy of the HTTP request will be sent to storage when the rule matches. - `enabled: Optional[bool]` Enable sending the copy to storage. - `ignore_cname_category_matches: Optional[bool]` Ignore category matches at CNAME domains in a response. When off, evaluate categories in this rule against all CNAME domain categories in the response. Settable only for `dns` and `dns_resolver` rules. - `insecure_disable_dnssec_validation: Optional[bool]` Specify whether to disable DNSSEC validation (for Allow actions) [INSECURE]. Settable only for `dns` rules. - `ip_categories: Optional[bool]` Enable IPs in DNS resolver category blocks. The system blocks only domain name categories unless you enable this setting. Settable only for `dns` and `dns_resolver` rules. - `ip_indicator_feeds: Optional[bool]` Indicates whether to include IPs in DNS resolver indicator feed blocks. Default, indicator feeds block only domain names. Settable only for `dns` and `dns_resolver` rules. - `l4override: Optional[L4override]` Send matching traffic to the supplied destination IP address and port. Settable only for `l4` rules with the action set to `l4_override`. - `ip: Optional[str]` Defines the IPv4 or IPv6 address. - `port: Optional[int]` Defines a port number to use for TCP/UDP overrides. - `notification_settings: Optional[NotificationSettings]` Configure a notification to display on the user's device when this rule matched. Settable for all types of rules with the action set to `block`. - `enabled: Optional[bool]` Enable notification. - `include_context: Optional[bool]` Indicates whether to pass the context information as query parameters. - `msg: Optional[str]` Customize the message shown in the notification. - `support_url: Optional[str]` Defines an optional URL to direct users to additional information. If unset, the notification opens a block page. - `override_host: Optional[str]` Defines a hostname for override, for the matching DNS queries. Settable only for `dns` rules with the action set to `override`. - `override_ips: Optional[List[str]]` Defines a an IP or set of IPs for overriding matched DNS queries. Settable only for `dns` rules with the action set to `override`. - `payload_log: Optional[PayloadLog]` Configure DLP payload logging. Settable only for `http` rules. - `enabled: Optional[bool]` Enable DLP payload logging for this rule. - `quarantine: Optional[Quarantine]` Configure settings that apply to quarantine rules. Settable only for `http` rules. - `file_types: Optional[List[Literal["exe", "pdf", "doc", 10 more]]]` Specify the types of files to sandbox. - `"exe"` - `"pdf"` - `"doc"` - `"docm"` - `"docx"` - `"rtf"` - `"ppt"` - `"pptx"` - `"xls"` - `"xlsm"` - `"xlsx"` - `"zip"` - `"rar"` - `redirect: Optional[Redirect]` Apply settings to redirect rules. Settable only for `http` rules with the action set to `redirect`. - `target_uri: str` Specify the URI to which the user is redirected. - `include_context: Optional[bool]` Specify whether to pass the context information as query parameters. - `preserve_path_and_query: Optional[bool]` Specify whether to append the path and query parameters from the original request to target_uri. - `resolve_dns_internally: Optional[ResolveDNSInternally]` Configure to forward the query to the internal DNS service, passing the specified 'view_id' as input. Not used when 'dns_resolvers' is specified or 'resolve_dns_through_cloudflare' is set. Only valid when a rule's action set to 'resolve'. Settable only for `dns_resolver` rules. - `fallback: Optional[Literal["none", "public_dns"]]` Specify the fallback behavior to apply when the internal DNS response code differs from 'NOERROR' or when the response data contains only CNAME records for 'A' or 'AAAA' queries. - `"none"` - `"public_dns"` - `view_id: Optional[str]` Specify the internal DNS view identifier to pass to the internal DNS service. - `resolve_dns_through_cloudflare: Optional[bool]` Enable to send queries that match the policy to Cloudflare's default 1.1.1.1 DNS resolver. Cannot set when 'dns_resolvers' specified or 'resolve_dns_internally' is set. Only valid when a rule's action set to 'resolve'. Settable only for `dns_resolver` rules. - `untrusted_cert: Optional[UntrustedCERT]` Configure behavior when an upstream certificate is invalid or an SSL error occurs. Settable only for `http` rules with the action set to `allow`. - `action: Optional[Literal["pass_through", "block", "error"]]` Defines the action performed when an untrusted certificate seen. The default action an error with HTTP code 526. - `"pass_through"` - `"block"` - `"error"` ### Schedule - `class Schedule: …` Defines the schedule for activating DNS policies. Settable only for `dns` and `dns_resolver` rules. - `fri: Optional[str]` Specify the time intervals when the rule is active on Fridays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Fridays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `mon: Optional[str]` Specify the time intervals when the rule is active on Mondays, in the increasing order from 00:00-24:00(capped at maximum of 6 time splits). If this parameter omitted, the rule is deactivated on Mondays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `sat: Optional[str]` Specify the time intervals when the rule is active on Saturdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Saturdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `sun: Optional[str]` Specify the time intervals when the rule is active on Sundays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Sundays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `thu: Optional[str]` Specify the time intervals when the rule is active on Thursdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Thursdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `time_zone: Optional[str]` Specify the time zone for rule evaluation. When a [valid time zone city name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) is provided, Gateway always uses the current time for that time zone. When this parameter is omitted, Gateway uses the time zone determined from the user's IP address. Colo time zone is used when the user's IP address does not resolve to a location. - `tue: Optional[str]` Specify the time intervals when the rule is active on Tuesdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Tuesdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. - `wed: Optional[str]` Specify the time intervals when the rule is active on Wednesdays, in the increasing order from 00:00-24:00. If this parameter omitted, the rule is deactivated on Wednesdays. API returns a formatted version of this string, which may cause Terraform drift if a unformatted value is used. # Certificates ## List Zero Trust certificates `zero_trust.gateway.certificates.list(CertificateListParams**kwargs) -> SyncSinglePage[CertificateListResponse]` **get** `/accounts/{account_id}/gateway/certificates` List all Zero Trust certificates for an account. ### Parameters - `account_id: str` ### Returns - `class CertificateListResponse: …` - `id: Optional[str]` Identify the certificate with a UUID. - `binding_status: Optional[Literal["pending_deployment", "available", "pending_deletion", "inactive"]]` Indicate the read-only deployment status of the certificate on Cloudflare's edge. Gateway TLS interception can use certificates in the 'available' (previously called 'active') state. - `"pending_deployment"` - `"available"` - `"pending_deletion"` - `"inactive"` - `certificate: Optional[str]` Provide the CA certificate (read-only). - `created_at: Optional[datetime]` - `expires_on: Optional[datetime]` - `fingerprint: Optional[str]` Provide the SHA256 fingerprint of the certificate (read-only). - `in_use: Optional[bool]` Indicate whether Gateway TLS interception uses this certificate (read-only). You cannot set this value directly. To configure interception, use the Gateway configuration setting named `certificate` (read-only). - `issuer_org: Optional[str]` Indicate the organization that issued the certificate (read-only). - `issuer_raw: Optional[str]` Provide the entire issuer field of the certificate (read-only). - `type: Optional[Literal["custom", "gateway_managed"]]` Indicate the read-only certificate type, BYO-PKI (custom) or Gateway-managed. - `"custom"` - `"gateway_managed"` - `updated_at: Optional[datetime]` - `uploaded_on: Optional[datetime]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.zero_trust.gateway.certificates.list( account_id="699d98642c564d2e855e9661899b7252", ) page = page.result[0] print(page.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "binding_status": "pending_deployment", "certificate": "-----BEGIN CERTIFICATE-----\\nMIIDmDCCAoCgAwIBAgIUKTOAZNjcXVZRj4oQt0SHsl1c1vMwDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVVMxFjAUBgNVBAgMDVNhbiBGcmFuY2lzY28xEzARBgNVBAcMCkNhbGlmb3JuaWExFTATBgNVBAoMDEV4YW1wbGUgSW5jLjAgFw0yMjExMjIxNjU5NDdaGA8yMTIyMTAyOTE2NTk0N1owUTELMAkGA1UEBhMCVVMxFjAUBgNVBAgMDVNhbiBGcmFuY2lzY28xEzARBgNVBAcMCkNhbGlmb3JuaWExFTATBgNVBAoMDEV4YW1wbGUgSW5jLjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMRcORwgJFTdcG/2GKI+cFYiOBNDKjCZUXEOvXWY42BkH9wxiMT869CO+enA1w5pIrXow6kCM1sQspHHaVmJUlotEMJxyoLFfA/8Kt1EKFyobOjuZs2SwyVyJ2sStvQuUQEosULZCNGZEqoH5g6zhMPxaxm7ZLrrsDZ9maNGVqo7EWLWHrZ57Q/5MtTrbxQL+eXjUmJ9K3kS+3uEwMdqR6Z3BluU1ivanpPc1CN2GNhdO0/hSY4YkGEnuLsqJyDd3cIiB1MxuCBJ4ZaqOd2viV1WcP3oU3dxVPm4MWyfYIldMWB14FahScxLhWdRnM9YZ/i9IFcLypXsuz7DjrJPtPUCAwEAAaNmMGQwHQYDVR0OBBYEFP5JzLUawNF+c3AXsYTEWHh7z2czMB8GA1UdIwQYMBaAFP5JzLUawNF+c3AXsYTEWHh7z2czMA4GA1UdDwEB/wQEAwIBBjASBgNVHRMBAf8ECDAGAQH/AgEBMA0GCSqGSIb3DQEBCwUAA4IBAQBc+Be7NDhpE09y7hLPZGRPl1cSKBw4RI0XIv6rlbSTFs5EebpTGjhx/whNxwEZhB9HZ7111Oa1YlT8xkI9DshB78mjAHCKBAJ76moK8tkG0aqdYpJ4ZcJTVBB7l98Rvgc7zfTii7WemTy72deBbSeiEtXavm4EF0mWjHhQ5Nxpnp00Bqn5g1x8CyTDypgmugnep+xG+iFzNmTdsz7WI9T/7kDMXqB7M/FPWBORyS98OJqNDswCLF8bIZYwUBEe+bRHFomoShMzaC3tvim7WCb16noDkSTMlfKO4pnvKhpcVdSgwcruATV7y+W+Lvmz2OT/Gui4JhqeoTewsxndhDDE\\n-----END CERTIFICATE-----\\n", "created_at": "2014-01-01T05:20:00.12345Z", "expires_on": "2014-01-01T05:20:00.12345Z", "fingerprint": "E9:19:49:AA:DD:D8:1E:C1:20:2A:D8:22:BF:A5:F8:FC:1A:F7:10:9F:C7:5B:69:AB:0:31:91:8B:61:B4:BF:1C", "in_use": true, "issuer_org": "Example Inc.", "issuer_raw": "O=Example Inc.,L=California,ST=San Francisco,C=US", "type": "gateway_managed", "updated_at": "2014-01-01T05:20:00.12345Z", "uploaded_on": "2014-01-01T05:20:00.12345Z" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Get Zero Trust certificate details `zero_trust.gateway.certificates.get(strcertificate_id, CertificateGetParams**kwargs) -> CertificateGetResponse` **get** `/accounts/{account_id}/gateway/certificates/{certificate_id}` Get a single Zero Trust certificate. ### Parameters - `account_id: str` - `certificate_id: str` Identify the certificate with a UUID. ### Returns - `class CertificateGetResponse: …` - `id: Optional[str]` Identify the certificate with a UUID. - `binding_status: Optional[Literal["pending_deployment", "available", "pending_deletion", "inactive"]]` Indicate the read-only deployment status of the certificate on Cloudflare's edge. Gateway TLS interception can use certificates in the 'available' (previously called 'active') state. - `"pending_deployment"` - `"available"` - `"pending_deletion"` - `"inactive"` - `certificate: Optional[str]` Provide the CA certificate (read-only). - `created_at: Optional[datetime]` - `expires_on: Optional[datetime]` - `fingerprint: Optional[str]` Provide the SHA256 fingerprint of the certificate (read-only). - `in_use: Optional[bool]` Indicate whether Gateway TLS interception uses this certificate (read-only). You cannot set this value directly. To configure interception, use the Gateway configuration setting named `certificate` (read-only). - `issuer_org: Optional[str]` Indicate the organization that issued the certificate (read-only). - `issuer_raw: Optional[str]` Provide the entire issuer field of the certificate (read-only). - `type: Optional[Literal["custom", "gateway_managed"]]` Indicate the read-only certificate type, BYO-PKI (custom) or Gateway-managed. - `"custom"` - `"gateway_managed"` - `updated_at: Optional[datetime]` - `uploaded_on: Optional[datetime]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) certificate = client.zero_trust.gateway.certificates.get( certificate_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) print(certificate.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "binding_status": "pending_deployment", "certificate": "-----BEGIN CERTIFICATE-----\\nMIIDmDCCAoCgAwIBAgIUKTOAZNjcXVZRj4oQt0SHsl1c1vMwDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVVMxFjAUBgNVBAgMDVNhbiBGcmFuY2lzY28xEzARBgNVBAcMCkNhbGlmb3JuaWExFTATBgNVBAoMDEV4YW1wbGUgSW5jLjAgFw0yMjExMjIxNjU5NDdaGA8yMTIyMTAyOTE2NTk0N1owUTELMAkGA1UEBhMCVVMxFjAUBgNVBAgMDVNhbiBGcmFuY2lzY28xEzARBgNVBAcMCkNhbGlmb3JuaWExFTATBgNVBAoMDEV4YW1wbGUgSW5jLjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMRcORwgJFTdcG/2GKI+cFYiOBNDKjCZUXEOvXWY42BkH9wxiMT869CO+enA1w5pIrXow6kCM1sQspHHaVmJUlotEMJxyoLFfA/8Kt1EKFyobOjuZs2SwyVyJ2sStvQuUQEosULZCNGZEqoH5g6zhMPxaxm7ZLrrsDZ9maNGVqo7EWLWHrZ57Q/5MtTrbxQL+eXjUmJ9K3kS+3uEwMdqR6Z3BluU1ivanpPc1CN2GNhdO0/hSY4YkGEnuLsqJyDd3cIiB1MxuCBJ4ZaqOd2viV1WcP3oU3dxVPm4MWyfYIldMWB14FahScxLhWdRnM9YZ/i9IFcLypXsuz7DjrJPtPUCAwEAAaNmMGQwHQYDVR0OBBYEFP5JzLUawNF+c3AXsYTEWHh7z2czMB8GA1UdIwQYMBaAFP5JzLUawNF+c3AXsYTEWHh7z2czMA4GA1UdDwEB/wQEAwIBBjASBgNVHRMBAf8ECDAGAQH/AgEBMA0GCSqGSIb3DQEBCwUAA4IBAQBc+Be7NDhpE09y7hLPZGRPl1cSKBw4RI0XIv6rlbSTFs5EebpTGjhx/whNxwEZhB9HZ7111Oa1YlT8xkI9DshB78mjAHCKBAJ76moK8tkG0aqdYpJ4ZcJTVBB7l98Rvgc7zfTii7WemTy72deBbSeiEtXavm4EF0mWjHhQ5Nxpnp00Bqn5g1x8CyTDypgmugnep+xG+iFzNmTdsz7WI9T/7kDMXqB7M/FPWBORyS98OJqNDswCLF8bIZYwUBEe+bRHFomoShMzaC3tvim7WCb16noDkSTMlfKO4pnvKhpcVdSgwcruATV7y+W+Lvmz2OT/Gui4JhqeoTewsxndhDDE\\n-----END CERTIFICATE-----\\n", "created_at": "2014-01-01T05:20:00.12345Z", "expires_on": "2014-01-01T05:20:00.12345Z", "fingerprint": "E9:19:49:AA:DD:D8:1E:C1:20:2A:D8:22:BF:A5:F8:FC:1A:F7:10:9F:C7:5B:69:AB:0:31:91:8B:61:B4:BF:1C", "in_use": true, "issuer_org": "Example Inc.", "issuer_raw": "O=Example Inc.,L=California,ST=San Francisco,C=US", "type": "gateway_managed", "updated_at": "2014-01-01T05:20:00.12345Z", "uploaded_on": "2014-01-01T05:20:00.12345Z" } } ``` ## Create Zero Trust certificate `zero_trust.gateway.certificates.create(CertificateCreateParams**kwargs) -> CertificateCreateResponse` **post** `/accounts/{account_id}/gateway/certificates` Create a new Zero Trust certificate. ### Parameters - `account_id: str` - `validity_period_days: Optional[int]` Sets the certificate validity period in days (range: 1-10,950 days / ~30 years). Defaults to 1,825 days (5 years). **Important**: This field is only settable during the certificate creation. Certificates becomes immutable after creation - use the `/activate` and `/deactivate` endpoints to manage certificate lifecycle. ### Returns - `class CertificateCreateResponse: …` - `id: Optional[str]` Identify the certificate with a UUID. - `binding_status: Optional[Literal["pending_deployment", "available", "pending_deletion", "inactive"]]` Indicate the read-only deployment status of the certificate on Cloudflare's edge. Gateway TLS interception can use certificates in the 'available' (previously called 'active') state. - `"pending_deployment"` - `"available"` - `"pending_deletion"` - `"inactive"` - `certificate: Optional[str]` Provide the CA certificate (read-only). - `created_at: Optional[datetime]` - `expires_on: Optional[datetime]` - `fingerprint: Optional[str]` Provide the SHA256 fingerprint of the certificate (read-only). - `in_use: Optional[bool]` Indicate whether Gateway TLS interception uses this certificate (read-only). You cannot set this value directly. To configure interception, use the Gateway configuration setting named `certificate` (read-only). - `issuer_org: Optional[str]` Indicate the organization that issued the certificate (read-only). - `issuer_raw: Optional[str]` Provide the entire issuer field of the certificate (read-only). - `type: Optional[Literal["custom", "gateway_managed"]]` Indicate the read-only certificate type, BYO-PKI (custom) or Gateway-managed. - `"custom"` - `"gateway_managed"` - `updated_at: Optional[datetime]` - `uploaded_on: Optional[datetime]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) certificate = client.zero_trust.gateway.certificates.create( account_id="699d98642c564d2e855e9661899b7252", ) print(certificate.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "binding_status": "pending_deployment", "certificate": "-----BEGIN CERTIFICATE-----\\nMIIDmDCCAoCgAwIBAgIUKTOAZNjcXVZRj4oQt0SHsl1c1vMwDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVVMxFjAUBgNVBAgMDVNhbiBGcmFuY2lzY28xEzARBgNVBAcMCkNhbGlmb3JuaWExFTATBgNVBAoMDEV4YW1wbGUgSW5jLjAgFw0yMjExMjIxNjU5NDdaGA8yMTIyMTAyOTE2NTk0N1owUTELMAkGA1UEBhMCVVMxFjAUBgNVBAgMDVNhbiBGcmFuY2lzY28xEzARBgNVBAcMCkNhbGlmb3JuaWExFTATBgNVBAoMDEV4YW1wbGUgSW5jLjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMRcORwgJFTdcG/2GKI+cFYiOBNDKjCZUXEOvXWY42BkH9wxiMT869CO+enA1w5pIrXow6kCM1sQspHHaVmJUlotEMJxyoLFfA/8Kt1EKFyobOjuZs2SwyVyJ2sStvQuUQEosULZCNGZEqoH5g6zhMPxaxm7ZLrrsDZ9maNGVqo7EWLWHrZ57Q/5MtTrbxQL+eXjUmJ9K3kS+3uEwMdqR6Z3BluU1ivanpPc1CN2GNhdO0/hSY4YkGEnuLsqJyDd3cIiB1MxuCBJ4ZaqOd2viV1WcP3oU3dxVPm4MWyfYIldMWB14FahScxLhWdRnM9YZ/i9IFcLypXsuz7DjrJPtPUCAwEAAaNmMGQwHQYDVR0OBBYEFP5JzLUawNF+c3AXsYTEWHh7z2czMB8GA1UdIwQYMBaAFP5JzLUawNF+c3AXsYTEWHh7z2czMA4GA1UdDwEB/wQEAwIBBjASBgNVHRMBAf8ECDAGAQH/AgEBMA0GCSqGSIb3DQEBCwUAA4IBAQBc+Be7NDhpE09y7hLPZGRPl1cSKBw4RI0XIv6rlbSTFs5EebpTGjhx/whNxwEZhB9HZ7111Oa1YlT8xkI9DshB78mjAHCKBAJ76moK8tkG0aqdYpJ4ZcJTVBB7l98Rvgc7zfTii7WemTy72deBbSeiEtXavm4EF0mWjHhQ5Nxpnp00Bqn5g1x8CyTDypgmugnep+xG+iFzNmTdsz7WI9T/7kDMXqB7M/FPWBORyS98OJqNDswCLF8bIZYwUBEe+bRHFomoShMzaC3tvim7WCb16noDkSTMlfKO4pnvKhpcVdSgwcruATV7y+W+Lvmz2OT/Gui4JhqeoTewsxndhDDE\\n-----END CERTIFICATE-----\\n", "created_at": "2014-01-01T05:20:00.12345Z", "expires_on": "2014-01-01T05:20:00.12345Z", "fingerprint": "E9:19:49:AA:DD:D8:1E:C1:20:2A:D8:22:BF:A5:F8:FC:1A:F7:10:9F:C7:5B:69:AB:0:31:91:8B:61:B4:BF:1C", "in_use": true, "issuer_org": "Example Inc.", "issuer_raw": "O=Example Inc.,L=California,ST=San Francisco,C=US", "type": "gateway_managed", "updated_at": "2014-01-01T05:20:00.12345Z", "uploaded_on": "2014-01-01T05:20:00.12345Z" } } ``` ## Delete Zero Trust certificate `zero_trust.gateway.certificates.delete(strcertificate_id, CertificateDeleteParams**kwargs) -> CertificateDeleteResponse` **delete** `/accounts/{account_id}/gateway/certificates/{certificate_id}` Delete a gateway-managed Zero Trust certificate. You must deactivate the certificate from the edge (inactive) before deleting it. ### Parameters - `account_id: str` - `certificate_id: str` Identify the certificate with a UUID. ### Returns - `class CertificateDeleteResponse: …` - `id: Optional[str]` Identify the certificate with a UUID. - `binding_status: Optional[Literal["pending_deployment", "available", "pending_deletion", "inactive"]]` Indicate the read-only deployment status of the certificate on Cloudflare's edge. Gateway TLS interception can use certificates in the 'available' (previously called 'active') state. - `"pending_deployment"` - `"available"` - `"pending_deletion"` - `"inactive"` - `certificate: Optional[str]` Provide the CA certificate (read-only). - `created_at: Optional[datetime]` - `expires_on: Optional[datetime]` - `fingerprint: Optional[str]` Provide the SHA256 fingerprint of the certificate (read-only). - `in_use: Optional[bool]` Indicate whether Gateway TLS interception uses this certificate (read-only). You cannot set this value directly. To configure interception, use the Gateway configuration setting named `certificate` (read-only). - `issuer_org: Optional[str]` Indicate the organization that issued the certificate (read-only). - `issuer_raw: Optional[str]` Provide the entire issuer field of the certificate (read-only). - `type: Optional[Literal["custom", "gateway_managed"]]` Indicate the read-only certificate type, BYO-PKI (custom) or Gateway-managed. - `"custom"` - `"gateway_managed"` - `updated_at: Optional[datetime]` - `uploaded_on: Optional[datetime]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) certificate = client.zero_trust.gateway.certificates.delete( certificate_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) print(certificate.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "binding_status": "pending_deployment", "certificate": "-----BEGIN CERTIFICATE-----\\nMIIDmDCCAoCgAwIBAgIUKTOAZNjcXVZRj4oQt0SHsl1c1vMwDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVVMxFjAUBgNVBAgMDVNhbiBGcmFuY2lzY28xEzARBgNVBAcMCkNhbGlmb3JuaWExFTATBgNVBAoMDEV4YW1wbGUgSW5jLjAgFw0yMjExMjIxNjU5NDdaGA8yMTIyMTAyOTE2NTk0N1owUTELMAkGA1UEBhMCVVMxFjAUBgNVBAgMDVNhbiBGcmFuY2lzY28xEzARBgNVBAcMCkNhbGlmb3JuaWExFTATBgNVBAoMDEV4YW1wbGUgSW5jLjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMRcORwgJFTdcG/2GKI+cFYiOBNDKjCZUXEOvXWY42BkH9wxiMT869CO+enA1w5pIrXow6kCM1sQspHHaVmJUlotEMJxyoLFfA/8Kt1EKFyobOjuZs2SwyVyJ2sStvQuUQEosULZCNGZEqoH5g6zhMPxaxm7ZLrrsDZ9maNGVqo7EWLWHrZ57Q/5MtTrbxQL+eXjUmJ9K3kS+3uEwMdqR6Z3BluU1ivanpPc1CN2GNhdO0/hSY4YkGEnuLsqJyDd3cIiB1MxuCBJ4ZaqOd2viV1WcP3oU3dxVPm4MWyfYIldMWB14FahScxLhWdRnM9YZ/i9IFcLypXsuz7DjrJPtPUCAwEAAaNmMGQwHQYDVR0OBBYEFP5JzLUawNF+c3AXsYTEWHh7z2czMB8GA1UdIwQYMBaAFP5JzLUawNF+c3AXsYTEWHh7z2czMA4GA1UdDwEB/wQEAwIBBjASBgNVHRMBAf8ECDAGAQH/AgEBMA0GCSqGSIb3DQEBCwUAA4IBAQBc+Be7NDhpE09y7hLPZGRPl1cSKBw4RI0XIv6rlbSTFs5EebpTGjhx/whNxwEZhB9HZ7111Oa1YlT8xkI9DshB78mjAHCKBAJ76moK8tkG0aqdYpJ4ZcJTVBB7l98Rvgc7zfTii7WemTy72deBbSeiEtXavm4EF0mWjHhQ5Nxpnp00Bqn5g1x8CyTDypgmugnep+xG+iFzNmTdsz7WI9T/7kDMXqB7M/FPWBORyS98OJqNDswCLF8bIZYwUBEe+bRHFomoShMzaC3tvim7WCb16noDkSTMlfKO4pnvKhpcVdSgwcruATV7y+W+Lvmz2OT/Gui4JhqeoTewsxndhDDE\\n-----END CERTIFICATE-----\\n", "created_at": "2014-01-01T05:20:00.12345Z", "expires_on": "2014-01-01T05:20:00.12345Z", "fingerprint": "E9:19:49:AA:DD:D8:1E:C1:20:2A:D8:22:BF:A5:F8:FC:1A:F7:10:9F:C7:5B:69:AB:0:31:91:8B:61:B4:BF:1C", "in_use": true, "issuer_org": "Example Inc.", "issuer_raw": "O=Example Inc.,L=California,ST=San Francisco,C=US", "type": "gateway_managed", "updated_at": "2014-01-01T05:20:00.12345Z", "uploaded_on": "2014-01-01T05:20:00.12345Z" } } ``` ## Activate a Zero Trust certificate `zero_trust.gateway.certificates.activate(strcertificate_id, CertificateActivateParams**kwargs) -> CertificateActivateResponse` **post** `/accounts/{account_id}/gateway/certificates/{certificate_id}/activate` Bind a single Zero Trust certificate to the edge. ### Parameters - `account_id: str` - `certificate_id: str` Identify the certificate with a UUID. - `body: object` ### Returns - `class CertificateActivateResponse: …` - `id: Optional[str]` Identify the certificate with a UUID. - `binding_status: Optional[Literal["pending_deployment", "available", "pending_deletion", "inactive"]]` Indicate the read-only deployment status of the certificate on Cloudflare's edge. Gateway TLS interception can use certificates in the 'available' (previously called 'active') state. - `"pending_deployment"` - `"available"` - `"pending_deletion"` - `"inactive"` - `certificate: Optional[str]` Provide the CA certificate (read-only). - `created_at: Optional[datetime]` - `expires_on: Optional[datetime]` - `fingerprint: Optional[str]` Provide the SHA256 fingerprint of the certificate (read-only). - `in_use: Optional[bool]` Indicate whether Gateway TLS interception uses this certificate (read-only). You cannot set this value directly. To configure interception, use the Gateway configuration setting named `certificate` (read-only). - `issuer_org: Optional[str]` Indicate the organization that issued the certificate (read-only). - `issuer_raw: Optional[str]` Provide the entire issuer field of the certificate (read-only). - `type: Optional[Literal["custom", "gateway_managed"]]` Indicate the read-only certificate type, BYO-PKI (custom) or Gateway-managed. - `"custom"` - `"gateway_managed"` - `updated_at: Optional[datetime]` - `uploaded_on: Optional[datetime]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.zero_trust.gateway.certificates.activate( certificate_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", body={}, ) print(response.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "binding_status": "pending_deployment", "certificate": "-----BEGIN CERTIFICATE-----\\nMIIDmDCCAoCgAwIBAgIUKTOAZNjcXVZRj4oQt0SHsl1c1vMwDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVVMxFjAUBgNVBAgMDVNhbiBGcmFuY2lzY28xEzARBgNVBAcMCkNhbGlmb3JuaWExFTATBgNVBAoMDEV4YW1wbGUgSW5jLjAgFw0yMjExMjIxNjU5NDdaGA8yMTIyMTAyOTE2NTk0N1owUTELMAkGA1UEBhMCVVMxFjAUBgNVBAgMDVNhbiBGcmFuY2lzY28xEzARBgNVBAcMCkNhbGlmb3JuaWExFTATBgNVBAoMDEV4YW1wbGUgSW5jLjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMRcORwgJFTdcG/2GKI+cFYiOBNDKjCZUXEOvXWY42BkH9wxiMT869CO+enA1w5pIrXow6kCM1sQspHHaVmJUlotEMJxyoLFfA/8Kt1EKFyobOjuZs2SwyVyJ2sStvQuUQEosULZCNGZEqoH5g6zhMPxaxm7ZLrrsDZ9maNGVqo7EWLWHrZ57Q/5MtTrbxQL+eXjUmJ9K3kS+3uEwMdqR6Z3BluU1ivanpPc1CN2GNhdO0/hSY4YkGEnuLsqJyDd3cIiB1MxuCBJ4ZaqOd2viV1WcP3oU3dxVPm4MWyfYIldMWB14FahScxLhWdRnM9YZ/i9IFcLypXsuz7DjrJPtPUCAwEAAaNmMGQwHQYDVR0OBBYEFP5JzLUawNF+c3AXsYTEWHh7z2czMB8GA1UdIwQYMBaAFP5JzLUawNF+c3AXsYTEWHh7z2czMA4GA1UdDwEB/wQEAwIBBjASBgNVHRMBAf8ECDAGAQH/AgEBMA0GCSqGSIb3DQEBCwUAA4IBAQBc+Be7NDhpE09y7hLPZGRPl1cSKBw4RI0XIv6rlbSTFs5EebpTGjhx/whNxwEZhB9HZ7111Oa1YlT8xkI9DshB78mjAHCKBAJ76moK8tkG0aqdYpJ4ZcJTVBB7l98Rvgc7zfTii7WemTy72deBbSeiEtXavm4EF0mWjHhQ5Nxpnp00Bqn5g1x8CyTDypgmugnep+xG+iFzNmTdsz7WI9T/7kDMXqB7M/FPWBORyS98OJqNDswCLF8bIZYwUBEe+bRHFomoShMzaC3tvim7WCb16noDkSTMlfKO4pnvKhpcVdSgwcruATV7y+W+Lvmz2OT/Gui4JhqeoTewsxndhDDE\\n-----END CERTIFICATE-----\\n", "created_at": "2014-01-01T05:20:00.12345Z", "expires_on": "2014-01-01T05:20:00.12345Z", "fingerprint": "E9:19:49:AA:DD:D8:1E:C1:20:2A:D8:22:BF:A5:F8:FC:1A:F7:10:9F:C7:5B:69:AB:0:31:91:8B:61:B4:BF:1C", "in_use": true, "issuer_org": "Example Inc.", "issuer_raw": "O=Example Inc.,L=California,ST=San Francisco,C=US", "type": "gateway_managed", "updated_at": "2014-01-01T05:20:00.12345Z", "uploaded_on": "2014-01-01T05:20:00.12345Z" } } ``` ## Deactivate a Zero Trust certificate `zero_trust.gateway.certificates.deactivate(strcertificate_id, CertificateDeactivateParams**kwargs) -> CertificateDeactivateResponse` **post** `/accounts/{account_id}/gateway/certificates/{certificate_id}/deactivate` Unbind a single Zero Trust certificate from the edge. ### Parameters - `account_id: str` - `certificate_id: str` Identify the certificate with a UUID. - `body: object` ### Returns - `class CertificateDeactivateResponse: …` - `id: Optional[str]` Identify the certificate with a UUID. - `binding_status: Optional[Literal["pending_deployment", "available", "pending_deletion", "inactive"]]` Indicate the read-only deployment status of the certificate on Cloudflare's edge. Gateway TLS interception can use certificates in the 'available' (previously called 'active') state. - `"pending_deployment"` - `"available"` - `"pending_deletion"` - `"inactive"` - `certificate: Optional[str]` Provide the CA certificate (read-only). - `created_at: Optional[datetime]` - `expires_on: Optional[datetime]` - `fingerprint: Optional[str]` Provide the SHA256 fingerprint of the certificate (read-only). - `in_use: Optional[bool]` Indicate whether Gateway TLS interception uses this certificate (read-only). You cannot set this value directly. To configure interception, use the Gateway configuration setting named `certificate` (read-only). - `issuer_org: Optional[str]` Indicate the organization that issued the certificate (read-only). - `issuer_raw: Optional[str]` Provide the entire issuer field of the certificate (read-only). - `type: Optional[Literal["custom", "gateway_managed"]]` Indicate the read-only certificate type, BYO-PKI (custom) or Gateway-managed. - `"custom"` - `"gateway_managed"` - `updated_at: Optional[datetime]` - `uploaded_on: Optional[datetime]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.zero_trust.gateway.certificates.deactivate( certificate_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", body={}, ) print(response.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "binding_status": "pending_deployment", "certificate": "-----BEGIN CERTIFICATE-----\\nMIIDmDCCAoCgAwIBAgIUKTOAZNjcXVZRj4oQt0SHsl1c1vMwDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVVMxFjAUBgNVBAgMDVNhbiBGcmFuY2lzY28xEzARBgNVBAcMCkNhbGlmb3JuaWExFTATBgNVBAoMDEV4YW1wbGUgSW5jLjAgFw0yMjExMjIxNjU5NDdaGA8yMTIyMTAyOTE2NTk0N1owUTELMAkGA1UEBhMCVVMxFjAUBgNVBAgMDVNhbiBGcmFuY2lzY28xEzARBgNVBAcMCkNhbGlmb3JuaWExFTATBgNVBAoMDEV4YW1wbGUgSW5jLjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMRcORwgJFTdcG/2GKI+cFYiOBNDKjCZUXEOvXWY42BkH9wxiMT869CO+enA1w5pIrXow6kCM1sQspHHaVmJUlotEMJxyoLFfA/8Kt1EKFyobOjuZs2SwyVyJ2sStvQuUQEosULZCNGZEqoH5g6zhMPxaxm7ZLrrsDZ9maNGVqo7EWLWHrZ57Q/5MtTrbxQL+eXjUmJ9K3kS+3uEwMdqR6Z3BluU1ivanpPc1CN2GNhdO0/hSY4YkGEnuLsqJyDd3cIiB1MxuCBJ4ZaqOd2viV1WcP3oU3dxVPm4MWyfYIldMWB14FahScxLhWdRnM9YZ/i9IFcLypXsuz7DjrJPtPUCAwEAAaNmMGQwHQYDVR0OBBYEFP5JzLUawNF+c3AXsYTEWHh7z2czMB8GA1UdIwQYMBaAFP5JzLUawNF+c3AXsYTEWHh7z2czMA4GA1UdDwEB/wQEAwIBBjASBgNVHRMBAf8ECDAGAQH/AgEBMA0GCSqGSIb3DQEBCwUAA4IBAQBc+Be7NDhpE09y7hLPZGRPl1cSKBw4RI0XIv6rlbSTFs5EebpTGjhx/whNxwEZhB9HZ7111Oa1YlT8xkI9DshB78mjAHCKBAJ76moK8tkG0aqdYpJ4ZcJTVBB7l98Rvgc7zfTii7WemTy72deBbSeiEtXavm4EF0mWjHhQ5Nxpnp00Bqn5g1x8CyTDypgmugnep+xG+iFzNmTdsz7WI9T/7kDMXqB7M/FPWBORyS98OJqNDswCLF8bIZYwUBEe+bRHFomoShMzaC3tvim7WCb16noDkSTMlfKO4pnvKhpcVdSgwcruATV7y+W+Lvmz2OT/Gui4JhqeoTewsxndhDDE\\n-----END CERTIFICATE-----\\n", "created_at": "2014-01-01T05:20:00.12345Z", "expires_on": "2014-01-01T05:20:00.12345Z", "fingerprint": "E9:19:49:AA:DD:D8:1E:C1:20:2A:D8:22:BF:A5:F8:FC:1A:F7:10:9F:C7:5B:69:AB:0:31:91:8B:61:B4:BF:1C", "in_use": true, "issuer_org": "Example Inc.", "issuer_raw": "O=Example Inc.,L=California,ST=San Francisco,C=US", "type": "gateway_managed", "updated_at": "2014-01-01T05:20:00.12345Z", "uploaded_on": "2014-01-01T05:20:00.12345Z" } } ``` ## Domain Types ### Certificate List Response - `class CertificateListResponse: …` - `id: Optional[str]` Identify the certificate with a UUID. - `binding_status: Optional[Literal["pending_deployment", "available", "pending_deletion", "inactive"]]` Indicate the read-only deployment status of the certificate on Cloudflare's edge. Gateway TLS interception can use certificates in the 'available' (previously called 'active') state. - `"pending_deployment"` - `"available"` - `"pending_deletion"` - `"inactive"` - `certificate: Optional[str]` Provide the CA certificate (read-only). - `created_at: Optional[datetime]` - `expires_on: Optional[datetime]` - `fingerprint: Optional[str]` Provide the SHA256 fingerprint of the certificate (read-only). - `in_use: Optional[bool]` Indicate whether Gateway TLS interception uses this certificate (read-only). You cannot set this value directly. To configure interception, use the Gateway configuration setting named `certificate` (read-only). - `issuer_org: Optional[str]` Indicate the organization that issued the certificate (read-only). - `issuer_raw: Optional[str]` Provide the entire issuer field of the certificate (read-only). - `type: Optional[Literal["custom", "gateway_managed"]]` Indicate the read-only certificate type, BYO-PKI (custom) or Gateway-managed. - `"custom"` - `"gateway_managed"` - `updated_at: Optional[datetime]` - `uploaded_on: Optional[datetime]` ### Certificate Get Response - `class CertificateGetResponse: …` - `id: Optional[str]` Identify the certificate with a UUID. - `binding_status: Optional[Literal["pending_deployment", "available", "pending_deletion", "inactive"]]` Indicate the read-only deployment status of the certificate on Cloudflare's edge. Gateway TLS interception can use certificates in the 'available' (previously called 'active') state. - `"pending_deployment"` - `"available"` - `"pending_deletion"` - `"inactive"` - `certificate: Optional[str]` Provide the CA certificate (read-only). - `created_at: Optional[datetime]` - `expires_on: Optional[datetime]` - `fingerprint: Optional[str]` Provide the SHA256 fingerprint of the certificate (read-only). - `in_use: Optional[bool]` Indicate whether Gateway TLS interception uses this certificate (read-only). You cannot set this value directly. To configure interception, use the Gateway configuration setting named `certificate` (read-only). - `issuer_org: Optional[str]` Indicate the organization that issued the certificate (read-only). - `issuer_raw: Optional[str]` Provide the entire issuer field of the certificate (read-only). - `type: Optional[Literal["custom", "gateway_managed"]]` Indicate the read-only certificate type, BYO-PKI (custom) or Gateway-managed. - `"custom"` - `"gateway_managed"` - `updated_at: Optional[datetime]` - `uploaded_on: Optional[datetime]` ### Certificate Create Response - `class CertificateCreateResponse: …` - `id: Optional[str]` Identify the certificate with a UUID. - `binding_status: Optional[Literal["pending_deployment", "available", "pending_deletion", "inactive"]]` Indicate the read-only deployment status of the certificate on Cloudflare's edge. Gateway TLS interception can use certificates in the 'available' (previously called 'active') state. - `"pending_deployment"` - `"available"` - `"pending_deletion"` - `"inactive"` - `certificate: Optional[str]` Provide the CA certificate (read-only). - `created_at: Optional[datetime]` - `expires_on: Optional[datetime]` - `fingerprint: Optional[str]` Provide the SHA256 fingerprint of the certificate (read-only). - `in_use: Optional[bool]` Indicate whether Gateway TLS interception uses this certificate (read-only). You cannot set this value directly. To configure interception, use the Gateway configuration setting named `certificate` (read-only). - `issuer_org: Optional[str]` Indicate the organization that issued the certificate (read-only). - `issuer_raw: Optional[str]` Provide the entire issuer field of the certificate (read-only). - `type: Optional[Literal["custom", "gateway_managed"]]` Indicate the read-only certificate type, BYO-PKI (custom) or Gateway-managed. - `"custom"` - `"gateway_managed"` - `updated_at: Optional[datetime]` - `uploaded_on: Optional[datetime]` ### Certificate Delete Response - `class CertificateDeleteResponse: …` - `id: Optional[str]` Identify the certificate with a UUID. - `binding_status: Optional[Literal["pending_deployment", "available", "pending_deletion", "inactive"]]` Indicate the read-only deployment status of the certificate on Cloudflare's edge. Gateway TLS interception can use certificates in the 'available' (previously called 'active') state. - `"pending_deployment"` - `"available"` - `"pending_deletion"` - `"inactive"` - `certificate: Optional[str]` Provide the CA certificate (read-only). - `created_at: Optional[datetime]` - `expires_on: Optional[datetime]` - `fingerprint: Optional[str]` Provide the SHA256 fingerprint of the certificate (read-only). - `in_use: Optional[bool]` Indicate whether Gateway TLS interception uses this certificate (read-only). You cannot set this value directly. To configure interception, use the Gateway configuration setting named `certificate` (read-only). - `issuer_org: Optional[str]` Indicate the organization that issued the certificate (read-only). - `issuer_raw: Optional[str]` Provide the entire issuer field of the certificate (read-only). - `type: Optional[Literal["custom", "gateway_managed"]]` Indicate the read-only certificate type, BYO-PKI (custom) or Gateway-managed. - `"custom"` - `"gateway_managed"` - `updated_at: Optional[datetime]` - `uploaded_on: Optional[datetime]` ### Certificate Activate Response - `class CertificateActivateResponse: …` - `id: Optional[str]` Identify the certificate with a UUID. - `binding_status: Optional[Literal["pending_deployment", "available", "pending_deletion", "inactive"]]` Indicate the read-only deployment status of the certificate on Cloudflare's edge. Gateway TLS interception can use certificates in the 'available' (previously called 'active') state. - `"pending_deployment"` - `"available"` - `"pending_deletion"` - `"inactive"` - `certificate: Optional[str]` Provide the CA certificate (read-only). - `created_at: Optional[datetime]` - `expires_on: Optional[datetime]` - `fingerprint: Optional[str]` Provide the SHA256 fingerprint of the certificate (read-only). - `in_use: Optional[bool]` Indicate whether Gateway TLS interception uses this certificate (read-only). You cannot set this value directly. To configure interception, use the Gateway configuration setting named `certificate` (read-only). - `issuer_org: Optional[str]` Indicate the organization that issued the certificate (read-only). - `issuer_raw: Optional[str]` Provide the entire issuer field of the certificate (read-only). - `type: Optional[Literal["custom", "gateway_managed"]]` Indicate the read-only certificate type, BYO-PKI (custom) or Gateway-managed. - `"custom"` - `"gateway_managed"` - `updated_at: Optional[datetime]` - `uploaded_on: Optional[datetime]` ### Certificate Deactivate Response - `class CertificateDeactivateResponse: …` - `id: Optional[str]` Identify the certificate with a UUID. - `binding_status: Optional[Literal["pending_deployment", "available", "pending_deletion", "inactive"]]` Indicate the read-only deployment status of the certificate on Cloudflare's edge. Gateway TLS interception can use certificates in the 'available' (previously called 'active') state. - `"pending_deployment"` - `"available"` - `"pending_deletion"` - `"inactive"` - `certificate: Optional[str]` Provide the CA certificate (read-only). - `created_at: Optional[datetime]` - `expires_on: Optional[datetime]` - `fingerprint: Optional[str]` Provide the SHA256 fingerprint of the certificate (read-only). - `in_use: Optional[bool]` Indicate whether Gateway TLS interception uses this certificate (read-only). You cannot set this value directly. To configure interception, use the Gateway configuration setting named `certificate` (read-only). - `issuer_org: Optional[str]` Indicate the organization that issued the certificate (read-only). - `issuer_raw: Optional[str]` Provide the entire issuer field of the certificate (read-only). - `type: Optional[Literal["custom", "gateway_managed"]]` Indicate the read-only certificate type, BYO-PKI (custom) or Gateway-managed. - `"custom"` - `"gateway_managed"` - `updated_at: Optional[datetime]` - `uploaded_on: Optional[datetime]` # Pacfiles ## List PAC files `zero_trust.gateway.pacfiles.list(PacfileListParams**kwargs) -> SyncSinglePage[PacfileListResponse]` **get** `/accounts/{account_id}/gateway/pacfiles` List all Zero Trust Gateway PAC files for an account. ### Parameters - `account_id: str` ### Returns - `class PacfileListResponse: …` - `id: Optional[str]` - `created_at: Optional[datetime]` - `description: Optional[str]` Detailed description of the PAC file. - `name: Optional[str]` Name of the PAC file. - `slug: Optional[str]` URL-friendly version of the PAC file name. - `updated_at: Optional[datetime]` - `url: Optional[str]` Unique URL to download the PAC file. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.zero_trust.gateway.pacfiles.list( account_id="699d98642c564d2e855e9661899b7252", ) page = page.result[0] print(page.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "id": "ed35569b41ce4d1facfe683550f54086", "created_at": "2014-01-01T05:20:00.12345Z", "description": "PAC file for Devops team", "name": "Devops team", "slug": "pac_devops", "updated_at": "2014-01-01T05:20:00.12345Z", "url": "https://pac.cloudflare-gateway.com/699d98642c564d2e855e9661899b7252/pac_devops" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Get a PAC file `zero_trust.gateway.pacfiles.get(strpacfile_id, PacfileGetParams**kwargs) -> PacfileGetResponse` **get** `/accounts/{account_id}/gateway/pacfiles/{pacfile_id}` Get a single Zero Trust Gateway PAC file. ### Parameters - `account_id: str` - `pacfile_id: str` ### Returns - `class PacfileGetResponse: …` - `id: Optional[str]` - `contents: Optional[str]` Actual contents of the PAC file - `created_at: Optional[datetime]` - `description: Optional[str]` Detailed description of the PAC file. - `name: Optional[str]` Name of the PAC file. - `slug: Optional[str]` URL-friendly version of the PAC file name. - `updated_at: Optional[datetime]` - `url: Optional[str]` Unique URL to download the PAC file. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) pacfile = client.zero_trust.gateway.pacfiles.get( pacfile_id="ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", ) print(pacfile.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "ed35569b41ce4d1facfe683550f54086", "contents": "function FindProxyForURL(url, host) { return \"DIRECT\"; }", "created_at": "2014-01-01T05:20:00.12345Z", "description": "PAC file for Devops team", "name": "Devops team", "slug": "pac_devops", "updated_at": "2014-01-01T05:20:00.12345Z", "url": "https://pac.cloudflare-gateway.com/699d98642c564d2e855e9661899b7252/pac_devops" } } ``` ## Create a PAC file `zero_trust.gateway.pacfiles.create(PacfileCreateParams**kwargs) -> PacfileCreateResponse` **post** `/accounts/{account_id}/gateway/pacfiles` Create a new Zero Trust Gateway PAC file. ### Parameters - `account_id: str` - `contents: str` Actual contents of the PAC file - `name: str` Name of the PAC file. - `description: Optional[str]` Detailed description of the PAC file. - `slug: Optional[str]` URL-friendly version of the PAC file name. If not provided, it will be auto-generated ### Returns - `class PacfileCreateResponse: …` - `id: Optional[str]` - `contents: Optional[str]` Actual contents of the PAC file - `created_at: Optional[datetime]` - `description: Optional[str]` Detailed description of the PAC file. - `name: Optional[str]` Name of the PAC file. - `slug: Optional[str]` URL-friendly version of the PAC file name. - `updated_at: Optional[datetime]` - `url: Optional[str]` Unique URL to download the PAC file. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) pacfile = client.zero_trust.gateway.pacfiles.create( account_id="699d98642c564d2e855e9661899b7252", contents="function FindProxyForURL(url, host) { return \"DIRECT\"; }", name="Devops team", ) print(pacfile.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "ed35569b41ce4d1facfe683550f54086", "contents": "function FindProxyForURL(url, host) { return \"DIRECT\"; }", "created_at": "2014-01-01T05:20:00.12345Z", "description": "PAC file for Devops team", "name": "Devops team", "slug": "pac_devops", "updated_at": "2014-01-01T05:20:00.12345Z", "url": "https://pac.cloudflare-gateway.com/699d98642c564d2e855e9661899b7252/pac_devops" } } ``` ## Update a Zero Trust Gateway PAC file `zero_trust.gateway.pacfiles.update(strpacfile_id, PacfileUpdateParams**kwargs) -> PacfileUpdateResponse` **put** `/accounts/{account_id}/gateway/pacfiles/{pacfile_id}` Update a configured Zero Trust Gateway PAC file. ### Parameters - `account_id: str` - `pacfile_id: str` - `contents: str` Actual contents of the PAC file - `description: str` Detailed description of the PAC file. - `name: str` Name of the PAC file. ### Returns - `class PacfileUpdateResponse: …` - `id: Optional[str]` - `contents: Optional[str]` Actual contents of the PAC file - `created_at: Optional[datetime]` - `description: Optional[str]` Detailed description of the PAC file. - `name: Optional[str]` Name of the PAC file. - `slug: Optional[str]` URL-friendly version of the PAC file name. - `updated_at: Optional[datetime]` - `url: Optional[str]` Unique URL to download the PAC file. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) pacfile = client.zero_trust.gateway.pacfiles.update( pacfile_id="ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", contents="function FindProxyForURL(url, host) { return \"DIRECT\"; }", description="PAC file for Devops team", name="Devops team", ) print(pacfile.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "ed35569b41ce4d1facfe683550f54086", "contents": "function FindProxyForURL(url, host) { return \"DIRECT\"; }", "created_at": "2014-01-01T05:20:00.12345Z", "description": "PAC file for Devops team", "name": "Devops team", "slug": "pac_devops", "updated_at": "2014-01-01T05:20:00.12345Z", "url": "https://pac.cloudflare-gateway.com/699d98642c564d2e855e9661899b7252/pac_devops" } } ``` ## Delete a PAC file `zero_trust.gateway.pacfiles.delete(strpacfile_id, PacfileDeleteParams**kwargs) -> object` **delete** `/accounts/{account_id}/gateway/pacfiles/{pacfile_id}` Delete a configured Zero Trust Gateway PAC file. ### Parameters - `account_id: str` - `pacfile_id: str` ### Returns - `object` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) pacfile = client.zero_trust.gateway.pacfiles.delete( pacfile_id="ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", ) print(pacfile) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": {} } ``` ## Domain Types ### Pacfile List Response - `class PacfileListResponse: …` - `id: Optional[str]` - `created_at: Optional[datetime]` - `description: Optional[str]` Detailed description of the PAC file. - `name: Optional[str]` Name of the PAC file. - `slug: Optional[str]` URL-friendly version of the PAC file name. - `updated_at: Optional[datetime]` - `url: Optional[str]` Unique URL to download the PAC file. ### Pacfile Get Response - `class PacfileGetResponse: …` - `id: Optional[str]` - `contents: Optional[str]` Actual contents of the PAC file - `created_at: Optional[datetime]` - `description: Optional[str]` Detailed description of the PAC file. - `name: Optional[str]` Name of the PAC file. - `slug: Optional[str]` URL-friendly version of the PAC file name. - `updated_at: Optional[datetime]` - `url: Optional[str]` Unique URL to download the PAC file. ### Pacfile Create Response - `class PacfileCreateResponse: …` - `id: Optional[str]` - `contents: Optional[str]` Actual contents of the PAC file - `created_at: Optional[datetime]` - `description: Optional[str]` Detailed description of the PAC file. - `name: Optional[str]` Name of the PAC file. - `slug: Optional[str]` URL-friendly version of the PAC file name. - `updated_at: Optional[datetime]` - `url: Optional[str]` Unique URL to download the PAC file. ### Pacfile Update Response - `class PacfileUpdateResponse: …` - `id: Optional[str]` - `contents: Optional[str]` Actual contents of the PAC file - `created_at: Optional[datetime]` - `description: Optional[str]` Detailed description of the PAC file. - `name: Optional[str]` Name of the PAC file. - `slug: Optional[str]` URL-friendly version of the PAC file name. - `updated_at: Optional[datetime]` - `url: Optional[str]` Unique URL to download the PAC file.