IP Policies

Do not construct this object directly, instead access the ip_policies property of an ngrok.Client object.

class ngrok.services.IPPoliciesClient(client)[source]

IP Policies are reusable groups of CIDR ranges with an allow or deny action. They can be attached to endpoints via the Endpoint Configuration IP Policy module. They can also be used with IP Restrictions to control source IP ranges that can start tunnel sessions and connect to the API and dashboard.

create(action, description='', metadata='')[source]

Create a new IP policy. It will not apply to any traffic until you associate to a traffic source via an endpoint configuration or IP restriction.

Parameters
  • description (str) – human-readable description of the source IPs of this IP policy. optional, max 255 bytes.

  • metadata (str) – arbitrary user-defined machine-readable data of this IP policy. optional, max 4096 bytes.

  • action (str) – the IP policy action. Supported values are allow or deny

https://ngrok.com/docs/api#api-ip-policies-create

Return type

IPPolicy

delete(id)[source]

Delete an IP policy. If the IP policy is referenced by another object for the purposes of traffic restriction it will be treated as if the IP policy remains but has zero rules.

Parameters

id (str) – a resource identifier

https://ngrok.com/docs/api#api-ip-policies-delete

get(id)[source]

Get detailed information about an IP policy by ID.

Parameters

id (str) – a resource identifier

https://ngrok.com/docs/api#api-ip-policies-get

Return type

IPPolicy

list(before_id=None, limit=None)[source]

List all IP policies on this account

Parameters
  • before_id (Optional[str]) –

  • limit (Optional[str]) –

https://ngrok.com/docs/api#api-ip-policies-list

Return type

IPPolicyList

update(id, description=None, metadata=None)[source]

Update attributes of an IP policy by ID

Parameters
  • id (str) –

  • description (Optional[str]) – human-readable description of the source IPs of this IP policy. optional, max 255 bytes.

  • metadata (Optional[str]) – arbitrary user-defined machine-readable data of this IP policy. optional, max 4096 bytes.

https://ngrok.com/docs/api#api-ip-policies-update

Return type

IPPolicy