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.
- #agent_ingresses ⇒ Object
-
#api_keys ⇒ NgrokAPI::Services::APIKeysClient
API Keys are used to authenticate to the ngrok API.
- #application_sessions ⇒ Object
- #application_users ⇒ Object
- #backends ⇒ Object
- #bot_users ⇒ Object
-
#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.
- #edge_modules ⇒ Object
- #edges ⇒ Object
-
#endpoints ⇒ NgrokAPI::Services::EndpointsClient
Endpoints provides an API for querying the endpoint objects which define what tunnel or edge is used to serve a hostport.
- #event_destinations ⇒ Object
- #event_sources ⇒ 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
allowordenyaction. -
#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 initiate traffic to a specific aspect of your ngrok account.
-
#kubernetes_operators ⇒ NgrokAPI::Services::KubernetesOperatorsClient
KubernetesOperators is used by the Kubernetes Operator to register and manage its own resource, as well as for users to see active kubernetes clusters.
-
#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.
12 13 14 |
# File 'lib/ngrokapi/client.rb', line 12 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.
21 22 23 |
# File 'lib/ngrokapi/client.rb', line 21 def abuse_reports @_abuse_reports ||= NgrokAPI::Services::AbuseReportsClient.new(client: @client) end |
#agent_ingresses ⇒ Object
25 26 27 |
# File 'lib/ngrokapi/client.rb', line 25 def agent_ingresses @_agent_ingresses ||= NgrokAPI::Services::AgentIngressesClient.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.
37 38 39 |
# File 'lib/ngrokapi/client.rb', line 37 def api_keys @_api_keys ||= NgrokAPI::Services::APIKeysClient.new(client: @client) end |
#application_sessions ⇒ Object
41 42 43 |
# File 'lib/ngrokapi/client.rb', line 41 def application_sessions @_application_sessions ||= NgrokAPI::Services::ApplicationSessionsClient.new(client: @client) end |
#application_users ⇒ Object
45 46 47 |
# File 'lib/ngrokapi/client.rb', line 45 def application_users @_application_users ||= NgrokAPI::Services::ApplicationUsersClient.new(client: @client) end |
#backends ⇒ Object
231 232 233 234 235 236 237 238 239 240 |
# File 'lib/ngrokapi/client.rb', line 231 def backends ns = OpenStruct.new ns.failover = NgrokAPI::Services::FailoverBackendsClient.new(client: @client) ns.http_response = NgrokAPI::Services::HTTPResponseBackendsClient.new(client: @client) ns.static_address = NgrokAPI::Services::StaticBackendsClient.new(client: @client) ns.tunnel_group = NgrokAPI::Services::TunnelGroupBackendsClient.new(client: @client) ns.weighted = NgrokAPI::Services::WeightedBackendsClient.new(client: @client) ns end |
#bot_users ⇒ Object
59 60 61 |
# File 'lib/ngrokapi/client.rb', line 59 def bot_users @_bot_users ||= NgrokAPI::Services::BotUsersClient.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.
71 72 73 |
# File 'lib/ngrokapi/client.rb', line 71 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 config add-authtoken command or by specifying it in the ngrok.yml configuration file with the authtoken property.
82 83 84 |
# File 'lib/ngrokapi/client.rb', line 82 def credentials @_credentials ||= NgrokAPI::Services::CredentialsClient.new(client: @client) end |
#edge_modules ⇒ Object
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
# File 'lib/ngrokapi/client.rb', line 252 def edge_modules ns = OpenStruct.new ns.https_edge_mutual_tls = NgrokAPI::Services::HTTPSEdgeMutualTLSModuleClient.new(client: @client) ns.https_edge_tls_termination = NgrokAPI::Services::HTTPSEdgeTLSTerminationModuleClient.new(client: @client) ns.https_edge_route_backend = NgrokAPI::Services::EdgeRouteBackendModuleClient.new(client: @client) ns.https_edge_route_ip_restriction = NgrokAPI::Services::EdgeRouteIPRestrictionModuleClient.new(client: @client) ns.https_edge_route_request_headers = NgrokAPI::Services::EdgeRouteRequestHeadersModuleClient.new(client: @client) ns.https_edge_route_response_headers = NgrokAPI::Services::EdgeRouteResponseHeadersModuleClient.new(client: @client) ns.https_edge_route_compression = NgrokAPI::Services::EdgeRouteCompressionModuleClient.new(client: @client) ns.https_edge_route_circuit_breaker = NgrokAPI::Services::EdgeRouteCircuitBreakerModuleClient.new(client: @client) ns.https_edge_route_webhook_verification = NgrokAPI::Services::EdgeRouteWebhookVerificationModuleClient.new(client: @client) ns.https_edge_route_oauth = NgrokAPI::Services::EdgeRouteOAuthModuleClient.new(client: @client) ns.https_edge_route_saml = NgrokAPI::Services::EdgeRouteSAMLModuleClient.new(client: @client) ns.https_edge_route_oidc = NgrokAPI::Services::EdgeRouteOIDCModuleClient.new(client: @client) ns.https_edge_route_websocket_tcp_converter = NgrokAPI::Services::EdgeRouteWebsocketTCPConverterModuleClient.new(client: @client) ns.https_edge_route_user_agent_filter = NgrokAPI::Services::EdgeRouteUserAgentFilterModuleClient.new(client: @client) ns.https_edge_route_traffic_policy = NgrokAPI::Services::EdgeRouteTrafficPolicyModuleClient.new(client: @client) ns.tcp_edge_backend = NgrokAPI::Services::TCPEdgeBackendModuleClient.new(client: @client) ns.tcp_edge_ip_restriction = NgrokAPI::Services::TCPEdgeIPRestrictionModuleClient.new(client: @client) ns.tcp_edge_traffic_policy = NgrokAPI::Services::TCPEdgeTrafficPolicyModuleClient.new(client: @client) ns.tls_edge_backend = NgrokAPI::Services::TLSEdgeBackendModuleClient.new(client: @client) ns.tls_edge_ip_restriction = NgrokAPI::Services::TLSEdgeIPRestrictionModuleClient.new(client: @client) ns.tls_edge_mutual_tls = NgrokAPI::Services::TLSEdgeMutualTLSModuleClient.new(client: @client) ns.tls_edge_tls_termination = NgrokAPI::Services::TLSEdgeTLSTerminationModuleClient.new(client: @client) ns.tls_edge_traffic_policy = NgrokAPI::Services::TLSEdgeTrafficPolicyModuleClient.new(client: @client) ns end |
#edges ⇒ Object
242 243 244 245 246 247 248 249 250 |
# File 'lib/ngrokapi/client.rb', line 242 def edges ns = OpenStruct.new ns.https_routes = NgrokAPI::Services::EdgesHTTPSRoutesClient.new(client: @client) ns.https = NgrokAPI::Services::EdgesHTTPSClient.new(client: @client) ns.tcp = NgrokAPI::Services::EdgesTCPClient.new(client: @client) ns.tls = NgrokAPI::Services::EdgesTLSClient.new(client: @client) ns end |
#endpoints ⇒ NgrokAPI::Services::EndpointsClient
Endpoints provides an API for querying the endpoint objects which define what tunnel or edge is used to serve a hostport. Only active endpoints associated with a tunnel or backend are returned.
92 93 94 |
# File 'lib/ngrokapi/client.rb', line 92 def endpoints @_endpoints ||= NgrokAPI::Services::EndpointsClient.new(client: @client) end |
#event_destinations ⇒ Object
96 97 98 |
# File 'lib/ngrokapi/client.rb', line 96 def event_destinations @_event_destinations ||= NgrokAPI::Services::EventDestinationsClient.new(client: @client) end |
#event_sources ⇒ Object
104 105 106 |
# File 'lib/ngrokapi/client.rb', line 104 def event_sources @_event_sources ||= NgrokAPI::Services::EventSourcesClient.new(client: @client) end |
#event_subscriptions ⇒ Object
100 101 102 |
# File 'lib/ngrokapi/client.rb', line 100 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.
115 116 117 |
# File 'lib/ngrokapi/client.rb', line 115 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.
124 125 126 |
# File 'lib/ngrokapi/client.rb', line 124 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 initiate 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.
137 138 139 |
# File 'lib/ngrokapi/client.rb', line 137 def ip_restrictions @_ip_restrictions ||= NgrokAPI::Services::IPRestrictionsClient.new(client: @client) end |
#kubernetes_operators ⇒ NgrokAPI::Services::KubernetesOperatorsClient
KubernetesOperators is used by the Kubernetes Operator to register and manage its own resource, as well as for users to see active kubernetes clusters.
147 148 149 |
# File 'lib/ngrokapi/client.rb', line 147 def kubernetes_operators @_kubernetes_operators ||= NgrokAPI::Services::KubernetesOperatorsClient.new(client: @client) 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.
157 158 159 |
# File 'lib/ngrokapi/client.rb', line 157 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.
168 169 170 |
# File 'lib/ngrokapi/client.rb', line 168 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.
177 178 179 |
# File 'lib/ngrokapi/client.rb', line 177 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.
186 187 188 |
# File 'lib/ngrokapi/client.rb', line 186 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.
196 197 198 |
# File 'lib/ngrokapi/client.rb', line 196 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.
206 207 208 |
# File 'lib/ngrokapi/client.rb', line 206 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.
218 219 220 |
# File 'lib/ngrokapi/client.rb', line 218 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.
55 56 57 |
# File 'lib/ngrokapi/client.rb', line 55 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.
227 228 229 |
# File 'lib/ngrokapi/client.rb', line 227 def tunnels @_tunnels ||= NgrokAPI::Services::TunnelsClient.new(client: @client) end |