IP Restrictions

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

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

An IP restriction is a restriction placed on the CIDRs that are allowed to initate traffic to a specific aspect of your ngrok account. An IP restriction has a type which defines the ingress it applies to. IP restrictions can be used to enforce the source IPs that can make API requests, log in to the dashboard, start ngrok agents, and connect to your public-facing endpoints.

create(type, ip_policy_ids, description='', metadata='', enforced=False)[source]

Create a new IP restriction

Parameters
  • description (str) – human-readable description of this IP restriction. optional, max 255 bytes.

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

  • enforced (bool) – true if the IP restriction will be enforced. if false, only warnings will be issued

  • type (str) – the type of IP restriction. this defines what traffic will be restricted with the attached policies. four values are currently supported: dashboard, api, agent, and endpoints

  • ip_policy_ids (Sequence[str]) – the set of IP policy identifiers that are used to enforce the restriction

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

Return type

IPRestriction

delete(id)[source]

Delete an IP restriction

Parameters

id (str) – a resource identifier

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

get(id)[source]

Get detailed information about an IP restriction

Parameters

id (str) – a resource identifier

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

Return type

IPRestriction

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

List all IP restrictions on this account

Parameters
  • before_id (Optional[str]) –

  • limit (Optional[str]) –

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

Return type

IPRestrictionList

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

Update attributes of an IP restriction by ID

Parameters
  • id (str) –

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

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

  • enforced (Optional[bool]) – true if the IP restriction will be enforced. if false, only warnings will be issued

  • ip_policy_ids (Sequence[str]) – the set of IP policy identifiers that are used to enforce the restriction

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

Return type

IPRestriction