class NgrokAPI::Services::ReservedAddrsClient
Reserved Addresses are TCP addresses that can be used to listen for traffic.
TCP address hostnames and ports are assigned by ngrok, they cannot be chosen.
Constants
- LIST_PROPERTY
The List Property from the resulting API for list calls
- PATH
The API path for the requests
Attributes
Public Class Methods
# File lib/ngrokapi/services/reserved_addrs_client.rb, line 19 def initialize(client:) @client = client end
Public Instance Methods
Create a new reserved address.
@param [string] description human-readable description of what this reserved address will be used for @param [string] metadata arbitrary user-defined machine-readable data of this reserved address. Optional, max 4096 bytes. @param [string] region reserve the address in this geographic ngrok datacenter. Optional, default is us. (au, eu, ap, us, jp, in, sa) @return [NgrokAPI::Models::ReservedAddr] result from the API request
ngrok.com/docs/api#api-reserved-addrs-create
# File lib/ngrokapi/services/reserved_addrs_client.rb, line 32 def create(description: "", metadata: "", region: "", endpoint_configuration_id: nil) path = '/reserved_addrs' replacements = { } data = {} data[:description] = description if description data[:metadata] = metadata if metadata data[:region] = region if region result = @client.post(path % replacements, data: data) NgrokAPI::Models::ReservedAddr.new(client: self, attrs: result) end
Create a new reserved address. Throws an exception if API error.
@param [string] description human-readable description of what this reserved address will be used for @param [string] metadata arbitrary user-defined machine-readable data of this reserved address. Optional, max 4096 bytes. @param [string] region reserve the address in this geographic ngrok datacenter. Optional, default is us. (au, eu, ap, us, jp, in, sa) @return [NgrokAPI::Models::ReservedAddr] result from the API request
ngrok.com/docs/api#api-reserved-addrs-create
# File lib/ngrokapi/services/reserved_addrs_client.rb, line 54 def create!(description: "", metadata: "", region: "", endpoint_configuration_id: nil) path = '/reserved_addrs' replacements = { } data = {} data[:description] = description if description data[:metadata] = metadata if metadata data[:region] = region if region result = @client.post(path % replacements, data: data, danger: true) NgrokAPI::Models::ReservedAddr.new(client: self, attrs: result) end
Delete a reserved address.
@param [string] id a resource identifier @return [NgrokAPI::Models::Empty] result from the API request
ngrok.com/docs/api#api-reserved-addrs-delete
# File lib/ngrokapi/services/reserved_addrs_client.rb, line 73 def delete(id: "") path = '/reserved_addrs/%{id}' replacements = { id: id, } @client.delete(path % replacements) end
Delete a reserved address. 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-reserved-addrs-delete
# File lib/ngrokapi/services/reserved_addrs_client.rb, line 89 def delete!(id: "") path = '/reserved_addrs/%{id}' replacements = { id: id, } @client.delete(path % replacements, danger: true) end
Get the details of a reserved address.
@param [string] id a resource identifier @return [NgrokAPI::Models::ReservedAddr] result from the API request
ngrok.com/docs/api#api-reserved-addrs-get
# File lib/ngrokapi/services/reserved_addrs_client.rb, line 104 def get(id: "") path = '/reserved_addrs/%{id}' replacements = { id: id, } data = {} result = @client.get(path % replacements, data: data) NgrokAPI::Models::ReservedAddr.new(client: self, attrs: result) end
Get the details of a reserved address. Throws an exception if API error.
@param [string] id a resource identifier @return [NgrokAPI::Models::ReservedAddr] result from the API request
ngrok.com/docs/api#api-reserved-addrs-get
# File lib/ngrokapi/services/reserved_addrs_client.rb, line 122 def get!(id: "") path = '/reserved_addrs/%{id}' replacements = { id: id, } data = {} result = @client.get(path % replacements, data: data, danger: true) NgrokAPI::Models::ReservedAddr.new(client: self, attrs: result) end
List all reserved addresses 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-reserved-addrs-list
# File lib/ngrokapi/services/reserved_addrs_client.rb, line 141 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::ReservedAddr ) end
List all reserved addresses 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-reserved-addrs-list
# File lib/ngrokapi/services/reserved_addrs_client.rb, line 167 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::ReservedAddr, danger: true ) end
Update the attributes of a reserved address.
@param [string] id @param [string] description human-readable description of what this reserved address will be used for @param [string] metadata arbitrary user-defined machine-readable data of this reserved address. Optional, max 4096 bytes. @return [NgrokAPI::Models::ReservedAddr] result from the API request
ngrok.com/docs/api#api-reserved-addrs-update
# File lib/ngrokapi/services/reserved_addrs_client.rb, line 194 def update(id: "", description: nil, metadata: nil, endpoint_configuration_id: nil) path = '/reserved_addrs/%{id}' replacements = { id: id, } data = {} data[:description] = description if description data[:metadata] = metadata if metadata result = @client.patch(path % replacements, data: data) NgrokAPI::Models::ReservedAddr.new(client: self, attrs: result) end
Update the attributes of a reserved address. Throws an exception if API error.
@param [string] id @param [string] description human-readable description of what this reserved address will be used for @param [string] metadata arbitrary user-defined machine-readable data of this reserved address. Optional, max 4096 bytes. @return [NgrokAPI::Models::ReservedAddr] result from the API request
ngrok.com/docs/api#api-reserved-addrs-update
# File lib/ngrokapi/services/reserved_addrs_client.rb, line 216 def update!(id: "", description: nil, metadata: nil, endpoint_configuration_id: nil) path = '/reserved_addrs/%{id}' replacements = { id: id, } data = {} data[:description] = description if description data[:metadata] = metadata if metadata result = @client.patch(path % replacements, data: data, danger: true) NgrokAPI::Models::ReservedAddr.new(client: self, attrs: result) end