class NgrokAPI::Services::TunnelGroupBackendsClient

A Tunnel Group Backend balances traffic among all online tunnels that match

a label selector.

ngrok.com/docs/api#api-tunnel-group-backends

Constants

LIST_PROPERTY

The List Property from the resulting API for list calls

PATH

The API path for the requests

Attributes

client[R]

Public Class Methods

new(client:) click to toggle source
# File lib/ngrokapi/services/tunnel_group_backends_client.rb, line 18
def initialize(client:)
  @client = client
end

Public Instance Methods

create(description: "", metadata: "", labels: {}) click to toggle source

Create a new TunnelGroup backend

@param [string] description human-readable description of this backend. Optional @param [string] metadata arbitrary user-defined machine-readable data of this backend. Optional @param [Map<string, string>] labels labels to watch for tunnels on, e.g. app->foo, dc->bar @return [NgrokAPI::Models::TunnelGroupBackend] result from the API request

ngrok.com/docs/api#api-tunnel-group-backends-create

# File lib/ngrokapi/services/tunnel_group_backends_client.rb, line 31
def create(description: "", metadata: "", labels: {})
  path = '/backends/tunnel_group'
  replacements = {
  }
  data = {}
  data[:description] = description if description
  data[:metadata] = metadata if metadata
  data[:labels] = labels if labels
  result = @client.post(path % replacements, data: data)
  NgrokAPI::Models::TunnelGroupBackend.new(client: self, attrs: result)
end
create!(description: "", metadata: "", labels: {}) click to toggle source

Create a new TunnelGroup backend Throws an exception if API error.

@param [string] description human-readable description of this backend. Optional @param [string] metadata arbitrary user-defined machine-readable data of this backend. Optional @param [Map<string, string>] labels labels to watch for tunnels on, e.g. app->foo, dc->bar @return [NgrokAPI::Models::TunnelGroupBackend] result from the API request

ngrok.com/docs/api#api-tunnel-group-backends-create

# File lib/ngrokapi/services/tunnel_group_backends_client.rb, line 53
def create!(description: "", metadata: "", labels: {})
  path = '/backends/tunnel_group'
  replacements = {
  }
  data = {}
  data[:description] = description if description
  data[:metadata] = metadata if metadata
  data[:labels] = labels if labels
  result = @client.post(path % replacements, data: data, danger: true)
  NgrokAPI::Models::TunnelGroupBackend.new(client: self, attrs: result)
end
delete(id: "") click to toggle source

Delete a TunnelGroup backend by ID.

@param [string] id a resource identifier @return [NgrokAPI::Models::Empty] result from the API request

ngrok.com/docs/api#api-tunnel-group-backends-delete

# File lib/ngrokapi/services/tunnel_group_backends_client.rb, line 72
def delete(id: "")
  path = '/backends/tunnel_group/%{id}'
  replacements = {
    id: id,
  }
  @client.delete(path % replacements)
end
delete!(id: "") click to toggle source

Delete a TunnelGroup backend by ID. Throws an exception if API error.

@param [string] id a resource identifier @return [NgrokAPI::Models::Empty] result from the API request

ngrok.com/docs/api#api-tunnel-group-backends-delete

# File lib/ngrokapi/services/tunnel_group_backends_client.rb, line 88
def delete!(id: "")
  path = '/backends/tunnel_group/%{id}'
  replacements = {
    id: id,
  }
  @client.delete(path % replacements, danger: true)
end
get(id: "") click to toggle source

Get detailed information about a TunnelGroup backend by ID

@param [string] id a resource identifier @return [NgrokAPI::Models::TunnelGroupBackend] result from the API request

ngrok.com/docs/api#api-tunnel-group-backends-get

# File lib/ngrokapi/services/tunnel_group_backends_client.rb, line 103
def get(id: "")
  path = '/backends/tunnel_group/%{id}'
  replacements = {
    id: id,
  }
  data = {}
  result = @client.get(path % replacements, data: data)
  NgrokAPI::Models::TunnelGroupBackend.new(client: self, attrs: result)
end
get!(id: "") click to toggle source

Get detailed information about a TunnelGroup backend by ID Throws an exception if API error.

