Weighted Backends

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

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

A Weighted Backend balances traffic among the referenced backends. Traffic is assigned proportionally to each based on its weight. The percentage of traffic is calculated by dividing a backend’s weight by the sum of all weights.

create(description='', metadata='', backends={})[source]

Create a new Weighted backend

Parameters
  • description (str) – human-readable description of this backend. Optional

  • metadata (str) – arbitrary user-defined machine-readable data of this backend. Optional

  • backends (Mapping[str, int]) – the ids of the child backends to their weights [0-10000]

https://ngrok.com/docs/api#api-weighted-backends-create

Return type

WeightedBackend

delete(id)[source]

Delete a Weighted backend by ID.

Parameters

id (str) – a resource identifier

https://ngrok.com/docs/api#api-weighted-backends-delete

get(id)[source]

Get detailed information about a Weighted backend by ID

Parameters

id (str) – a resource identifier

https://ngrok.com/docs/api#api-weighted-backends-get

Return type

WeightedBackend

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

List all Weighted backends on this account

Parameters
  • before_id (Optional[str]) –

  • limit (Optional[str]) –

https://ngrok.com/docs/api#api-weighted-backends-list

Return type

WeightedBackendList

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

Update Weighted backend by ID

Parameters
  • id (str) –

  • description (Optional[str]) – human-readable description of this backend. Optional

  • metadata (Optional[str]) – arbitrary user-defined machine-readable data of this backend. Optional

  • backends (Mapping[str, int]) – the ids of the child backends to their weights [0-10000]

https://ngrok.com/docs/api#api-weighted-backends-update

Return type

WeightedBackend