Class: NgrokAPI::Client
- Inherits:
-
Object
- Object
- NgrokAPI::Client
- Defined in:
- lib/ngrokapi/client.rb
Overview
Low-level api client for communicating with Ngrok's HTTP API. Use this object to instantiate your clients.
Instance Method Summary collapse
-
#abuse_reports ⇒ NgrokAPI::Services::AbuseReportsClient
Abuse Reports allow you to submit take-down requests for URLs hosted by ngrok that violate ngrok's terms of service.
-
#api_keys ⇒ NgrokAPI::Services::APIKeysClient
API Keys are used to authenticate to the ngrok API.
-
#certificate_authorities ⇒ NgrokAPI::Services::CertificateAuthoritiesClient
Certificate Authorities are x509 certificates that are used to sign other x509 certificates.
-
#credentials ⇒ NgrokAPI::Services::CredentialsClient
Tunnel Credentials are ngrok agent authtokens.
-
#endpoint_configurations ⇒ NgrokAPI::Services::EndpointConfigurationsClient
Endpoint Configurations are a reusable group of modules that encapsulate how traffic to a domain or address is handled.
- #event_destinations ⇒ Object
- #event_sources ⇒ Object
- #event_streams ⇒ Object
- #event_subscriptions ⇒ Object
-
#initialize(api_key:, base_url: 'https://api.ngrok.com') ⇒ Client
constructor
A new instance of Client.
-
#ip_policies ⇒ NgrokAPI::Services::IPPoliciesClient
IP Policies are reusable groups of CIDR ranges with an
allow
ordeny
action. -
#ip_policy_rules ⇒ NgrokAPI::Services::IPPolicyRulesClient
IP Policy Rules are the IPv4 or IPv6 CIDRs entries that make up an IP Policy.
-
#ip_restrictions ⇒ NgrokAPI::Services::IPRestrictionsClient
An IP restriction is a restriction placed on the CIDRs that are allowed to initate traffic to a specific aspect of your ngrok account.
-
#ip_whitelist ⇒ NgrokAPI::Services::IPWhitelistClient
The IP Whitelist is deprecated and will be removed.
- #pointcfg_module ⇒ Object
-
#reserved_addrs ⇒ NgrokAPI::Services::ReservedAddrsClient
Reserved Addresses are TCP addresses that can be used to listen for traffic.
-
#reserved_domains ⇒ NgrokAPI::Services::ReservedDomainsClient
Reserved Domains are hostnames that you can listen for traffic on.
-
#ssh_certificate_authorities ⇒ NgrokAPI::Services::SSHCertificateAuthoritiesClient
An SSH Certificate Authority is a pair of an SSH Certificate and its private key that can be used to sign other SSH host and user certificates.
-
#ssh_credentials ⇒ NgrokAPI::Services::SSHCredentialsClient
SSH Credentials are SSH public keys that can be used to start SSH tunnels via the ngrok SSH tunnel gateway.
-
#ssh_host_certificates ⇒ NgrokAPI::Services::SSHHostCertificatesClient
SSH Host Certificates along with the corresponding private key allows an SSH server to assert its authenticity to connecting SSH clients who trust the SSH Certificate Authority that was used to sign the certificate.
-
#ssh_user_certificates ⇒ NgrokAPI::Services::SSHUserCertificatesClient
SSH User Certificates are presented by SSH clients when connecting to an SSH server to authenticate their connection.
-
#tls_certificates ⇒ NgrokAPI::Services::TLSCertificatesClient
TLS Certificates are pairs of x509 certificates and their matching private key that can be used to terminate TLS traffic.
-
#tunnel_sessions ⇒ NgrokAPI::Services::TunnelSessionsClient
Tunnel Sessions represent instances of ngrok agents or SSH reverse tunnel sessions that are running and connected to the ngrok service.
-
#tunnels ⇒ NgrokAPI::Services::TunnelsClient
Tunnels provide endpoints to access services exposed by a running ngrok agent tunnel session or an SSH reverse tunnel session.
Constructor Details
#initialize(api_key:, base_url: 'https://api.ngrok.com') ⇒ Client
Returns a new instance of Client.
10 11 12 13 14 15 |
# File 'lib/ngrokapi/client.rb', line 10 def initialize( api_key:, base_url: 'https://api.ngrok.com' ) @client = NgrokAPI::HttpClient.new(api_key: api_key, base_url: base_url) end |
Instance Method Details
#abuse_reports ⇒ NgrokAPI::Services::AbuseReportsClient
Abuse Reports allow you to submit take-down requests for URLs hosted by ngrok that violate ngrok's terms of service.
22 23 24 |
# File 'lib/ngrokapi/client.rb', line 22 def abuse_reports @_abuse_reports ||= NgrokAPI::Services::AbuseReportsClient.new(client: @client) end |
#api_keys ⇒ NgrokAPI::Services::APIKeysClient
API Keys are used to authenticate to the ngrok API. You may use the API itself to provision and manage API Keys but you'll need to provision your first API key from the API Keys page on your ngrok.com dashboard.
34 35 36 |
# File 'lib/ngrokapi/client.rb', line 34 def api_keys @_api_keys ||= NgrokAPI::Services::APIKeysClient.new(client: @client) end |
#certificate_authorities ⇒ NgrokAPI::Services::CertificateAuthoritiesClient
Certificate Authorities are x509 certificates that are used to sign other x509 certificates. Attach a Certificate Authority to the Mutual TLS module to verify that the TLS certificate presented by a client has been signed by this CA. Certificate Authorities are used only for mTLS validation only and thus a private key is not included in the resource.
46 47 48 |
# File 'lib/ngrokapi/client.rb', line 46 def @_certificate_authorities ||= NgrokAPI::Services::CertificateAuthoritiesClient.new(client: @client) end |
#credentials ⇒ NgrokAPI::Services::CredentialsClient
Tunnel Credentials are ngrok agent authtokens. They authorize the ngrok agent to connect the ngrok service as your account. They are installed with the ngrok authtoken
command or by specifying it in the ngrok.yml
configuration file with the authtoken
property.
57 58 59 |
# File 'lib/ngrokapi/client.rb', line 57 def credentials @_credentials ||= NgrokAPI::Services::CredentialsClient.new(client: @client) end |
#endpoint_configurations ⇒ NgrokAPI::Services::EndpointConfigurationsClient
Endpoint Configurations are a reusable group of modules that encapsulate how traffic to a domain or address is handled. Endpoint configurations are only applied to Domains and TCP Addresses they have been attached to.
67 68 69 |
# File 'lib/ngrokapi/client.rb', line 67 def endpoint_configurations @_endpoint_configurations ||= NgrokAPI::Services::EndpointConfigurationsClient.new(client: @client) end |
#event_destinations ⇒ Object
75 76 77 |
# File 'lib/ngrokapi/client.rb', line 75 def event_destinations @_event_destinations ||= NgrokAPI::Services::EventDestinationsClient.new(client: @client) end |
#event_sources ⇒ Object
83 84 85 |
# File 'lib/ngrokapi/client.rb', line 83 def event_sources @_event_sources ||= NgrokAPI::Services::EventSourcesClient.new(client: @client) end |
#event_streams ⇒ Object
71 72 73 |
# File 'lib/ngrokapi/client.rb', line 71 def event_streams @_event_streams ||= NgrokAPI::Services::EventStreamsClient.new(client: @client) end |
#event_subscriptions ⇒ Object
79 80 81 |
# File 'lib/ngrokapi/client.rb', line 79 def event_subscriptions @_event_subscriptions ||= NgrokAPI::Services::EventSubscriptionsClient.new(client: @client) end |
#ip_policies ⇒ NgrokAPI::Services::IPPoliciesClient
IP Policies are reusable groups of CIDR ranges with an allow
or deny
action. They can be attached to endpoints via the Endpoint Configuration IP Policy module. They can also be used with IP Restrictions to control source IP ranges that can start tunnel sessions and connect to the API and dashboard.
94 95 96 |
# File 'lib/ngrokapi/client.rb', line 94 def ip_policies @_ip_policies ||= NgrokAPI::Services::IPPoliciesClient.new(client: @client) end |
#ip_policy_rules ⇒ NgrokAPI::Services::IPPolicyRulesClient
IP Policy Rules are the IPv4 or IPv6 CIDRs entries that make up an IP Policy.
103 104 105 |
# File 'lib/ngrokapi/client.rb', line 103 def ip_policy_rules @_ip_policy_rules ||= NgrokAPI::Services::IPPolicyRulesClient.new(client: @client) end |
#ip_restrictions ⇒ NgrokAPI::Services::IPRestrictionsClient
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.
116 117 118 |
# File 'lib/ngrokapi/client.rb', line 116 def ip_restrictions @_ip_restrictions ||= NgrokAPI::Services::IPRestrictionsClient.new(client: @client) end |
#ip_whitelist ⇒ NgrokAPI::Services::IPWhitelistClient
The IP Whitelist is deprecated and will be removed. Use an IP Restriction with an endpoints
type instead.
125 126 127 |
# File 'lib/ngrokapi/client.rb', line 125 def ip_whitelist @_ip_whitelist ||= NgrokAPI::Services::IPWhitelistClient.new(client: @client) end |
#pointcfg_module ⇒ Object
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 |
# File 'lib/ngrokapi/client.rb', line 219 def pointcfg_module ns = OpenStruct.new ns.logging = NgrokAPI::Services::EndpointLoggingModuleClient.new(client: @client) ns.circuit_breaker = NgrokAPI::Services::EndpointCircuitBreakerModuleClient.new(client: @client) ns.compression = NgrokAPI::Services::EndpointCompressionModuleClient.new(client: @client) ns.tls_termination = NgrokAPI::Services::EndpointTLSTerminationModuleClient.new(client: @client) ns.ip_policy = NgrokAPI::Services::EndpointIPPolicyModuleClient.new(client: @client) ns.mutual_tls = NgrokAPI::Services::EndpointMutualTLSModuleClient.new(client: @client) ns.request_headers = NgrokAPI::Services::EndpointRequestHeadersModuleClient.new(client: @client) ns.response_headers = NgrokAPI::Services::EndpointResponseHeadersModuleClient.new(client: @client) ns.oauth = NgrokAPI::Services::EndpointOAuthModuleClient.new(client: @client) ns.webhook_validation = NgrokAPI::Services::EndpointWebhookValidationModuleClient.new(client: @client) ns.saml = NgrokAPI::Services::EndpointSAMLModuleClient.new(client: @client) ns.oidc = NgrokAPI::Services::EndpointOIDCModuleClient.new(client: @client) ns end |
#reserved_addrs ⇒ 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.
135 136 137 |
# File 'lib/ngrokapi/client.rb', line 135 def reserved_addrs @_reserved_addrs ||= NgrokAPI::Services::ReservedAddrsClient.new(client: @client) end |
#reserved_domains ⇒ 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.
146 147 148 |
# File 'lib/ngrokapi/client.rb', line 146 def reserved_domains @_reserved_domains ||= NgrokAPI::Services::ReservedDomainsClient.new(client: @client) end |
#ssh_certificate_authorities ⇒ NgrokAPI::Services::SSHCertificateAuthoritiesClient
An SSH Certificate Authority is a pair of an SSH Certificate and its private key that can be used to sign other SSH host and user certificates.
155 156 157 |
# File 'lib/ngrokapi/client.rb', line 155 def @_ssh_certificate_authorities ||= NgrokAPI::Services::SSHCertificateAuthoritiesClient.new(client: @client) end |
#ssh_credentials ⇒ NgrokAPI::Services::SSHCredentialsClient
SSH Credentials are SSH public keys that can be used to start SSH tunnels via the ngrok SSH tunnel gateway.
164 165 166 |
# File 'lib/ngrokapi/client.rb', line 164 def ssh_credentials @_ssh_credentials ||= NgrokAPI::Services::SSHCredentialsClient.new(client: @client) end |
#ssh_host_certificates ⇒ NgrokAPI::Services::SSHHostCertificatesClient
SSH Host Certificates along with the corresponding private key allows an SSH server to assert its authenticity to connecting SSH clients who trust the SSH Certificate Authority that was used to sign the certificate.
174 175 176 |
# File 'lib/ngrokapi/client.rb', line 174 def ssh_host_certificates @_ssh_host_certificates ||= NgrokAPI::Services::SSHHostCertificatesClient.new(client: @client) end |
#ssh_user_certificates ⇒ NgrokAPI::Services::SSHUserCertificatesClient
SSH User Certificates are presented by SSH clients when connecting to an SSH server to authenticate their connection. The SSH server must trust the SSH Certificate Authority used to sign the certificate.
184 185 186 |
# File 'lib/ngrokapi/client.rb', line 184 def ssh_user_certificates @_ssh_user_certificates ||= NgrokAPI::Services::SSHUserCertificatesClient.new(client: @client) end |
#tls_certificates ⇒ NgrokAPI::Services::TLSCertificatesClient
TLS Certificates are pairs of x509 certificates and their matching private key that can be used to terminate TLS traffic. TLS certificates are unused until they are attached to a Domain. TLS Certificates may also be provisioned by ngrok automatically for domains on which you have enabled automated certificate provisioning.
196 197 198 |
# File 'lib/ngrokapi/client.rb', line 196 def tls_certificates @_tls_certificates ||= NgrokAPI::Services::TLSCertificatesClient.new(client: @client) end |
#tunnel_sessions ⇒ NgrokAPI::Services::TunnelSessionsClient
Tunnel Sessions represent instances of ngrok agents or SSH reverse tunnel sessions that are running and connected to the ngrok service. Each tunnel session can include one or more Tunnels.
206 207 208 |
# File 'lib/ngrokapi/client.rb', line 206 def tunnel_sessions @_tunnel_sessions ||= NgrokAPI::Services::TunnelSessionsClient.new(client: @client) end |
#tunnels ⇒ NgrokAPI::Services::TunnelsClient
Tunnels provide endpoints to access services exposed by a running ngrok agent tunnel session or an SSH reverse tunnel session.
215 216 217 |
# File 'lib/ngrokapi/client.rb', line 215 def tunnels @_tunnels ||= NgrokAPI::Services::TunnelsClient.new(client: @client) end |