@param [string] id a resource identifier @return [NgrokAPI::Models::TunnelGroupBackend] result from the API request

ngrok.com/docs/api#api-tunnel-group-backends-get

# File lib/ngrokapi/services/tunnel_group_backends_client.rb, line 121
def get!(id: "")
  path = '/backends/tunnel_group/%{id}'
  replacements = {
    id: id,
  }
  data = {}
  result = @client.get(path % replacements, data: data, danger: true)
  NgrokAPI::Models::TunnelGroupBackend.new(client: self, attrs: result)
end
list(before_id: nil, limit: nil, url: nil) click to toggle source

List all TunnelGroup backends on this account

@param [string] before_id @param [string] limit @param [string] url optional and mutually exclusive from before_id and limit @return [NgrokAPI::Models::Listable] result from the API request

ngrok.com/docs/api#api-tunnel-group-backends-list

# File lib/ngrokapi/services/tunnel_group_backends_client.rb, line 140
def list(before_id: nil, limit: nil, url: nil)
  result = @client.list(
    before_id: before_id,
    limit: limit,
    url: url,
    path: PATH
  )

  NgrokAPI::Models::Listable.new(
    client: self,
    attrs: result,
    list_property: LIST_PROPERTY,
    klass: NgrokAPI::Models::TunnelGroupBackend
  )
end
list!(before_id: nil, limit: nil, url: nil) click to toggle source

List all TunnelGroup backends on this account Throws an exception if API error.

@param [string] before_id @param [string] limit @param [string] url optional and mutually exclusive from before_id and limit @return [NgrokAPI::Models::Listable] result from the API request

ngrok.com/docs/api#api-tunnel-group-backends-list

# File lib/ngrokapi/services/tunnel_group_backends_client.rb, line 166
def list!(before_id: nil, limit: nil, url: nil)
  result = @client.list(
    before_id: before_id,
    limit: limit,
    danger: true,
    url: url,
    path: PATH
  )

  NgrokAPI::Models::Listable.new(
    client: self,
    attrs: result,
    list_property: LIST_PROPERTY,
    klass: NgrokAPI::Models::TunnelGroupBackend,
    danger: true
  )
end
update(id: "", description: nil, metadata: nil, labels: {}) click to toggle source

Update TunnelGroup backend by ID

@param [string] id @param [string] description human-readable description of this backend. Optional @param [string] metadata arbitrary user-defined machine-readable data of this backend. Optional @param [Map<string, string>] labels labels to watch for tunnels on, e.g. app->foo, dc->bar @return [NgrokAPI::Models::TunnelGroupBackend] result from the API request

ngrok.com/docs/api#api-tunnel-group-backends-update

# File lib/ngrokapi/services/tunnel_group_backends_client.rb, line 194
def update(id: "", description: nil, metadata: nil, labels: {})
  path = '/backends/tunnel_group/%{id}'
  replacements = {
    id: id,
  }
  data = {}
  data[:description] = description if description
  data[:metadata] = metadata if metadata
  data[:labels] = labels if labels
  result = @client.patch(path % replacements, data: data)
  NgrokAPI::Models::TunnelGroupBackend.new(client: self, attrs: result)
end
update!(id: "", description: nil, metadata: nil, labels: {}) click to toggle source

Update TunnelGroup backend by ID Throws an exception if API error.

@param [string] id @param [string] description human-readable description of this backend. Optional @param [string] metadata arbitrary user-defined machine-readable data of this backend. Optional @param [Map<string, string>] labels labels to watch for tunnels on, e.g. app->foo, dc->bar @return [NgrokAPI::Models::TunnelGroupBackend] result from the API request

ngrok.com/docs/api#api-tunnel-group-backends-update

# File lib/ngrokapi/services/tunnel_group_backends_client.rb, line 218
def update!(id: "", description: nil, metadata: nil, labels: {})
  path = '/backends/tunnel_group/%{id}'
  replacements = {
    id: id,
  }
  data = {}
  data[:description] = description if description
  data[:metadata] = metadata if metadata
  data[:labels] = labels if labels
  result = @client.patch(path % replacements, data: data, danger: true)
  NgrokAPI::Models::TunnelGroupBackend.new(client: self, attrs: result)
end