class NgrokAPI::Services::ReservedDomainsClient
Reserved Domains are hostnames that you can listen for traffic on. Domains
can be used to listen for http, https or tls traffic. You may use a domain that you own by creating a CNAME record specified in the returned resource. This CNAME record points traffic for that domain to ngrok's edge servers.
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_domains_client.rb, line 20 def initialize(client:) @client = client end
Public Instance Methods
Create a new reserved domain.
@param [string] name the domain name to reserve. It may be a full domain name like app.example.com. If the name does not contain a ‘.’ it will reserve that subdomain on ngrok.io. @param [string] region reserve the domain in this geographic ngrok datacenter. Optional, default is us. (au, eu, ap, us, jp, in, sa) @param [string] description human-readable description of what this reserved domain will be used for @param [string] metadata arbitrary user-defined machine-readable data of this reserved domain. Optional, max 4096 bytes. @param [string] certificate_id ID of a user-uploaded TLS certificate to use for connections to targeting this domain. Optional, mutually exclusive with “certificate_management_policy“. @param [ReservedDomainCertPolicy] certificate_management_policy configuration for automatic management of TLS certificates for this domain, or null if automatic management is disabled. Optional, mutually exclusive with “certificate_id“. @return [NgrokAPI::Models::ReservedDomain] result from the API request
ngrok.com/docs/api#api-reserved-domains-create
# File lib/ngrokapi/services/reserved_domains_client.rb, line 36 def create(name:, region: "", description: "", metadata: "", http_endpoint_configuration_id: nil, https_endpoint_configuration_id: nil, certificate_id: nil, certificate_management_policy: nil) path = '/reserved_domains' replacements = { } data = {} data[:name] = name if name data[:region] = region if region data[:description] = description if description data[:metadata] = metadata if metadata data[:certificate_id] = certificate_id if certificate_id data[:certificate_management_policy] = certificate_management_policy if certificate_management_policy result = @client.post(path % replacements, data: data) NgrokAPI::Models::ReservedDomain.new(client: self, attrs: result) end
Create a new reserved domain. Throws an exception if API error.
@param [string] name the domain name to reserve. It may be a full domain name like app.example.com. If the name does not contain a ‘.’ it will reserve that subdomain on ngrok.io. @param [string] region reserve the domain in this geographic ngrok datacenter. Optional, default is us. (au, eu, ap, us, jp, in, sa) @param [string] description human-readable description of what this reserved domain will be used for @param [string] metadata arbitrary user-defined machine-readable data of this reserved domain. Optional, max 4096 bytes. @param [string] certificate_id ID of a user-uploaded TLS certificate to use for connections to targeting this domain. Optional, mutually exclusive with “certificate_management_policy“. @param [ReservedDomainCertPolicy] certificate_management_policy configuration for automatic management of TLS certificates for this domain, or null if automatic management is disabled. Optional, mutually exclusive with “certificate_id“. @return [NgrokAPI::Models::ReservedDomain] result from the API request
ngrok.com/docs/api#api-reserved-domains-create
# File lib/ngrokapi/services/reserved_domains_client.rb, line 64 def create!(name:, region: "", description: "", metadata: "", http_endpoint_configuration_id: nil, https_endpoint_configuration_id: nil, certificate_id: nil, certificate_management_policy: nil) path = '/reserved_domains' replacements = { } data = {} data[:name] = name if name data[:region] = region if region data[:description] = description if description data[:metadata] = metadata if metadata data[:certificate_id] = certificate_id if certificate_id data[:certificate_management_policy] = certificate_management_policy if certificate_management_policy result = @client.post(path % replacements, data: data, danger: true) NgrokAPI::Models::ReservedDomain.new(client: self, attrs: result) end
Delete a reserved domain.
@param [string] id a resource identifier @return [NgrokAPI::Models::Empty] result from the API request
ngrok.com/docs/api#api-reserved-domains-delete
# File lib/ngrokapi/services/reserved_domains_client.rb, line 86 def delete(id: "") path = '/reserved_domains/%{id}' replacements = { id: id, } @client.delete(path % replacements) end
Delete a reserved domain. 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-domains-delete
# File lib/ngrokapi/services/reserved_domains_client.rb, line 102 def delete!(id: "") path = '/reserved_domains/%{id}' replacements = { id: id, } @client.delete(path % replacements, danger: true) end
Detach the certificate attached to a reserved domain.
@param [string] id a resource identifier @return [NgrokAPI::Models::Empty] result from the API request
ngrok.com/docs/api#api-reserved-domains-delete-certificate
# File lib/ngrokapi/services/reserved_domains_client.rb, line 287 def delete_certificate(id: "") path = '/reserved_domains/%{id}/certificate' replacements = { id: id, } @client.delete(path % replacements) end
Detach the certificate attached to a reserved domain. 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-domains-delete-certificate
# File lib/ngrokapi/services/reserved_domains_client.rb, line 303 def delete_certificate!(id: "") path = '/reserved_domains/%{id}/certificate' replacements = { id: id, } @client.delete(path % replacements, danger: true) end
Detach the certificate management policy attached to a reserved domain.
@param [string] id a resource identifier @return [NgrokAPI::Models::Empty] result from the API request
ngrok.com/docs/api#api-reserved-domains-delete-certificate-management-policy
# File lib/ngrokapi/services/reserved_domains_client.rb, line 256 def delete_certificate_management_policy(id: "") path = '/reserved_domains/%{id}/certificate_management_policy' replacements = { id: id, } @client.delete(path % replacements) end
Detach the certificate management policy attached to a reserved domain. 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-domains-delete-certificate-management-policy
# File lib/ngrokapi/services/reserved_domains_client.rb, line 272 def delete_certificate_management_policy!(id: "") path = '/reserved_domains/%{id}/certificate_management_policy' replacements = { id: id, } @client.delete(path % replacements, danger: true) end
Get the details of a reserved domain.
@param [string] id a resource identifier @return [NgrokAPI::Models::ReservedDomain] result from the API request
ngrok.com/docs/api#api-reserved-domains-get
# File lib/ngrokapi/services/reserved_domains_client.rb, line 117 def get(id: "") path = '/reserved_domains/%{id}' replacements = { id: id, } data = {} result = @client.get(path % replacements, data: data) NgrokAPI::Models::ReservedDomain.new(client: self, attrs: result) end
Get the details of a reserved domain. Throws an exception if API error.
@param [string] id a resource identifier @return [NgrokAPI::Models::ReservedDomain] result from the API request
ngrok.com/docs/api#api-reserved-domains-get
# File lib/ngrokapi/services/reserved_domains_client.rb, line 135 def get!(id: "") path = '/reserved_domains/%{id}' replacements = { id: id, } data = {} result = @client.get(path % replacements, data: data, danger: true) NgrokAPI::Models::ReservedDomain.new(client: self, attrs: result) end
List all reserved domains 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-domains-list
# File lib/ngrokapi/services/reserved_domains_client.rb, line 154 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::ReservedDomain ) end
List all reserved domains 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-domains-list
# File lib/ngrokapi/services/reserved_domains_client.rb, line 180 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::ReservedDomain, danger: true ) end
Update the attributes of a reserved domain.
@param [string] id @param [string] description human-readable description of what this reserved domain will be used for @param [string] metadata arbitrary user-defined machine-readable data of this reserved domain. Optional, max 4096 bytes. @param [string] certificate_id ID of a user-uploaded TLS certificate to use for connections to targeting this domain. Optional, mutually exclusive with “certificate_management_policy“. @param [ReservedDomainCertPolicy] certificate_management_policy configuration for automatic management of TLS certificates for this domain, or null if automatic management is disabled. Optional, mutually exclusive with “certificate_id“. @return [NgrokAPI::Models::ReservedDomain] result from the API request
ngrok.com/docs/api#api-reserved-domains-update
# File lib/ngrokapi/services/reserved_domains_client.rb, line 209 def update(id: "", description: nil, metadata: nil, http_endpoint_configuration_id: nil, https_endpoint_configuration_id: nil, certificate_id: nil, certificate_management_policy: nil) path = '/reserved_domains/%{id}' replacements = { id: id, } data = {} data[:description] = description if description data[:metadata] = metadata if metadata data[:certificate_id] = certificate_id if certificate_id data[:certificate_management_policy] = certificate_management_policy if certificate_management_policy result = @client.patch(path % replacements, data: data) NgrokAPI::Models::ReservedDomain.new(client: self, attrs: result) end
Update the attributes of a reserved domain. Throws an exception if API error.
@param [string] id @param [string] description human-readable description of what this reserved domain will be used for @param [string] metadata arbitrary user-defined machine-readable data of this reserved domain. Optional, max 4096 bytes. @param [string] certificate_id ID of a user-uploaded TLS certificate to use for connections to targeting this domain. Optional, mutually exclusive with “certificate_management_policy“. @param [ReservedDomainCertPolicy] certificate_management_policy configuration for automatic management of TLS certificates for this domain, or null if automatic management is disabled. Optional, mutually exclusive with “certificate_id“. @return [NgrokAPI::Models::ReservedDomain] result from the API request
ngrok.com/docs/api#api-reserved-domains-update
# File lib/ngrokapi/services/reserved_domains_client.rb, line 235 def update!(id: "", description: nil, metadata: nil, http_endpoint_configuration_id: nil, https_endpoint_configuration_id: nil, certificate_id: nil, certificate_management_policy: nil) path = '/reserved_domains/%{id}' replacements = { id: id, } data = {} data[:description] = description if description data[:metadata] = metadata if metadata data[:certificate_id] = certificate_id if certificate_id data[:certificate_management_policy] = certificate_management_policy if certificate_management_policy result = @client.patch(path % replacements, data: data, danger: true) NgrokAPI::Models::ReservedDomain.new(client: self, attrs: result) end