waft.actions.dashboard_actions.gateway_actions module

class waft.actions.dashboard_actions.gateway_actions.GatewayActions(dashboard: DashboardActions)

Bases: Actions

Class to define interactions with Gateway Rules over Cloudflare Python SDK

activate_certificate(certificate_id: str)

Activate Gateway certificate with the given certificate ID

Parameters:

certificate_id – String of certificate ID to activate

property certificate_in_use: CertificateListResponse | None

Returns the certificate currently in use for the account

create_certificate(duration: int = 365) CertificateCreateResponse

Create a new Gateway certificate

Parameters:

duration – Duration of certificate validity in days

create_rule(action: str, name: str, description: str | None = None, device_posture: str | None = None, filters: list[Literal['http', 'dns', 'l4', 'egress', 'dns_resolver']] | None = None, enabled: bool = True, identity: str | None = None, precedence: int | None = None, schedule: ScheduleParam | None = None, rule_settings: RuleSettingParam | None = None, traffic: str | None = None) GatewayRule

Create a Gateway Rule.

Parameters:
  • action – Action that policy shall take, chosen from given list

  • name – Name of device policy

  • description – Description of rule to record

  • device_posture – The wirefilter expression used for device posture check matching.

  • filters – The protocol or layer to evaluate the traffic, identity, and device posture expressions.

  • enabled – Boolean indicating if rule is enabled

  • identity – The wirefilter expression used for identity matching.

  • precedence – Precedence sets the order of your rules. Lower values indicate higher precedence. At each processing phase, applicable rules are evaluated in ascending order of this value.

  • rule_settings – Additional settings that modify the rule’s action.

  • schedule – The schedule for activating DNS policies. This does not apply to HTTP or network policies.

  • traffic – The wirefilter expression used for traffic matching.

Returns:

New gateway rule object

Return type:

GatewayRule

deactivate_certificate(certificate_id: str)

Deactivate Gateway certificate with the given certificate ID

Parameters:

certificate_id – String of certificate ID to deactivate

delete_certificate(certificate_id: str)

Delete Gateway certificate with the given certificate ID

Parameters:

certificate_id – String of certificate ID to delete

enable_proxy(filter_tcp: bool | None = None, filter_udp: bool | None = None, root_certificate: bool | None = None) DeviceSettings

Enable gateway proxy settings.

Parameters:
  • filter_tcp (Optional[bool]) – Enable gateway proxy filtering on TCP.

  • filter_udp (Optional[bool]) – Enable gateway proxy filtering on UDP.

  • root_certificate (Optional[bool]) – Enable installation of Cloudflare managed root certificate.

Returns:

Updated settings

Return type:

DeviceSettings

enable_tls_decrpytion(enable: bool) GatewayConfigurationSettings

Enable/disable TLS decrpytion for account.

Returns:

Updated gateway configuration settings

Return type:

GatewayConfigurationSettings

get_certificate(certificate_id: str) CertificateGetResponse

Get Gateway certificate with the given certificate ID

Parameters:

certificate_id – String of certificate ID to get information for

list_all_precedences(filter_type: Literal['http', 'dns', 'l4', 'egress', 'dns_resolver']) list[int]

Return a list of all precedence values currently defined.

Parameters:

filter_type (GatewayFilter) – Filter type for which to return precedence values

Returns:

list of precedence values currently defined

Return type:

list[int]

list_certificates() list[CertificateListResponse]

List all currently defined Gateway certificates

property settings: GatewayConfigurationSettings

Return the current gateway settings for the Zero Trust organization.

update_rule(rule: GatewayRule) GatewayRule

Update a Gateway Rule.

Parameters:

rule (GatewayRule) – Existing gateway rule object to update

Returns:

Updated gateway rule object

Return type:

GatewayRule

upload_certificate(key: str, certificate: str) MTLSCertificateCreateResponse

Upload custom Gateway certificate

Parameters:
  • key – String of key used to generate certificate

  • certificate – Certificate data