diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e302033 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +doc/build +.pyc +.swp +__pycache__ diff --git a/doc/source/.errors.rst.swp b/doc/source/.errors.rst.swp deleted file mode 100644 index bafc9c0..0000000 Binary files a/doc/source/.errors.rst.swp and /dev/null differ diff --git a/docs/.buildinfo b/docs/.buildinfo new file mode 100644 index 0000000..9ec548e --- /dev/null +++ b/docs/.buildinfo @@ -0,0 +1,4 @@ +# Sphinx build info version 1 +# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. +config: 3f8a1ac14affc527e270aebbfc8445e3 +tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/_modules/index.html b/docs/_modules/index.html new file mode 100644 index 0000000..50da9aa --- /dev/null +++ b/docs/_modules/index.html @@ -0,0 +1,242 @@ + + +
+ + + + +
+from __future__ import annotations
+import collections
+import os
+from .services import *
+
+
+[docs]class Client(object):
+ def __init__(self, api_key: str = "", base_url: str = "https://api.ngrok.com"):
+ self.api_key = api_key or os.getenv("NGROK_API_KEY")
+ self.api_client = APIClient(api_key, base_url)
+
+ @property
+ def abuse_reports(self) -> AbuseReportsClient:
+ return AbuseReportsClient(self)
+
+ @property
+ def api_keys(self) -> APIKeysClient:
+ return APIKeysClient(self)
+
+ @property
+ def certificate_authorities(self) -> CertificateAuthoritiesClient:
+ return CertificateAuthoritiesClient(self)
+
+ @property
+ def credentials(self) -> CredentialsClient:
+ return CredentialsClient(self)
+
+ @property
+ def event_streams(self) -> EventStreamsClient:
+ return EventStreamsClient(self)
+
+ @property
+ def event_destinations(self) -> EventDestinationsClient:
+ return EventDestinationsClient(self)
+
+ @property
+ def ip_policies(self) -> IPPoliciesClient:
+ return IPPoliciesClient(self)
+
+ @property
+ def ip_policy_rules(self) -> IPPolicyRulesClient:
+ return IPPolicyRulesClient(self)
+
+ @property
+ def ip_restrictions(self) -> IPRestrictionsClient:
+ return IPRestrictionsClient(self)
+
+ @property
+ def ip_whitelist(self) -> IPWhitelistClient:
+ return IPWhitelistClient(self)
+
+ @property
+ def endpoint_configurations(self) -> EndpointConfigurationsClient:
+ """## Endpoint Configuration management
+
+ An [Endpoint Configuration](https://ngrok.com/docs/ngrok-link#api-endpoint-configurations) describes
+ a ngrok network endpoint instance.
+
+ _Endpoints are your gateway to ngrok features!_"""
+ return EndpointConfigurationsClient(self)
+
+ @property
+ def reserved_addrs(self) -> ReservedAddrsClient:
+ return ReservedAddrsClient(self)
+
+ @property
+ def reserved_domains(self) -> ReservedDomainsClient:
+ return ReservedDomainsClient(self)
+
+ @property
+ def ssh_certificate_authorities(self) -> SSHCertificateAuthoritiesClient:
+ return SSHCertificateAuthoritiesClient(self)
+
+ @property
+ def ssh_credentials(self) -> SSHCredentialsClient:
+ return SSHCredentialsClient(self)
+
+ @property
+ def ssh_host_certificates(self) -> SSHHostCertificatesClient:
+ return SSHHostCertificatesClient(self)
+
+ @property
+ def ssh_user_certificates(self) -> SSHUserCertificatesClient:
+ return SSHUserCertificatesClient(self)
+
+ @property
+ def tls_certificates(self) -> TLSCertificatesClient:
+ return TLSCertificatesClient(self)
+
+ @property
+ def tunnel_sessions(self) -> TunnelSessionsClient:
+ return TunnelSessionsClient(self)
+
+ @property
+ def tunnels(self) -> TunnelsClient:
+ return TunnelsClient(self)
+
+ @property
+ def pointcfg_module(self):
+ ns = collections.namedtuple(
+ "Namespace",
+ "logging",
+ "circuit_breaker",
+ "compression",
+ "tls_termination",
+ "ip_policy",
+ "mutual_tls",
+ "request_headers",
+ "response_headers",
+ "oauth",
+ "webhook_validation",
+ "saml",
+ "oidc",
+ )
+ return ns(
+ logging=EndpointLoggingModuleClient(self),
+ circuit_breaker=EndpointCircuitBreakerModuleClient(self),
+ compression=EndpointCompressionModuleClient(self),
+ tls_termination=EndpointTLSTerminationModuleClient(self),
+ ip_policy=EndpointIPPolicyModuleClient(self),
+ mutual_tls=EndpointMutualTLSModuleClient(self),
+ request_headers=EndpointRequestHeadersModuleClient(self),
+ response_headers=EndpointResponseHeadersModuleClient(self),
+ oauth=EndpointOAuthModuleClient(self),
+ webhook_validation=EndpointWebhookValidationModuleClient(self),
+ saml=EndpointSAMLModuleClient(self),
+ oidc=EndpointOIDCModuleClient(self),
+ )
+
+from typing import Any, Optional
+
+
+[docs]class Error(Exception):
+ """Raised by failed ngrok API operations.
+
+ This class encapsulates details about the error to make it simple for callers
+ to introspect the error and take action on it.
+
+ :param error_code: The unique ngrok error code indicating why the operation failed.
+ :param message: Human-readable string explaining the error.
+ :param http_status_code: HTTP status code returned by the server.
+ :param details: Arbitrary additional details about the error.
+ """
+
+ def __init__(
+ self,
+ error_code: Optional[int],
+ message: str,
+ http_status_code: int,
+ details: Any,
+ ):
+ super().__init__(self, message)
+ self.error_code = error_code
+ self.http_status_code = http_status_code
+ self.details = details
+
+
+[docs]class NotFoundError(Error):
+ """Raised if the http_status_code of an API operation is 404.
+ This is a separate class to make this common condition easier to handle.
+ """
+
+ pass
+
+from __future__ import annotations
+from typing import Any, Mapping, Sequence
+from .iterator import PagedIterator
+
+
+[docs]class Ref(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<Ref {}>".format(self.id)
+
+ @property
+ def id(self) -> str:
+ """a resource identifier"""
+ return self._props["id"]
+
+ @property
+ def uri(self) -> str:
+ """a uri for locating a resource"""
+ return self._props["uri"]
+
+
+[docs]class AbuseReport(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["hostnames"] = [
+ AbuseReportHostname(client, x) for x in props["hostnames"]
+ ]
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<AbuseReport {}>".format(self.id)
+
+ @property
+ def id(self) -> str:
+ """ID of the abuse report"""
+ return self._props["id"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the abuse report API resource"""
+ return self._props["uri"]
+
+ @property
+ def created_at(self) -> str:
+ """timestamp that the abuse report record was created in RFC 3339 format"""
+ return self._props["created_at"]
+
+ @property
+ def urls(self) -> Sequence[str]:
+ """a list of URLs containing suspected abusive content"""
+ return self._props["urls"]
+
+ @property
+ def metadata(self) -> str:
+ """arbitrary user-defined data about this abuse report. Optional, max 4096 bytes."""
+ return self._props["metadata"]
+
+ @property
+ def status(self) -> str:
+ """Indicates whether ngrok has processed the abuse report. one of <code>PENDING</code>, <code>PROCESSED</code>, or <code>PARTIALLY_PROCESSED</code>"""
+ return self._props["status"]
+
+ @property
+ def hostnames(self) -> Sequence[AbuseReportHostname]:
+ """an array of hostname statuses related to the report"""
+ return self._props["hostnames"]
+
+
+[docs]class AbuseReportHostname(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<AbuseReportHostname {}>".format(self.id)
+
+ @property
+ def hostname(self) -> str:
+ """the hostname ngrok has parsed out of one of the reported URLs in this abuse report"""
+ return self._props["hostname"]
+
+ @property
+ def status(self) -> str:
+ """indicates what action ngrok has taken against the hostname. one of <code>PENDING</code>, <code>BANNED</code>, <code>UNBANNED</code>, or <code>IGNORE</code>"""
+ return self._props["status"]
+
+
+[docs]class APIKey(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<APIKey {}>".format(self.id)
+
+
+
+[docs] def update(
+ self,
+ description: str = None,
+ metadata: str = None,
+ ):
+ self._client.api_keys.update(
+ id=self.id,
+ description=description,
+ metadata=metadata,
+ )
+
+ @property
+ def id(self) -> str:
+ """unique API key resource identifier"""
+ return self._props["id"]
+
+ @property
+ def uri(self) -> str:
+ """URI to the API resource of this API key"""
+ return self._props["uri"]
+
+ @property
+ def description(self) -> str:
+ """human-readable description of what uses the API key to authenticate. optional, max 255 bytes."""
+ return self._props["description"]
+
+ @property
+ def metadata(self) -> str:
+ """arbitrary user-defined data of this API key. optional, max 4096 bytes"""
+ return self._props["metadata"]
+
+ @property
+ def created_at(self) -> str:
+ """timestamp when the api key was created, RFC 3339 format"""
+ return self._props["created_at"]
+
+ @property
+ def token(self) -> str:
+ """the bearer token that can be placed into the Authorization header to authenticate request to the ngrok API. <strong>This value is only available one time, on the API response from key creation. Otherwise it is null.</strong>"""
+ return self._props["token"]
+
+
+[docs]class APIKeyList(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["keys"] = [APIKey(client, x) for x in props["keys"]]
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<APIKeyList {}>".format(self.id)
+
+ def __iter__(self):
+ return PagedIterator(self._client, self, "keys")
+
+ @property
+ def keys(self) -> Sequence[APIKey]:
+ """the list of API keys for this account"""
+ return self._props["keys"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the API keys list API resource"""
+ return self._props["uri"]
+
+ @property
+ def next_page_uri(self) -> str:
+ """URI of the next page, or null if there is no next page"""
+ return self._props["next_page_uri"]
+
+
+[docs]class CertificateAuthority(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<CertificateAuthority {}>".format(self.id)
+
+
+
+[docs] def update(
+ self,
+ description: str = None,
+ metadata: str = None,
+ ):
+ self._client.certificate_authorities.update(
+ id=self.id,
+ description=description,
+ metadata=metadata,
+ )
+
+ @property
+ def id(self) -> str:
+ """unique identifier for this Certificate Authority"""
+ return self._props["id"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the Certificate Authority API resource"""
+ return self._props["uri"]
+
+ @property
+ def created_at(self) -> str:
+ """timestamp when the Certificate Authority was created, RFC 3339 format"""
+ return self._props["created_at"]
+
+ @property
+ def description(self) -> str:
+ """human-readable description of this Certificate Authority. optional, max 255 bytes."""
+ return self._props["description"]
+
+ @property
+ def metadata(self) -> str:
+ """arbitrary user-defined machine-readable data of this Certificate Authority. optional, max 4096 bytes."""
+ return self._props["metadata"]
+
+ @property
+ def ca_pem(self) -> str:
+ """raw PEM of the Certificate Authority"""
+ return self._props["ca_pem"]
+
+ @property
+ def subject_common_name(self) -> str:
+ """subject common name of the Certificate Authority"""
+ return self._props["subject_common_name"]
+
+ @property
+ def not_before(self) -> str:
+ """timestamp when this Certificate Authority becomes valid, RFC 3339 format"""
+ return self._props["not_before"]
+
+ @property
+ def not_after(self) -> str:
+ """timestamp when this Certificate Authority becomes invalid, RFC 3339 format"""
+ return self._props["not_after"]
+
+ @property
+ def key_usages(self) -> Sequence[str]:
+ """set of actions the private key of this Certificate Authority can be used for"""
+ return self._props["key_usages"]
+
+ @property
+ def extended_key_usages(self) -> Sequence[str]:
+ """extended set of actions the private key of this Certificate Authority can be used for"""
+ return self._props["extended_key_usages"]
+
+
+[docs]class CertificateAuthorityList(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["certificate_authorities"] = [
+ CertificateAuthority(client, x) for x in props["certificate_authorities"]
+ ]
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<CertificateAuthorityList {}>".format(self.id)
+
+ def __iter__(self):
+ return PagedIterator(self._client, self, "certificate_authorities")
+
+ @property
+ def certificate_authorities(self) -> Sequence[CertificateAuthority]:
+ """the list of all certificate authorities on this account"""
+ return self._props["certificate_authorities"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the certificates authorities list API resource"""
+ return self._props["uri"]
+
+ @property
+ def next_page_uri(self) -> str:
+ """URI of the next page, or null if there is no next page"""
+ return self._props["next_page_uri"]
+
+
+[docs]class Credential(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<Credential {}>".format(self.id)
+
+
+
+[docs] def update(
+ self,
+ description: str = None,
+ metadata: str = None,
+ acl: Sequence[str] = None,
+ ):
+ self._client.credentials.update(
+ id=self.id,
+ description=description,
+ metadata=metadata,
+ acl=acl,
+ )
+
+ @property
+ def id(self) -> str:
+ """unique tunnel credential resource identifier"""
+ return self._props["id"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the tunnel credential API resource"""
+ return self._props["uri"]
+
+ @property
+ def created_at(self) -> str:
+ """timestamp when the tunnel credential was created, RFC 3339 format"""
+ return self._props["created_at"]
+
+ @property
+ def description(self) -> str:
+ """human-readable description of who or what will use the credential to authenticate. Optional, max 255 bytes."""
+ return self._props["description"]
+
+ @property
+ def metadata(self) -> str:
+ """arbitrary user-defined machine-readable data of this credential. Optional, max 4096 bytes."""
+ return self._props["metadata"]
+
+ @property
+ def token(self) -> str:
+ """the credential's authtoken that can be used to authenticate an ngrok client. <strong><em>This value is only available one time, on the API response from credential creation, otherwise it is null.</em></strong>"""
+ return self._props["token"]
+
+ @property
+ def acl(self) -> Sequence[str]:
+ """optional list of ACL rules. If unspecified, the credential will have no restrictions. The only allowed ACL rule at this time is the <code>bind</code> rule. The <code>bind</code> rule allows the caller to restrict what domains and addresses the token is allowed to bind. For example, to allow the token to open a tunnel on example.ngrok.io your ACL would include the rule <code>bind:example.ngrok.io</code>. Bind rules may specify a leading wildcard to match multiple domains with a common suffix. For example, you may specify a rule of <code>bind:*.example.com</code> which will allow <code>x.example.com</code>, <code>y.example.com</code>, <code>*.example.com</code>, etc. A rule of <code>'*'</code> is equivalent to no acl at all and will explicitly permit all actions."""
+ return self._props["acl"]
+
+
+[docs]class CredentialList(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["credentials"] = [
+ Credential(client, x) for x in props["credentials"]
+ ]
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<CredentialList {}>".format(self.id)
+
+ def __iter__(self):
+ return PagedIterator(self._client, self, "credentials")
+
+ @property
+ def credentials(self) -> Sequence[Credential]:
+ """the list of all tunnel credentials on this account"""
+ return self._props["credentials"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the tunnel credential list API resource"""
+ return self._props["uri"]
+
+ @property
+ def next_page_uri(self) -> str:
+ """URI of the next page, or null if there is no next page"""
+ return self._props["next_page_uri"]
+
+
+[docs]class EventStreamList(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["event_streams"] = [
+ EventStream(client, x) for x in props["event_streams"]
+ ]
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EventStreamList {}>".format(self.id)
+
+ def __iter__(self):
+ return PagedIterator(self._client, self, "event_streams")
+
+ @property
+ def event_streams(self) -> Sequence[EventStream]:
+ """The list of all Event Streams on this account."""
+ return self._props["event_streams"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the Event Stream list API resource."""
+ return self._props["uri"]
+
+ @property
+ def next_page_uri(self) -> str:
+ """URI of the next page, or null if there is no next page."""
+ return self._props["next_page_uri"]
+
+
+[docs]class EventStream(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EventStream {}>".format(self.id)
+
+
+
+[docs] def update(
+ self,
+ metadata: str = None,
+ description: str = None,
+ fields: Sequence[str] = None,
+ destination_ids: Sequence[str] = None,
+ sampling_rate: float = None,
+ ):
+ self._client.event_streams.update(
+ id=self.id,
+ metadata=metadata,
+ description=description,
+ fields=fields,
+ destination_ids=destination_ids,
+ sampling_rate=sampling_rate,
+ )
+
+ @property
+ def id(self) -> str:
+ """Unique identifier for this Event Stream."""
+ return self._props["id"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the Event Stream API resource."""
+ return self._props["uri"]
+
+ @property
+ def created_at(self) -> str:
+ """Timestamp when the Event Stream was created, RFC 3339 format."""
+ return self._props["created_at"]
+
+ @property
+ def metadata(self) -> str:
+ """Arbitrary user-defined machine-readable data of this Event Stream. Optional, max 4096 bytes."""
+ return self._props["metadata"]
+
+ @property
+ def description(self) -> str:
+ """Human-readable description of the Event Stream. Optional, max 255 bytes."""
+ return self._props["description"]
+
+ @property
+ def fields(self) -> Sequence[str]:
+ """A list of protocol-specific fields you want to collect on each event."""
+ return self._props["fields"]
+
+ @property
+ def event_type(self) -> str:
+ """The protocol that determines which events will be collected. Supported values are <code>tcp_connection_closed</code> and <code>http_request_complete</code>."""
+ return self._props["event_type"]
+
+ @property
+ def destination_ids(self) -> Sequence[str]:
+ """A list of Event Destination IDs which should be used for this Event Stream. Event Streams are required to have at least one Event Destination."""
+ return self._props["destination_ids"]
+
+ @property
+ def sampling_rate(self) -> float:
+ """The percentage of all events you would like to capture. Valid values range from 0.01, representing 1% of all events to 1.00, representing 100% of all events."""
+ return self._props["sampling_rate"]
+
+
+[docs]class EventDestination(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["target"] = EventTarget(client, props["target"])
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EventDestination {}>".format(self.id)
+
+
+
+ @property
+ def id(self) -> str:
+ """Unique identifier for this Event Destination."""
+ return self._props["id"]
+
+ @property
+ def metadata(self) -> str:
+ """Arbitrary user-defined machine-readable data of this Event Destination. Optional, max 4096 bytes."""
+ return self._props["metadata"]
+
+ @property
+ def created_at(self) -> str:
+ """Timestamp when the Event Destination was created, RFC 3339 format."""
+ return self._props["created_at"]
+
+ @property
+ def description(self) -> str:
+ """Human-readable description of the Event Destination. Optional, max 255 bytes."""
+ return self._props["description"]
+
+ @property
+ def format(self) -> str:
+ """The output format you would like to serialize events into when sending to their target. Currently the only accepted value is <code>JSON</code>."""
+ return self._props["format"]
+
+ @property
+ def target(self) -> EventTarget:
+ """An object that encapsulates where and how to send your events. An event destination must contain exactly one of the following objects, leaving the rest null: <code>kinesis</code>, <code>firehose</code>, <code>cloudwatch_logs</code>, or <code>s3</code>."""
+ return self._props["target"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the Event Destination API resource."""
+ return self._props["uri"]
+
+
+[docs]class EventDestinationList(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["event_destinations"] = [
+ EventDestination(client, x) for x in props["event_destinations"]
+ ]
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EventDestinationList {}>".format(self.id)
+
+ def __iter__(self):
+ return PagedIterator(self._client, self, "event_destinations")
+
+ @property
+ def event_destinations(self) -> Sequence[EventDestination]:
+ """The list of all Event Destinations on this account."""
+ return self._props["event_destinations"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the Event Destinations list API resource."""
+ return self._props["uri"]
+
+ @property
+ def next_page_uri(self) -> str:
+ """URI of the next page, or null if there is no next page."""
+ return self._props["next_page_uri"]
+
+
+[docs]class EventTarget(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["firehose"] = EventTargetFirehose(client, props["firehose"])
+ self._props["kinesis"] = EventTargetKinesis(client, props["kinesis"])
+ self._props["cloudwatch_logs"] = EventTargetCloudwatchLogs(
+ client, props["cloudwatch_logs"]
+ )
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EventTarget {}>".format(self.id)
+
+ @property
+ def firehose(self) -> EventTargetFirehose:
+ """Configuration used to send events to Amazon Kinesis Data Firehose."""
+ return self._props["firehose"]
+
+ @property
+ def kinesis(self) -> EventTargetKinesis:
+ """Configuration used to send events to Amazon Kinesis."""
+ return self._props["kinesis"]
+
+ @property
+ def cloudwatch_logs(self) -> EventTargetCloudwatchLogs:
+ """Configuration used to send events to Amazon CloudWatch Logs."""
+ return self._props["cloudwatch_logs"]
+
+
+[docs]class EventTargetFirehose(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["auth"] = AWSAuth(client, props["auth"])
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EventTargetFirehose {}>".format(self.id)
+
+ @property
+ def auth(self) -> AWSAuth:
+ """Configuration for how to authenticate into your AWS account. Exactly one of <code>role</code> or <code>creds</code> should be configured."""
+ return self._props["auth"]
+
+ @property
+ def delivery_stream_arn(self) -> str:
+ """An Amazon Resource Name specifying the Firehose delivery stream to deposit events into."""
+ return self._props["delivery_stream_arn"]
+
+
+[docs]class EventTargetKinesis(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["auth"] = AWSAuth(client, props["auth"])
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EventTargetKinesis {}>".format(self.id)
+
+ @property
+ def auth(self) -> AWSAuth:
+ """Configuration for how to authenticate into your AWS account. Exactly one of <code>role</code> or <code>creds</code> should be configured."""
+ return self._props["auth"]
+
+ @property
+ def stream_arn(self) -> str:
+ """An Amazon Resource Name specifying the Kinesis stream to deposit events into."""
+ return self._props["stream_arn"]
+
+
+[docs]class EventTargetCloudwatchLogs(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["auth"] = AWSAuth(client, props["auth"])
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EventTargetCloudwatchLogs {}>".format(self.id)
+
+ @property
+ def auth(self) -> AWSAuth:
+ """Configuration for how to authenticate into your AWS account. Exactly one of <code>role</code> or <code>creds</code> should be configured."""
+ return self._props["auth"]
+
+ @property
+ def log_group_arn(self) -> str:
+ """An Amazon Resource Name specifying the CloudWatch Logs group to deposit events into."""
+ return self._props["log_group_arn"]
+
+
+[docs]class AWSAuth(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["role"] = AWSRole(client, props["role"])
+ self._props["creds"] = AWSCredentials(client, props["creds"])
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<AWSAuth {}>".format(self.id)
+
+ @property
+ def role(self) -> AWSRole:
+ """A role for ngrok to assume on your behalf to deposit events into your AWS account."""
+ return self._props["role"]
+
+ @property
+ def creds(self) -> AWSCredentials:
+ """Credentials to your AWS account if you prefer ngrok to sign in with long-term access keys."""
+ return self._props["creds"]
+
+
+[docs]class AWSRole(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<AWSRole {}>".format(self.id)
+
+ @property
+ def role_arn(self) -> str:
+ """An ARN that specifies the role that ngrok should use to deliver to the configured target."""
+ return self._props["role_arn"]
+
+
+[docs]class AWSCredentials(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<AWSCredentials {}>".format(self.id)
+
+ @property
+ def aws_access_key_id(self) -> str:
+ """The ID portion of an AWS access key."""
+ return self._props["aws_access_key_id"]
+
+ @property
+ def aws_secret_access_key(self) -> str:
+ """The secret portion of an AWS access key."""
+ return self._props["aws_secret_access_key"]
+
+
+[docs]class IPPolicy(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<IPPolicy {}>".format(self.id)
+
+
+
+[docs] def update(
+ self,
+ description: str = None,
+ metadata: str = None,
+ ):
+ self._client.ip_policies.update(
+ id=self.id,
+ description=description,
+ metadata=metadata,
+ )
+
+ @property
+ def id(self) -> str:
+ """unique identifier for this IP policy"""
+ return self._props["id"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the IP Policy API resource"""
+ return self._props["uri"]
+
+ @property
+ def created_at(self) -> str:
+ """timestamp when the IP policy was created, RFC 3339 format"""
+ return self._props["created_at"]
+
+ @property
+ def description(self) -> str:
+ """human-readable description of the source IPs of this IP policy. optional, max 255 bytes."""
+ return self._props["description"]
+
+ @property
+ def metadata(self) -> str:
+ """arbitrary user-defined machine-readable data of this IP policy. optional, max 4096 bytes."""
+ return self._props["metadata"]
+
+ @property
+ def action(self) -> str:
+ """the IP policy action. Supported values are <code>allow</code> or <code>deny</code>"""
+ return self._props["action"]
+
+
+[docs]class IPPolicyList(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["ip_policies"] = [IPPolicy(client, x) for x in props["ip_policies"]]
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<IPPolicyList {}>".format(self.id)
+
+ def __iter__(self):
+ return PagedIterator(self._client, self, "ip_policies")
+
+ @property
+ def ip_policies(self) -> Sequence[IPPolicy]:
+ """the list of all IP policies on this account"""
+ return self._props["ip_policies"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the IP policy list API resource"""
+ return self._props["uri"]
+
+ @property
+ def next_page_uri(self) -> str:
+ """URI of the next page, or null if there is no next page"""
+ return self._props["next_page_uri"]
+
+
+[docs]class IPPolicyRule(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["ip_policy"] = Ref(client, props["ip_policy"])
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<IPPolicyRule {}>".format(self.id)
+
+
+
+[docs] def update(
+ self,
+ description: str = None,
+ metadata: str = None,
+ cidr: str = None,
+ ):
+ self._client.ip_policy_rules.update(
+ id=self.id,
+ description=description,
+ metadata=metadata,
+ cidr=cidr,
+ )
+
+ @property
+ def id(self) -> str:
+ """unique identifier for this IP policy rule"""
+ return self._props["id"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the IP policy rule API resource"""
+ return self._props["uri"]
+
+ @property
+ def created_at(self) -> str:
+ """timestamp when the IP policy rule was created, RFC 3339 format"""
+ return self._props["created_at"]
+
+ @property
+ def description(self) -> str:
+ """human-readable description of the source IPs of this IP rule. optional, max 255 bytes."""
+ return self._props["description"]
+
+ @property
+ def metadata(self) -> str:
+ """arbitrary user-defined machine-readable data of this IP policy rule. optional, max 4096 bytes."""
+ return self._props["metadata"]
+
+ @property
+ def cidr(self) -> str:
+ """an IP or IP range specified in CIDR notation. IPv4 and IPv6 are both supported."""
+ return self._props["cidr"]
+
+ @property
+ def ip_policy(self) -> Ref:
+ """object describing the IP policy this IP Policy Rule belongs to"""
+ return self._props["ip_policy"]
+
+
+[docs]class IPPolicyRuleList(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["ip_policy_rules"] = [
+ IPPolicyRule(client, x) for x in props["ip_policy_rules"]
+ ]
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<IPPolicyRuleList {}>".format(self.id)
+
+ def __iter__(self):
+ return PagedIterator(self._client, self, "ip_policy_rules")
+
+ @property
+ def ip_policy_rules(self) -> Sequence[IPPolicyRule]:
+ """the list of all IP policy rules on this account"""
+ return self._props["ip_policy_rules"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the IP policy rule list API resource"""
+ return self._props["uri"]
+
+ @property
+ def next_page_uri(self) -> str:
+ """URI of the next page, or null if there is no next page"""
+ return self._props["next_page_uri"]
+
+
+[docs]class IPRestriction(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["ip_policies"] = [Ref(client, x) for x in props["ip_policies"]]
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<IPRestriction {}>".format(self.id)
+
+
+
+ @property
+ def id(self) -> str:
+ """unique identifier for this IP restriction"""
+ return self._props["id"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the IP restriction API resource"""
+ return self._props["uri"]
+
+ @property
+ def created_at(self) -> str:
+ """timestamp when the IP restriction was created, RFC 3339 format"""
+ return self._props["created_at"]
+
+ @property
+ def description(self) -> str:
+ """human-readable description of this IP restriction. optional, max 255 bytes."""
+ return self._props["description"]
+
+ @property
+ def metadata(self) -> str:
+ """arbitrary user-defined machine-readable data of this IP restriction. optional, max 4096 bytes."""
+ return self._props["metadata"]
+
+ @property
+ def enforced(self) -> bool:
+ """true if the IP restriction will be enforce. if false, only warnings will be issued"""
+ return self._props["enforced"]
+
+ @property
+ def type(self) -> str:
+ """the type of IP restriction. this defines what traffic will be restricted with the attached policies. four values are currently supported: <code>dashboard</code>, <code>api</code>, <code>agent</code>, and <code>endpoints</code>"""
+ return self._props["type"]
+
+ @property
+ def ip_policies(self) -> Sequence[Ref]:
+ """the set of IP policies that are used to enforce the restriction"""
+ return self._props["ip_policies"]
+
+
+[docs]class IPRestrictionList(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["ip_restrictions"] = [
+ IPRestriction(client, x) for x in props["ip_restrictions"]
+ ]
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<IPRestrictionList {}>".format(self.id)
+
+ def __iter__(self):
+ return PagedIterator(self._client, self, "ip_restrictions")
+
+ @property
+ def ip_restrictions(self) -> Sequence[IPRestriction]:
+ """the list of all IP restrictions on this account"""
+ return self._props["ip_restrictions"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the IP resrtrictions list API resource"""
+ return self._props["uri"]
+
+ @property
+ def next_page_uri(self) -> str:
+ """URI of the next page, or null if there is no next page"""
+ return self._props["next_page_uri"]
+
+
+[docs]class IPWhitelistEntry(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<IPWhitelistEntry {}>".format(self.id)
+
+
+
+[docs] def update(
+ self,
+ description: str = None,
+ metadata: str = None,
+ ):
+ self._client.ip_whitelist.update(
+ id=self.id,
+ description=description,
+ metadata=metadata,
+ )
+
+ @property
+ def id(self) -> str:
+ """unique identifier for this IP whitelist entry"""
+ return self._props["id"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the IP whitelist entry API resource"""
+ return self._props["uri"]
+
+ @property
+ def created_at(self) -> str:
+ """timestamp when the IP whitelist entry was created, RFC 3339 format"""
+ return self._props["created_at"]
+
+ @property
+ def description(self) -> str:
+ """human-readable description of the source IPs for this IP whitelist entry. optional, max 255 bytes."""
+ return self._props["description"]
+
+ @property
+ def metadata(self) -> str:
+ """arbitrary user-defined machine-readable data of this IP whitelist entry. optional, max 4096 bytes."""
+ return self._props["metadata"]
+
+ @property
+ def ip_net(self) -> str:
+ """an IP address or IP network range in CIDR notation (e.g. 10.1.1.1 or 10.1.0.0/16) of addresses that will be whitelisted to communicate with your tunnel endpoints"""
+ return self._props["ip_net"]
+
+
+[docs]class IPWhitelistEntryList(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["whitelist"] = [
+ IPWhitelistEntry(client, x) for x in props["whitelist"]
+ ]
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<IPWhitelistEntryList {}>".format(self.id)
+
+ def __iter__(self):
+ return PagedIterator(self._client, self, "whitelist")
+
+ @property
+ def whitelist(self) -> Sequence[IPWhitelistEntry]:
+ """the list of all IP whitelist entries on this account"""
+ return self._props["whitelist"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the IP whitelist API resource"""
+ return self._props["uri"]
+
+ @property
+ def next_page_uri(self) -> str:
+ """URI of the next page, or null if there is no next page"""
+ return self._props["next_page_uri"]
+
+
+[docs]class EndpointConfiguration(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["circuit_breaker"] = EndpointCircuitBreaker(
+ client, props["circuit_breaker"]
+ )
+ self._props["compression"] = EndpointCompression(client, props["compression"])
+ self._props["request_headers"] = EndpointRequestHeaders(
+ client, props["request_headers"]
+ )
+ self._props["response_headers"] = EndpointResponseHeaders(
+ client, props["response_headers"]
+ )
+ self._props["ip_policy"] = EndpointIPPolicy(client, props["ip_policy"])
+ self._props["mutual_tls"] = EndpointMutualTLS(client, props["mutual_tls"])
+ self._props["tls_termination"] = EndpointTLSTermination(
+ client, props["tls_termination"]
+ )
+ self._props["webhook_validation"] = EndpointWebhookValidation(
+ client, props["webhook_validation"]
+ )
+ self._props["oauth"] = EndpointOAuth(client, props["oauth"])
+ self._props["logging"] = EndpointLogging(client, props["logging"])
+ self._props["saml"] = EndpointSAML(client, props["saml"])
+ self._props["oidc"] = EndpointOIDC(client, props["oidc"])
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EndpointConfiguration {}>".format(self.id)
+
+
+
+[docs] def update(
+ self,
+ description: str = None,
+ metadata: str = None,
+ circuit_breaker: EndpointCircuitBreaker = None,
+ compression: EndpointCompression = None,
+ request_headers: EndpointRequestHeaders = None,
+ response_headers: EndpointResponseHeaders = None,
+ ip_policy: EndpointIPPolicyMutate = None,
+ mutual_tls: EndpointMutualTLSMutate = None,
+ tls_termination: EndpointTLSTermination = None,
+ webhook_validation: EndpointWebhookValidation = None,
+ oauth: EndpointOAuth = None,
+ logging: EndpointLoggingMutate = None,
+ saml: EndpointSAMLMutate = None,
+ oidc: EndpointOIDC = None,
+ ):
+ self._client.endpoint_configurations.update(
+ id=self.id,
+ description=description,
+ metadata=metadata,
+ circuit_breaker=circuit_breaker,
+ compression=compression,
+ request_headers=request_headers,
+ response_headers=response_headers,
+ ip_policy=ip_policy,
+ mutual_tls=mutual_tls,
+ tls_termination=tls_termination,
+ webhook_validation=webhook_validation,
+ oauth=oauth,
+ logging=logging,
+ saml=saml,
+ oidc=oidc,
+ )
+
+ @property
+ def id(self) -> str:
+ """unique identifier of this endpoint configuration"""
+ return self._props["id"]
+
+ @property
+ def type(self) -> str:
+ """they type of traffic this endpoint configuration can be applied to. one of: <code>http</code>, <code>https</code>, <code>tcp</code>"""
+ return self._props["type"]
+
+ @property
+ def description(self) -> str:
+ """human-readable description of what this endpoint configuration will be do when applied or what traffic it will be applied to. Optional, max 255 bytes"""
+ return self._props["description"]
+
+ @property
+ def metadata(self) -> str:
+ """arbitrary user-defined machine-readable data of this endpoint configuration. Optional, max 4096 bytes."""
+ return self._props["metadata"]
+
+ @property
+ def created_at(self) -> str:
+ """timestamp when the endpoint configuration was created, RFC 3339 format"""
+ return self._props["created_at"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the endpoint configuration API resource"""
+ return self._props["uri"]
+
+ @property
+ def circuit_breaker(self) -> EndpointCircuitBreaker:
+ """circuit breaker module configuration or <code>null</code>"""
+ return self._props["circuit_breaker"]
+
+ @property
+ def compression(self) -> EndpointCompression:
+ """compression module configuration or <code>null</code>"""
+ return self._props["compression"]
+
+ @property
+ def request_headers(self) -> EndpointRequestHeaders:
+ """request headers module configuration or <code>null</code>"""
+ return self._props["request_headers"]
+
+ @property
+ def response_headers(self) -> EndpointResponseHeaders:
+ """response headers module configuration or <code>null</code>"""
+ return self._props["response_headers"]
+
+ @property
+ def ip_policy(self) -> EndpointIPPolicy:
+ """ip policy module configuration or <code>null</code>"""
+ return self._props["ip_policy"]
+
+ @property
+ def mutual_tls(self) -> EndpointMutualTLS:
+ """mutual TLS module configuration or <code>null</code>"""
+ return self._props["mutual_tls"]
+
+ @property
+ def tls_termination(self) -> EndpointTLSTermination:
+ """TLS termination module configuration or <code>null</code>"""
+ return self._props["tls_termination"]
+
+ @property
+ def webhook_validation(self) -> EndpointWebhookValidation:
+ """webhook validation module configuration or <code>null</code>"""
+ return self._props["webhook_validation"]
+
+ @property
+ def oauth(self) -> EndpointOAuth:
+ """oauth module configuration or <code>null</code>"""
+ return self._props["oauth"]
+
+ @property
+ def logging(self) -> EndpointLogging:
+ """logging module configuration or <code>null</code>"""
+ return self._props["logging"]
+
+ @property
+ def saml(self) -> EndpointSAML:
+ """saml module configuration or <code>null</code>"""
+ return self._props["saml"]
+
+ @property
+ def oidc(self) -> EndpointOIDC:
+ """oidc module configuration or <code>null</code>"""
+ return self._props["oidc"]
+
+
+[docs]class EndpointConfigurationList(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["endpoint_configurations"] = [
+ EndpointConfiguration(client, x) for x in props["endpoint_configurations"]
+ ]
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EndpointConfigurationList {}>".format(self.id)
+
+ def __iter__(self):
+ return PagedIterator(self._client, self, "endpoint_configurations")
+
+ @property
+ def endpoint_configurations(self) -> Sequence[EndpointConfiguration]:
+ """the list of all endpoint configurations on this account"""
+ return self._props["endpoint_configurations"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the endpoint configurations list API resource"""
+ return self._props["uri"]
+
+ @property
+ def next_page_uri(self) -> str:
+ """URI of the next page, or null if there is no next page"""
+ return self._props["next_page_uri"]
+
+
+[docs]class EndpointWebhookValidation(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EndpointWebhookValidation {}>".format(self.id)
+
+ @property
+ def enabled(self) -> bool:
+ """<code>true</code> if the module will be applied to traffic, <code>false</code> to disable. default <code>true</code> if unspecified"""
+ return self._props["enabled"]
+
+ @property
+ def provider(self) -> str:
+ """a string indicating which webhook provider will be sending webhooks to this endpoint. Value must be one of the supported providers: <code>SLACK</code>, <code>SNS</code>, <code>STRIPE</code>, <code>GITHUB</code>, <code>TWILIO</code>, <code>SHOPIFY</code>, <code>GITLAB</code>, <code>INTERCOM</code>."""
+ return self._props["provider"]
+
+ @property
+ def secret(self) -> str:
+ """a string secret used to validate requests from the given provider. All providers except AWS SNS require a secret"""
+ return self._props["secret"]
+
+
+[docs]class EndpointCompression(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EndpointCompression {}>".format(self.id)
+
+ @property
+ def enabled(self) -> bool:
+ """<code>true</code> if the module will be applied to traffic, <code>false</code> to disable. default <code>true</code> if unspecified"""
+ return self._props["enabled"]
+
+
+[docs]class EndpointMutualTLS(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["certificate_authorities"] = [
+ Ref(client, x) for x in props["certificate_authorities"]
+ ]
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EndpointMutualTLS {}>".format(self.id)
+
+ @property
+ def enabled(self) -> bool:
+ """<code>true</code> if the module will be applied to traffic, <code>false</code> to disable. default <code>true</code> if unspecified"""
+ return self._props["enabled"]
+
+ @property
+ def certificate_authorities(self) -> Sequence[Ref]:
+ """PEM-encoded CA certificates that will be used to validate. Multiple CAs may be provided by concatenating them together."""
+ return self._props["certificate_authorities"]
+
+
+[docs]class EndpointMutualTLSMutate(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EndpointMutualTLSMutate {}>".format(self.id)
+
+ @property
+ def enabled(self) -> bool:
+ """<code>true</code> if the module will be applied to traffic, <code>false</code> to disable. default <code>true</code> if unspecified"""
+ return self._props["enabled"]
+
+ @property
+ def certificate_authority_ids(self) -> Sequence[str]:
+ """list of certificate authorities that will be used to validate the TLS client certificate presnted by the initiatiator of the TLS connection"""
+ return self._props["certificate_authority_ids"]
+
+
+[docs]class EndpointTLSTermination(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EndpointTLSTermination {}>".format(self.id)
+
+ @property
+ def enabled(self) -> bool:
+ """<code>true</code> if the module will be applied to traffic, <code>false</code> to disable. default <code>true</code> if unspecified"""
+ return self._props["enabled"]
+
+ @property
+ def terminate_at(self) -> str:
+ """<code>edge</code> if the ngrok edge should terminate TLS traffic, <code>upstream</code> if TLS traffic should be passed through to the upstream ngrok agent / application server for termination. if <code>upstream</code> is chosen, most other modules will be disallowed because they rely on the ngrok edge being able to access the underlying traffic."""
+ return self._props["terminate_at"]
+
+ @property
+ def min_version(self) -> str:
+ """The minimum TLS version used for termination and advertised to the client during the TLS handshake. if unspecified, ngrok will choose an industry-safe default. This value must be null if <code>terminate_at</code> is set to <code>upstream</code>."""
+ return self._props["min_version"]
+
+
+[docs]class EndpointLogging(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["event_streams"] = [Ref(client, x) for x in props["event_streams"]]
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EndpointLogging {}>".format(self.id)
+
+ @property
+ def enabled(self) -> bool:
+ """<code>true</code> if the module will be applied to traffic, <code>false</code> to disable. default <code>true</code> if unspecified"""
+ return self._props["enabled"]
+
+ @property
+ def event_streams(self) -> Sequence[Ref]:
+ """list of all EventStreams that will be used to configure and export this endpoint's logs"""
+ return self._props["event_streams"]
+
+
+[docs]class EndpointLoggingMutate(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EndpointLoggingMutate {}>".format(self.id)
+
+ @property
+ def enabled(self) -> bool:
+ """<code>true</code> if the module will be applied to traffic, <code>false</code> to disable. default <code>true</code> if unspecified"""
+ return self._props["enabled"]
+
+ @property
+ def event_stream_ids(self) -> Sequence[str]:
+ """list of all EventStreams that will be used to configure and export this endpoint's logs"""
+ return self._props["event_stream_ids"]
+
+
+[docs]class EndpointRequestHeaders(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EndpointRequestHeaders {}>".format(self.id)
+
+ @property
+ def enabled(self) -> bool:
+ """<code>true</code> if the module will be applied to traffic, <code>false</code> to disable. default <code>true</code> if unspecified"""
+ return self._props["enabled"]
+
+ @property
+ def add(self) -> Mapping[str, str]:
+ """a map of header key to header value that will be injected into the HTTP Request before being sent to the upstream application server"""
+ return self._props["add"]
+
+ @property
+ def remove(self) -> Sequence[str]:
+ """a list of header names that will be removed from the HTTP Request before being sent to the upstream application server"""
+ return self._props["remove"]
+
+
+[docs]class EndpointResponseHeaders(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EndpointResponseHeaders {}>".format(self.id)
+
+ @property
+ def enabled(self) -> bool:
+ """<code>true</code> if the module will be applied to traffic, <code>false</code> to disable. default <code>true</code> if unspecified"""
+ return self._props["enabled"]
+
+ @property
+ def add(self) -> Mapping[str, str]:
+ """a map of header key to header value that will be injected into the HTTP Response returned to the HTTP client"""
+ return self._props["add"]
+
+ @property
+ def remove(self) -> Sequence[str]:
+ """a list of header names that will be removed from the HTTP Response returned to the HTTP client"""
+ return self._props["remove"]
+
+
+[docs]class EndpointIPPolicy(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["ip_policies"] = [Ref(client, x) for x in props["ip_policies"]]
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EndpointIPPolicy {}>".format(self.id)
+
+ @property
+ def enabled(self) -> bool:
+ """<code>true</code> if the module will be applied to traffic, <code>false</code> to disable. default <code>true</code> if unspecified"""
+ return self._props["enabled"]
+
+ @property
+ def ip_policies(self) -> Sequence[Ref]:
+ return self._props["ip_policies"]
+
+
+[docs]class EndpointIPPolicyMutate(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EndpointIPPolicyMutate {}>".format(self.id)
+
+ @property
+ def enabled(self) -> bool:
+ """<code>true</code> if the module will be applied to traffic, <code>false</code> to disable. default <code>true</code> if unspecified"""
+ return self._props["enabled"]
+
+ @property
+ def ip_policy_ids(self) -> Sequence[str]:
+ """list of all IP policies that will be used to check if a source IP is allowed access to the endpoint"""
+ return self._props["ip_policy_ids"]
+
+
+[docs]class EndpointCircuitBreaker(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EndpointCircuitBreaker {}>".format(self.id)
+
+ @property
+ def enabled(self) -> bool:
+ """<code>true</code> if the module will be applied to traffic, <code>false</code> to disable. default <code>true</code> if unspecified"""
+ return self._props["enabled"]
+
+ @property
+ def tripped_duration(self) -> int:
+ """Integer number of seconds after which the circuit is tripped to wait before re-evaluating upstream health"""
+ return self._props["tripped_duration"]
+
+ @property
+ def rolling_window(self) -> int:
+ """Integer number of seconds in the statistical rolling window that metrics are retained for."""
+ return self._props["rolling_window"]
+
+ @property
+ def num_buckets(self) -> int:
+ """Integer number of buckets into which metrics are retained. Max 128."""
+ return self._props["num_buckets"]
+
+ @property
+ def volume_threshold(self) -> int:
+ """Integer number of requests in a rolling window that will trip the circuit. Helpful if traffic volume is low."""
+ return self._props["volume_threshold"]
+
+ @property
+ def error_threshold_percentage(self) -> float:
+ """Error threshold percentage should be between 0 - 1.0, not 0-100.0"""
+ return self._props["error_threshold_percentage"]
+
+
+[docs]class EndpointOAuth(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["provider"] = EndpointOAuthProvider(client, props["provider"])
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EndpointOAuth {}>".format(self.id)
+
+ @property
+ def enabled(self) -> bool:
+ """<code>true</code> if the module will be applied to traffic, <code>false</code> to disable. default <code>true</code> if unspecified"""
+ return self._props["enabled"]
+
+ @property
+ def provider(self) -> EndpointOAuthProvider:
+ """an object which defines the identity provider to use for authentication and configuration for who may access the endpoint"""
+ return self._props["provider"]
+
+ @property
+ def options_passthrough(self) -> bool:
+ """Do not enforce authentication on HTTP OPTIONS requests. necessary if you are supporting CORS."""
+ return self._props["options_passthrough"]
+
+ @property
+ def cookie_prefix(self) -> str:
+ """the prefix of the session cookie that ngrok sets on the http client to cache authentication. default is 'ngrok.'"""
+ return self._props["cookie_prefix"]
+
+ @property
+ def inactivity_timeout(self) -> int:
+ """Integer number of seconds of inactivity after which if the user has not accessed the endpoint, their session will time out and they will be forced to reauthenticate."""
+ return self._props["inactivity_timeout"]
+
+ @property
+ def maximum_duration(self) -> int:
+ """Integer number of seconds of the maximum duration of an authenticated session. After this period is exceeded, a user must reauthenticate."""
+ return self._props["maximum_duration"]
+
+ @property
+ def auth_check_interval(self) -> int:
+ """Integer number of seconds after which ngrok guarantees it will refresh user state from the identity provider and recheck whether the user is still authorized to access the endpoint. This is the preferred tunable to use to enforce a minimum amount of time after which a revoked user will no longer be able to access the resource."""
+ return self._props["auth_check_interval"]
+
+
+[docs]class EndpointOAuthProvider(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["github"] = EndpointOAuthGitHub(client, props["github"])
+ self._props["facebook"] = EndpointOAuthFacebook(client, props["facebook"])
+ self._props["microsoft"] = EndpointOAuthMicrosoft(client, props["microsoft"])
+ self._props["google"] = EndpointOAuthGoogle(client, props["google"])
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EndpointOAuthProvider {}>".format(self.id)
+
+ @property
+ def github(self) -> EndpointOAuthGitHub:
+ """configuration for using github as the identity provider"""
+ return self._props["github"]
+
+ @property
+ def facebook(self) -> EndpointOAuthFacebook:
+ """configuration for using facebook as the identity provider"""
+ return self._props["facebook"]
+
+ @property
+ def microsoft(self) -> EndpointOAuthMicrosoft:
+ """configuration for using microsoft as the identity provider"""
+ return self._props["microsoft"]
+
+ @property
+ def google(self) -> EndpointOAuthGoogle:
+ """configuration for using google as the identity provider"""
+ return self._props["google"]
+
+
+[docs]class EndpointOAuthGitHub(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EndpointOAuthGitHub {}>".format(self.id)
+
+ @property
+ def client_id(self) -> str:
+ """the OAuth app client ID. retrieve it from the identity provider's dashboard where you created your own OAuth app. optional. if unspecified, ngrok will use its own managed oauth application which has additional restrictions. see the OAuth module docs for more details. if present, client_secret must be present as well."""
+ return self._props["client_id"]
+
+ @property
+ def client_secret(self) -> str:
+ """the OAuth app client secret. retrieve if from the identity provider's dashboard where you created your own OAuth app. optional, see all of the caveats in the docs for <code>client_id</code>."""
+ return self._props["client_secret"]
+
+ @property
+ def scopes(self) -> Sequence[str]:
+ """a list of provider-specific OAuth scopes with the permissions your OAuth app would like to ask for. these may not be set if you are using the ngrok-managed oauth app (i.e. you must pass both <code>client_id</code> and <code>client_secret</code> to set scopes)"""
+ return self._props["scopes"]
+
+ @property
+ def email_addresses(self) -> Sequence[str]:
+ """a list of email addresses of users authenticated by identity provider who are allowed access to the endpoint"""
+ return self._props["email_addresses"]
+
+ @property
+ def email_domains(self) -> Sequence[str]:
+ """a list of email domains of users authenticated by identity provider who are allowed access to the endpoint"""
+ return self._props["email_domains"]
+
+ @property
+ def teams(self) -> Sequence[str]:
+ """a list of github teams identifiers. users will be allowed access to the endpoint if they are a member of any of these teams. identifiers should be in the 'slug' format qualified with the org name, e.g. <code>org-name/team-name</code>"""
+ return self._props["teams"]
+
+ @property
+ def organizations(self) -> Sequence[str]:
+ """a list of github org identifiers. users who are members of any of the listed organizations will be allowed access. identifiers should be the organization's 'slug'"""
+ return self._props["organizations"]
+
+
+[docs]class EndpointOAuthFacebook(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EndpointOAuthFacebook {}>".format(self.id)
+
+ @property
+ def client_id(self) -> str:
+ """the OAuth app client ID. retrieve it from the identity provider's dashboard where you created your own OAuth app. optional. if unspecified, ngrok will use its own managed oauth application which has additional restrictions. see the OAuth module docs for more details. if present, client_secret must be present as well."""
+ return self._props["client_id"]
+
+ @property
+ def client_secret(self) -> str:
+ """the OAuth app client secret. retrieve if from the identity provider's dashboard where you created your own OAuth app. optional, see all of the caveats in the docs for <code>client_id</code>."""
+ return self._props["client_secret"]
+
+ @property
+ def scopes(self) -> Sequence[str]:
+ """a list of provider-specific OAuth scopes with the permissions your OAuth app would like to ask for. these may not be set if you are using the ngrok-managed oauth app (i.e. you must pass both <code>client_id</code> and <code>client_secret</code> to set scopes)"""
+ return self._props["scopes"]
+
+ @property
+ def email_addresses(self) -> Sequence[str]:
+ """a list of email addresses of users authenticated by identity provider who are allowed access to the endpoint"""
+ return self._props["email_addresses"]
+
+ @property
+ def email_domains(self) -> Sequence[str]:
+ """a list of email domains of users authenticated by identity provider who are allowed access to the endpoint"""
+ return self._props["email_domains"]
+
+
+[docs]class EndpointOAuthMicrosoft(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EndpointOAuthMicrosoft {}>".format(self.id)
+
+ @property
+ def client_id(self) -> str:
+ """the OAuth app client ID. retrieve it from the identity provider's dashboard where you created your own OAuth app. optional. if unspecified, ngrok will use its own managed oauth application which has additional restrictions. see the OAuth module docs for more details. if present, client_secret must be present as well."""
+ return self._props["client_id"]
+
+ @property
+ def client_secret(self) -> str:
+ """the OAuth app client secret. retrieve if from the identity provider's dashboard where you created your own OAuth app. optional, see all of the caveats in the docs for <code>client_id</code>."""
+ return self._props["client_secret"]
+
+ @property
+ def scopes(self) -> Sequence[str]:
+ """a list of provider-specific OAuth scopes with the permissions your OAuth app would like to ask for. these may not be set if you are using the ngrok-managed oauth app (i.e. you must pass both <code>client_id</code> and <code>client_secret</code> to set scopes)"""
+ return self._props["scopes"]
+
+ @property
+ def email_addresses(self) -> Sequence[str]:
+ """a list of email addresses of users authenticated by identity provider who are allowed access to the endpoint"""
+ return self._props["email_addresses"]
+
+ @property
+ def email_domains(self) -> Sequence[str]:
+ """a list of email domains of users authenticated by identity provider who are allowed access to the endpoint"""
+ return self._props["email_domains"]
+
+
+[docs]class EndpointOAuthGoogle(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EndpointOAuthGoogle {}>".format(self.id)
+
+ @property
+ def client_id(self) -> str:
+ """the OAuth app client ID. retrieve it from the identity provider's dashboard where you created your own OAuth app. optional. if unspecified, ngrok will use its own managed oauth application which has additional restrictions. see the OAuth module docs for more details. if present, client_secret must be present as well."""
+ return self._props["client_id"]
+
+ @property
+ def client_secret(self) -> str:
+ """the OAuth app client secret. retrieve if from the identity provider's dashboard where you created your own OAuth app. optional, see all of the caveats in the docs for <code>client_id</code>."""
+ return self._props["client_secret"]
+
+ @property
+ def scopes(self) -> Sequence[str]:
+ """a list of provider-specific OAuth scopes with the permissions your OAuth app would like to ask for. these may not be set if you are using the ngrok-managed oauth app (i.e. you must pass both <code>client_id</code> and <code>client_secret</code> to set scopes)"""
+ return self._props["scopes"]
+
+ @property
+ def email_addresses(self) -> Sequence[str]:
+ """a list of email addresses of users authenticated by identity provider who are allowed access to the endpoint"""
+ return self._props["email_addresses"]
+
+ @property
+ def email_domains(self) -> Sequence[str]:
+ """a list of email domains of users authenticated by identity provider who are allowed access to the endpoint"""
+ return self._props["email_domains"]
+
+
+[docs]class EndpointSAML(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EndpointSAML {}>".format(self.id)
+
+ @property
+ def enabled(self) -> bool:
+ """<code>true</code> if the module will be applied to traffic, <code>false</code> to disable. default <code>true</code> if unspecified"""
+ return self._props["enabled"]
+
+ @property
+ def options_passthrough(self) -> bool:
+ """Do not enforce authentication on HTTP OPTIONS requests. necessary if you are supporting CORS."""
+ return self._props["options_passthrough"]
+
+ @property
+ def cookie_prefix(self) -> str:
+ """the prefix of the session cookie that ngrok sets on the http client to cache authentication. default is 'ngrok.'"""
+ return self._props["cookie_prefix"]
+
+ @property
+ def inactivity_timeout(self) -> int:
+ """Integer number of seconds of inactivity after which if the user has not accessed the endpoint, their session will time out and they will be forced to reauthenticate."""
+ return self._props["inactivity_timeout"]
+
+ @property
+ def maximum_duration(self) -> int:
+ """Integer number of seconds of the maximum duration of an authenticated session. After this period is exceeded, a user must reauthenticate."""
+ return self._props["maximum_duration"]
+
+ @property
+ def idp_metadata(self) -> str:
+ """The full XML IdP EntityDescriptor. Your IdP may provide this to you as a a file to download or as a URL."""
+ return self._props["idp_metadata"]
+
+ @property
+ def force_authn(self) -> bool:
+ """If true, indicates that whenever we redirect a user to the IdP for authentication that the IdP must prompt the user for authentication credentials even if the user already has a valid session with the IdP."""
+ return self._props["force_authn"]
+
+ @property
+ def allow_idp_initiated(self) -> bool:
+ """If true, the IdP may initiate a login directly (e.g. the user does not need to visit the endpoint first and then be redirected). The IdP should set the <code>RelayState</code> parameter to the target URL of the resource they want the user to be redirected to after the SAML login assertion has been processed."""
+ return self._props["allow_idp_initiated"]
+
+ @property
+ def authorized_groups(self) -> Sequence[str]:
+ """If present, only users who are a member of one of the listed groups may access the target endpoint."""
+ return self._props["authorized_groups"]
+
+ @property
+ def entity_id(self) -> str:
+ """The SP Entity's unique ID. This always takes the form of a URL. In ngrok's implementation, this URL is the same as the metadata URL. This will need to be specified to the IdP as configuration."""
+ return self._props["entity_id"]
+
+ @property
+ def assertion_consumer_service_url(self) -> str:
+ """The public URL of the SP's Assertion Consumer Service. This is where the IdP will redirect to during an authentication flow. This will need to be specified to the IdP as configuration."""
+ return self._props["assertion_consumer_service_url"]
+
+ @property
+ def single_logout_url(self) -> str:
+ """The public URL of the SP's Single Logout Service. This is where the IdP will redirect to during a single logout flow. This will optionally need to be specified to the IdP as configuration."""
+ return self._props["single_logout_url"]
+
+ @property
+ def request_signing_certificate_pem(self) -> str:
+ """PEM-encoded x.509 certificate of the key pair that is used to sign all SAML requests that the ngrok SP makes to the IdP. Many IdPs do not support request signing verification, but we highly recommend specifying this in the IdP's configuration if it is supported."""
+ return self._props["request_signing_certificate_pem"]
+
+ @property
+ def metadata_url(self) -> str:
+ """A public URL where the SP's metadata is hosted. If an IdP supports dynamic configuration, this is the URL it can use to retrieve the SP metadata."""
+ return self._props["metadata_url"]
+
+
+[docs]class EndpointSAMLMutate(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EndpointSAMLMutate {}>".format(self.id)
+
+ @property
+ def enabled(self) -> bool:
+ """<code>true</code> if the module will be applied to traffic, <code>false</code> to disable. default <code>true</code> if unspecified"""
+ return self._props["enabled"]
+
+ @property
+ def options_passthrough(self) -> bool:
+ """Do not enforce authentication on HTTP OPTIONS requests. necessary if you are supporting CORS."""
+ return self._props["options_passthrough"]
+
+ @property
+ def cookie_prefix(self) -> str:
+ """the prefix of the session cookie that ngrok sets on the http client to cache authentication. default is 'ngrok.'"""
+ return self._props["cookie_prefix"]
+
+ @property
+ def inactivity_timeout(self) -> int:
+ """Integer number of seconds of inactivity after which if the user has not accessed the endpoint, their session will time out and they will be forced to reauthenticate."""
+ return self._props["inactivity_timeout"]
+
+ @property
+ def maximum_duration(self) -> int:
+ """Integer number of seconds of the maximum duration of an authenticated session. After this period is exceeded, a user must reauthenticate."""
+ return self._props["maximum_duration"]
+
+ @property
+ def idp_metadata(self) -> str:
+ """The full XML IdP EntityDescriptor. Your IdP may provide this to you as a a file to download or as a URL."""
+ return self._props["idp_metadata"]
+
+ @property
+ def force_authn(self) -> bool:
+ """If true, indicates that whenever we redirect a user to the IdP for authentication that the IdP must prompt the user for authentication credentials even if the user already has a valid session with the IdP."""
+ return self._props["force_authn"]
+
+ @property
+ def allow_idp_initiated(self) -> bool:
+ """If true, the IdP may initiate a login directly (e.g. the user does not need to visit the endpoint first and then be redirected). The IdP should set the <code>RelayState</code> parameter to the target URL of the resource they want the user to be redirected to after the SAML login assertion has been processed."""
+ return self._props["allow_idp_initiated"]
+
+ @property
+ def authorized_groups(self) -> Sequence[str]:
+ """If present, only users who are a member of one of the listed groups may access the target endpoint."""
+ return self._props["authorized_groups"]
+
+
+[docs]class EndpointOIDC(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<EndpointOIDC {}>".format(self.id)
+
+ @property
+ def enabled(self) -> bool:
+ """<code>true</code> if the module will be applied to traffic, <code>false</code> to disable. default <code>true</code> if unspecified"""
+ return self._props["enabled"]
+
+ @property
+ def options_passthrough(self) -> bool:
+ """Do not enforce authentication on HTTP OPTIONS requests. necessary if you are supporting CORS."""
+ return self._props["options_passthrough"]
+
+ @property
+ def cookie_prefix(self) -> str:
+ """the prefix of the session cookie that ngrok sets on the http client to cache authentication. default is 'ngrok.'"""
+ return self._props["cookie_prefix"]
+
+ @property
+ def inactivity_timeout(self) -> int:
+ """Integer number of seconds of inactivity after which if the user has not accessed the endpoint, their session will time out and they will be forced to reauthenticate."""
+ return self._props["inactivity_timeout"]
+
+ @property
+ def maximum_duration(self) -> int:
+ """Integer number of seconds of the maximum duration of an authenticated session. After this period is exceeded, a user must reauthenticate."""
+ return self._props["maximum_duration"]
+
+ @property
+ def issuer(self) -> str:
+ """URL of the OIDC "OpenID provider". This is the base URL used for discovery."""
+ return self._props["issuer"]
+
+ @property
+ def client_id(self) -> str:
+ """The OIDC app's client ID and OIDC audience."""
+ return self._props["client_id"]
+
+ @property
+ def client_secret(self) -> str:
+ """The OIDC app's client secret."""
+ return self._props["client_secret"]
+
+ @property
+ def scopes(self) -> Sequence[str]:
+ """The set of scopes to request from the OIDC identity provider."""
+ return self._props["scopes"]
+
+
+[docs]class ReservedAddr(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["endpoint_configuration"] = Ref(
+ client, props["endpoint_configuration"]
+ )
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<ReservedAddr {}>".format(self.id)
+
+
+
+ @property
+ def id(self) -> str:
+ """unique reserved address resource identifier"""
+ return self._props["id"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the reserved address API resource"""
+ return self._props["uri"]
+
+ @property
+ def created_at(self) -> str:
+ """timestamp when the reserved address was created, RFC 3339 format"""
+ return self._props["created_at"]
+
+ @property
+ def description(self) -> str:
+ """human-readable description of what this reserved address will be used for"""
+ return self._props["description"]
+
+ @property
+ def metadata(self) -> str:
+ """arbitrary user-defined machine-readable data of this reserved address. Optional, max 4096 bytes."""
+ return self._props["metadata"]
+
+ @property
+ def addr(self) -> str:
+ """hostname:port of the reserved address that was assigned at creation time"""
+ return self._props["addr"]
+
+ @property
+ def region(self) -> str:
+ """reserve the address in this geographic ngrok datacenter. Optional, default is us. (au, eu, ap, us, jp, in, sa)"""
+ return self._props["region"]
+
+ @property
+ def endpoint_configuration(self) -> Ref:
+ """object reference to the endpoint configuration that will be applied to traffic to this address"""
+ return self._props["endpoint_configuration"]
+
+
+[docs]class ReservedAddrList(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["reserved_addrs"] = [
+ ReservedAddr(client, x) for x in props["reserved_addrs"]
+ ]
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<ReservedAddrList {}>".format(self.id)
+
+ def __iter__(self):
+ return PagedIterator(self._client, self, "reserved_addrs")
+
+ @property
+ def reserved_addrs(self) -> Sequence[ReservedAddr]:
+ """the list of all reserved addresses on this account"""
+ return self._props["reserved_addrs"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the reserved address list API resource"""
+ return self._props["uri"]
+
+ @property
+ def next_page_uri(self) -> str:
+ """URI of the next page, or null if there is no next page"""
+ return self._props["next_page_uri"]
+
+
+[docs]class ReservedDomain(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["http_endpoint_configuration"] = Ref(
+ client, props["http_endpoint_configuration"]
+ )
+ self._props["https_endpoint_configuration"] = Ref(
+ client, props["https_endpoint_configuration"]
+ )
+ self._props["certificate"] = Ref(client, props["certificate"])
+ self._props["certificate_management_policy"] = ReservedDomainCertPolicy(
+ client, props["certificate_management_policy"]
+ )
+ self._props["certificate_management_status"] = ReservedDomainCertStatus(
+ client, props["certificate_management_status"]
+ )
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<ReservedDomain {}>".format(self.id)
+
+
+
+ @property
+ def id(self) -> str:
+ """unique reserved domain resource identifier"""
+ return self._props["id"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the reserved domain API resource"""
+ return self._props["uri"]
+
+ @property
+ def created_at(self) -> str:
+ """timestamp when the reserved domain was created, RFC 3339 format"""
+ return self._props["created_at"]
+
+ @property
+ def description(self) -> str:
+ """human-readable description of what this reserved domain will be used for"""
+ return self._props["description"]
+
+ @property
+ def metadata(self) -> str:
+ """arbitrary user-defined machine-readable data of this reserved domain. Optional, max 4096 bytes."""
+ return self._props["metadata"]
+
+ @property
+ def domain(self) -> str:
+ """hostname of the reserved domain"""
+ return self._props["domain"]
+
+ @property
+ def region(self) -> str:
+ """reserve the domain in this geographic ngrok datacenter. Optional, default is us. (au, eu, ap, us, jp, in, sa)"""
+ return self._props["region"]
+
+ @property
+ def cname_target(self) -> str:
+ """DNS CNAME target for a custom hostname, or null if the reserved domain is a subdomain of *.ngrok.io"""
+ return self._props["cname_target"]
+
+ @property
+ def http_endpoint_configuration(self) -> Ref:
+ """object referencing the endpoint configuration applied to http traffic on this domain"""
+ return self._props["http_endpoint_configuration"]
+
+ @property
+ def https_endpoint_configuration(self) -> Ref:
+ """object referencing the endpoint configuration applied to https traffic on this domain"""
+ return self._props["https_endpoint_configuration"]
+
+ @property
+ def certificate(self) -> Ref:
+ """object referencing the TLS certificate used for connections to this domain. This can be either a user-uploaded certificate, the most recently issued automatic one, or null otherwise."""
+ return self._props["certificate"]
+
+ @property
+ def certificate_management_policy(self) -> ReservedDomainCertPolicy:
+ """configuration for automatic management of TLS certificates for this domain, or null if automatic management is disabled"""
+ return self._props["certificate_management_policy"]
+
+ @property
+ def certificate_management_status(self) -> ReservedDomainCertStatus:
+ """status of the automatic certificate management for this domain, or null if automatic management is disabled"""
+ return self._props["certificate_management_status"]
+
+
+[docs]class ReservedDomainList(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["reserved_domains"] = [
+ ReservedDomain(client, x) for x in props["reserved_domains"]
+ ]
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<ReservedDomainList {}>".format(self.id)
+
+ def __iter__(self):
+ return PagedIterator(self._client, self, "reserved_domains")
+
+ @property
+ def reserved_domains(self) -> Sequence[ReservedDomain]:
+ """the list of all reserved domains on this account"""
+ return self._props["reserved_domains"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the reserved domain list API resource"""
+ return self._props["uri"]
+
+ @property
+ def next_page_uri(self) -> str:
+ """URI of the next page, or null if there is no next page"""
+ return self._props["next_page_uri"]
+
+
+[docs]class ReservedDomainCertPolicy(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<ReservedDomainCertPolicy {}>".format(self.id)
+
+ @property
+ def authority(self) -> str:
+ """certificate authority to request certificates from. The only supported value is letsencrypt."""
+ return self._props["authority"]
+
+ @property
+ def private_key_type(self) -> str:
+ """type of private key to use when requesting certificates. Defaults to rsa, can be either rsa or ecdsa."""
+ return self._props["private_key_type"]
+
+
+[docs]class ReservedDomainCertStatus(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["provisioning_job"] = ReservedDomainCertJob(
+ client, props["provisioning_job"]
+ )
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<ReservedDomainCertStatus {}>".format(self.id)
+
+ @property
+ def renews_at(self) -> str:
+ """timestamp when the next renewal will be requested, RFC 3339 format"""
+ return self._props["renews_at"]
+
+ @property
+ def provisioning_job(self) -> ReservedDomainCertJob:
+ """status of the certificate provisioning job, or null if the certificiate isn't being provisioned or renewed"""
+ return self._props["provisioning_job"]
+
+
+[docs]class ReservedDomainCertNSTarget(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<ReservedDomainCertNSTarget {}>".format(self.id)
+
+ @property
+ def zone(self) -> str:
+ """the zone that the nameservers need to be applied to"""
+ return self._props["zone"]
+
+ @property
+ def nameservers(self) -> Sequence[str]:
+ """the nameservers the user must add"""
+ return self._props["nameservers"]
+
+
+[docs]class ReservedDomainCertJob(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["ns_targets"] = [
+ ReservedDomainCertNSTarget(client, x) for x in props["ns_targets"]
+ ]
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<ReservedDomainCertJob {}>".format(self.id)
+
+ @property
+ def error_code(self) -> str:
+ """if present, an error code indicating why provisioning is failing. It may be either a temporary condition (INTERNAL_ERROR), or a permanent one the user must correct (DNS_ERROR)."""
+ return self._props["error_code"]
+
+ @property
+ def msg(self) -> str:
+ """a message describing the current status or error"""
+ return self._props["msg"]
+
+ @property
+ def started_at(self) -> str:
+ """timestamp when the provisioning job started, RFC 3339 format"""
+ return self._props["started_at"]
+
+ @property
+ def retries_at(self) -> str:
+ """timestamp when the provisioning job will be retried"""
+ return self._props["retries_at"]
+
+ @property
+ def ns_targets(self) -> Sequence[ReservedDomainCertNSTarget]:
+ """if present, indicates the dns nameservers that the user must configure to complete the provisioning process of a wildcard certificate"""
+ return self._props["ns_targets"]
+
+
+[docs]class SSHCertificateAuthority(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<SSHCertificateAuthority {}>".format(self.id)
+
+[docs] def delete(
+ self,
+ ):
+ self._client.ssh_certificate_authorities.delete(
+ id=self.id,
+ )
+
+[docs] def update(
+ self,
+ description: str = None,
+ metadata: str = None,
+ ):
+ self._client.ssh_certificate_authorities.update(
+ id=self.id,
+ description=description,
+ metadata=metadata,
+ )
+
+ @property
+ def id(self) -> str:
+ """unique identifier for this SSH Certificate Authority"""
+ return self._props["id"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the SSH Certificate Authority API resource"""
+ return self._props["uri"]
+
+ @property
+ def created_at(self) -> str:
+ """timestamp when the SSH Certificate Authority API resource was created, RFC 3339 format"""
+ return self._props["created_at"]
+
+ @property
+ def description(self) -> str:
+ """human-readable description of this SSH Certificate Authority. optional, max 255 bytes."""
+ return self._props["description"]
+
+ @property
+ def metadata(self) -> str:
+ """arbitrary user-defined machine-readable data of this SSH Certificate Authority. optional, max 4096 bytes."""
+ return self._props["metadata"]
+
+ @property
+ def public_key(self) -> str:
+ """raw public key for this SSH Certificate Authority"""
+ return self._props["public_key"]
+
+ @property
+ def key_type(self) -> str:
+ """the type of private key for this SSH Certificate Authority"""
+ return self._props["key_type"]
+
+
+[docs]class SSHCertificateAuthorityList(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["ssh_certificate_authorities"] = [
+ SSHCertificateAuthority(client, x)
+ for x in props["ssh_certificate_authorities"]
+ ]
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<SSHCertificateAuthorityList {}>".format(self.id)
+
+ def __iter__(self):
+ return PagedIterator(self._client, self, "ssh_certificate_authorities")
+
+ @property
+ def ssh_certificate_authorities(self) -> Sequence[SSHCertificateAuthority]:
+ """the list of all certificate authorities on this account"""
+ return self._props["ssh_certificate_authorities"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the certificates authorities list API resource"""
+ return self._props["uri"]
+
+ @property
+ def next_page_uri(self) -> str:
+ """URI of the next page, or null if there is no next page"""
+ return self._props["next_page_uri"]
+
+
+[docs]class SSHCredential(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<SSHCredential {}>".format(self.id)
+
+
+
+[docs] def update(
+ self,
+ description: str = None,
+ metadata: str = None,
+ acl: Sequence[str] = None,
+ ):
+ self._client.ssh_credentials.update(
+ id=self.id,
+ description=description,
+ metadata=metadata,
+ acl=acl,
+ )
+
+ @property
+ def id(self) -> str:
+ """unique ssh credential resource identifier"""
+ return self._props["id"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the ssh credential API resource"""
+ return self._props["uri"]
+
+ @property
+ def created_at(self) -> str:
+ """timestamp when the ssh credential was created, RFC 3339 format"""
+ return self._props["created_at"]
+
+ @property
+ def description(self) -> str:
+ """human-readable description of who or what will use the ssh credential to authenticate. Optional, max 255 bytes."""
+ return self._props["description"]
+
+ @property
+ def metadata(self) -> str:
+ """arbitrary user-defined machine-readable data of this ssh credential. Optional, max 4096 bytes."""
+ return self._props["metadata"]
+
+ @property
+ def public_key(self) -> str:
+ """the PEM-encoded public key of the SSH keypair that will be used to authenticate"""
+ return self._props["public_key"]
+
+ @property
+ def acl(self) -> Sequence[str]:
+ """optional list of ACL rules. If unspecified, the credential will have no restrictions. The only allowed ACL rule at this time is the <code>bind</code> rule. The <code>bind</code> rule allows the caller to restrict what domains and addresses the token is allowed to bind. For example, to allow the token to open a tunnel on example.ngrok.io your ACL would include the rule <code>bind:example.ngrok.io</code>. Bind rules may specify a leading wildcard to match multiple domains with a common suffix. For example, you may specify a rule of <code>bind:*.example.com</code> which will allow <code>x.example.com</code>, <code>y.example.com</code>, <code>*.example.com</code>, etc. A rule of <code>'*'</code> is equivalent to no acl at all and will explicitly permit all actions."""
+ return self._props["acl"]
+
+
+[docs]class SSHCredentialList(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["ssh_credentials"] = [
+ SSHCredential(client, x) for x in props["ssh_credentials"]
+ ]
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<SSHCredentialList {}>".format(self.id)
+
+ def __iter__(self):
+ return PagedIterator(self._client, self, "ssh_credentials")
+
+ @property
+ def ssh_credentials(self) -> Sequence[SSHCredential]:
+ """the list of all ssh credentials on this account"""
+ return self._props["ssh_credentials"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the ssh credential list API resource"""
+ return self._props["uri"]
+
+ @property
+ def next_page_uri(self) -> str:
+ """URI of the next page, or null if there is no next page"""
+ return self._props["next_page_uri"]
+
+
+[docs]class SSHHostCertificate(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<SSHHostCertificate {}>".format(self.id)
+
+
+
+[docs] def update(
+ self,
+ description: str = None,
+ metadata: str = None,
+ ):
+ self._client.ssh_host_certificates.update(
+ id=self.id,
+ description=description,
+ metadata=metadata,
+ )
+
+ @property
+ def id(self) -> str:
+ """unique identifier for this SSH Host Certificate"""
+ return self._props["id"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the SSH Host Certificate API resource"""
+ return self._props["uri"]
+
+ @property
+ def created_at(self) -> str:
+ """timestamp when the SSH Host Certificate API resource was created, RFC 3339 format"""
+ return self._props["created_at"]
+
+ @property
+ def description(self) -> str:
+ """human-readable description of this SSH Host Certificate. optional, max 255 bytes."""
+ return self._props["description"]
+
+ @property
+ def metadata(self) -> str:
+ """arbitrary user-defined machine-readable data of this SSH Host Certificate. optional, max 4096 bytes."""
+ return self._props["metadata"]
+
+ @property
+ def public_key(self) -> str:
+ """a public key in OpenSSH Authorized Keys format that this certificate signs"""
+ return self._props["public_key"]
+
+ @property
+ def key_type(self) -> str:
+ """the key type of the <code>public_key</code>, one of <code>rsa</code>, <code>ecdsa</code> or <code>ed25519</code>"""
+ return self._props["key_type"]
+
+ @property
+ def ssh_certificate_authority_id(self) -> str:
+ """the ssh certificate authority that is used to sign this ssh host certificate"""
+ return self._props["ssh_certificate_authority_id"]
+
+ @property
+ def principals(self) -> Sequence[str]:
+ """the list of principals included in the ssh host certificate. This is the list of hostnames and/or IP addresses that are authorized to serve SSH traffic with this certificate. Dangerously, if no principals are specified, this certificate is considered valid for all hosts."""
+ return self._props["principals"]
+
+ @property
+ def valid_after(self) -> str:
+ """the time when the ssh host certificate becomes valid, in RFC 3339 format."""
+ return self._props["valid_after"]
+
+ @property
+ def valid_until(self) -> str:
+ """the time after which the ssh host certificate becomes invalid, in RFC 3339 format. the OpenSSH certificates RFC calls this <code>valid_before</code>."""
+ return self._props["valid_until"]
+
+ @property
+ def certificate(self) -> str:
+ """the signed SSH certificate in OpenSSH Authorized Keys format. this value should be placed in a <code>-cert.pub</code> certificate file on disk that should be referenced in your <code>sshd_config</code> configuration file with a <code>HostCertificate</code> directive"""
+ return self._props["certificate"]
+
+
+[docs]class SSHHostCertificateList(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["ssh_host_certificates"] = [
+ SSHHostCertificate(client, x) for x in props["ssh_host_certificates"]
+ ]
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<SSHHostCertificateList {}>".format(self.id)
+
+ def __iter__(self):
+ return PagedIterator(self._client, self, "ssh_host_certificates")
+
+ @property
+ def ssh_host_certificates(self) -> Sequence[SSHHostCertificate]:
+ """the list of all ssh host certificates on this account"""
+ return self._props["ssh_host_certificates"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the ssh host certificates list API resource"""
+ return self._props["uri"]
+
+ @property
+ def next_page_uri(self) -> str:
+ """URI of the next page, or null if there is no next page"""
+ return self._props["next_page_uri"]
+
+
+[docs]class SSHUserCertificate(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<SSHUserCertificate {}>".format(self.id)
+
+
+
+[docs] def update(
+ self,
+ description: str = None,
+ metadata: str = None,
+ ):
+ self._client.ssh_user_certificates.update(
+ id=self.id,
+ description=description,
+ metadata=metadata,
+ )
+
+ @property
+ def id(self) -> str:
+ """unique identifier for this SSH User Certificate"""
+ return self._props["id"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the SSH User Certificate API resource"""
+ return self._props["uri"]
+
+ @property
+ def created_at(self) -> str:
+ """timestamp when the SSH User Certificate API resource was created, RFC 3339 format"""
+ return self._props["created_at"]
+
+ @property
+ def description(self) -> str:
+ """human-readable description of this SSH User Certificate. optional, max 255 bytes."""
+ return self._props["description"]
+
+ @property
+ def metadata(self) -> str:
+ """arbitrary user-defined machine-readable data of this SSH User Certificate. optional, max 4096 bytes."""
+ return self._props["metadata"]
+
+ @property
+ def public_key(self) -> str:
+ """a public key in OpenSSH Authorized Keys format that this certificate signs"""
+ return self._props["public_key"]
+
+ @property
+ def key_type(self) -> str:
+ """the key type of the <code>public_key</code>, one of <code>rsa</code>, <code>ecdsa</code> or <code>ed25519</code>"""
+ return self._props["key_type"]
+
+ @property
+ def ssh_certificate_authority_id(self) -> str:
+ """the ssh certificate authority that is used to sign this ssh user certificate"""
+ return self._props["ssh_certificate_authority_id"]
+
+ @property
+ def principals(self) -> Sequence[str]:
+ """the list of principals included in the ssh user certificate. This is the list of usernames that the certificate holder may sign in as on a machine authorizinig the signing certificate authority. Dangerously, if no principals are specified, this certificate may be used to log in as any user."""
+ return self._props["principals"]
+
+ @property
+ def critical_options(self) -> Mapping[str, str]:
+ """A map of critical options included in the certificate. Only two critical options are currently defined by OpenSSH: <code>force-command</code> and <code>source-address</code>. See <a href="https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.certkeys">the OpenSSH certificate protocol spec</a> for additional details."""
+ return self._props["critical_options"]
+
+ @property
+ def extensions(self) -> Mapping[str, str]:
+ """A map of extensions included in the certificate. Extensions are additional metadata that can be interpreted by the SSH server for any purpose. These can be used to permit or deny the ability to open a terminal, do port forwarding, x11 forwarding, and more. If unspecified, the certificate will include limited permissions with the following extension map: <code>{"permit-pty": "", "permit-user-rc": ""}</code> OpenSSH understands a number of predefined extensions. See <a href="https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.certkeys">the OpenSSH certificate protocol spec</a> for additional details."""
+ return self._props["extensions"]
+
+ @property
+ def valid_after(self) -> str:
+ """the time when the ssh host certificate becomes valid, in RFC 3339 format."""
+ return self._props["valid_after"]
+
+ @property
+ def valid_until(self) -> str:
+ """the time after which the ssh host certificate becomes invalid, in RFC 3339 format. the OpenSSH certificates RFC calls this <code>valid_before</code>."""
+ return self._props["valid_until"]
+
+ @property
+ def certificate(self) -> str:
+ """the signed SSH certificate in OpenSSH Authorized Keys Format. this value should be placed in a <code>-cert.pub</code> certificate file on disk that should be referenced in your <code>sshd_config</code> configuration file with a <code>HostCertificate</code> directive"""
+ return self._props["certificate"]
+
+
+[docs]class SSHUserCertificateList(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["ssh_user_certificates"] = [
+ SSHUserCertificate(client, x) for x in props["ssh_user_certificates"]
+ ]
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<SSHUserCertificateList {}>".format(self.id)
+
+ def __iter__(self):
+ return PagedIterator(self._client, self, "ssh_user_certificates")
+
+ @property
+ def ssh_user_certificates(self) -> Sequence[SSHUserCertificate]:
+ """the list of all ssh user certificates on this account"""
+ return self._props["ssh_user_certificates"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the ssh user certificates list API resource"""
+ return self._props["uri"]
+
+ @property
+ def next_page_uri(self) -> str:
+ """URI of the next page, or null if there is no next page"""
+ return self._props["next_page_uri"]
+
+
+[docs]class TLSCertificate(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["subject_alternative_names"] = TLSCertificateSANs(
+ client, props["subject_alternative_names"]
+ )
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<TLSCertificate {}>".format(self.id)
+
+
+
+[docs] def update(
+ self,
+ description: str = None,
+ metadata: str = None,
+ ):
+ self._client.tls_certificates.update(
+ id=self.id,
+ description=description,
+ metadata=metadata,
+ )
+
+ @property
+ def id(self) -> str:
+ """unique identifier for this TLS certificate"""
+ return self._props["id"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the TLS certificate API resource"""
+ return self._props["uri"]
+
+ @property
+ def created_at(self) -> str:
+ """timestamp when the TLS certificate was created, RFC 3339 format"""
+ return self._props["created_at"]
+
+ @property
+ def description(self) -> str:
+ """human-readable description of this TLS certificate. optional, max 255 bytes."""
+ return self._props["description"]
+
+ @property
+ def metadata(self) -> str:
+ """arbitrary user-defined machine-readable data of this TLS certificate. optional, max 4096 bytes."""
+ return self._props["metadata"]
+
+ @property
+ def certificate_pem(self) -> str:
+ """chain of PEM-encoded certificates, leaf first. See <a href="#tls-certificates-pem">Certificate Bundles</a>."""
+ return self._props["certificate_pem"]
+
+ @property
+ def subject_common_name(self) -> str:
+ """subject common name from the leaf of this TLS certificate"""
+ return self._props["subject_common_name"]
+
+ @property
+ def subject_alternative_names(self) -> TLSCertificateSANs:
+ """subject alternative names (SANs) from the leaf of this TLS certificate"""
+ return self._props["subject_alternative_names"]
+
+ @property
+ def issued_at(self) -> str:
+ """timestamp (in RFC 3339 format) when this TLS certificate was issued automatically, or null if this certificate was user-uploaded"""
+ return self._props["issued_at"]
+
+ @property
+ def not_before(self) -> str:
+ """timestamp when this TLS certificate becomes valid, RFC 3339 format"""
+ return self._props["not_before"]
+
+ @property
+ def not_after(self) -> str:
+ """timestamp when this TLS certificate becomes invalid, RFC 3339 format"""
+ return self._props["not_after"]
+
+ @property
+ def key_usages(self) -> Sequence[str]:
+ """set of actions the private key of this TLS certificate can be used for"""
+ return self._props["key_usages"]
+
+ @property
+ def extended_key_usages(self) -> Sequence[str]:
+ """extended set of actions the private key of this TLS certificate can be used for"""
+ return self._props["extended_key_usages"]
+
+ @property
+ def private_key_type(self) -> str:
+ """type of the private key of this TLS certificate. One of rsa, ecdsa, or ed25519."""
+ return self._props["private_key_type"]
+
+ @property
+ def issuer_common_name(self) -> str:
+ """issuer common name from the leaf of this TLS certificate"""
+ return self._props["issuer_common_name"]
+
+ @property
+ def serial_number(self) -> str:
+ """serial number of the leaf of this TLS certificate"""
+ return self._props["serial_number"]
+
+ @property
+ def subject_organization(self) -> str:
+ """subject organization from the leaf of this TLS certificate"""
+ return self._props["subject_organization"]
+
+ @property
+ def subject_organizational_unit(self) -> str:
+ """subject organizational unit from the leaf of this TLS certificate"""
+ return self._props["subject_organizational_unit"]
+
+ @property
+ def subject_locality(self) -> str:
+ """subject locality from the leaf of this TLS certificate"""
+ return self._props["subject_locality"]
+
+ @property
+ def subject_province(self) -> str:
+ """subject province from the leaf of this TLS certificate"""
+ return self._props["subject_province"]
+
+ @property
+ def subject_country(self) -> str:
+ """subject country from the leaf of this TLS certificate"""
+ return self._props["subject_country"]
+
+
+[docs]class TLSCertificateList(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["tls_certificates"] = [
+ TLSCertificate(client, x) for x in props["tls_certificates"]
+ ]
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<TLSCertificateList {}>".format(self.id)
+
+ def __iter__(self):
+ return PagedIterator(self._client, self, "tls_certificates")
+
+ @property
+ def tls_certificates(self) -> Sequence[TLSCertificate]:
+ """the list of all TLS certificates on this account"""
+ return self._props["tls_certificates"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the TLS certificates list API resource"""
+ return self._props["uri"]
+
+ @property
+ def next_page_uri(self) -> str:
+ """URI of the next page, or null if there is no next page"""
+ return self._props["next_page_uri"]
+
+
+[docs]class TLSCertificateSANs(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<TLSCertificateSANs {}>".format(self.id)
+
+ @property
+ def dns_names(self) -> Sequence[str]:
+ """set of additional domains (including wildcards) this TLS certificate is valid for"""
+ return self._props["dns_names"]
+
+ @property
+ def ips(self) -> Sequence[str]:
+ """set of IP addresses this TLS certificate is also valid for"""
+ return self._props["ips"]
+
+
+[docs]class TunnelSession(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["credential"] = Ref(client, props["credential"])
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<TunnelSession {}>".format(self.id)
+
+ @property
+ def agent_version(self) -> str:
+ """version of the ngrok agent that started this ngrok tunnel session"""
+ return self._props["agent_version"]
+
+ @property
+ def credential(self) -> Ref:
+ """reference to the tunnel credential or ssh credential used by the ngrok agent to start this tunnel session"""
+ return self._props["credential"]
+
+ @property
+ def id(self) -> str:
+ """unique tunnel session resource identifier"""
+ return self._props["id"]
+
+ @property
+ def ip(self) -> str:
+ """source ip address of the tunnel session"""
+ return self._props["ip"]
+
+ @property
+ def metadata(self) -> str:
+ """arbitrary user-defined data specified in the metadata property in the ngrok configuration file. See the metadata configuration option"""
+ return self._props["metadata"]
+
+ @property
+ def os(self) -> str:
+ """operating system of the host the ngrok agent is running on"""
+ return self._props["os"]
+
+ @property
+ def region(self) -> str:
+ """the ngrok region identifier in which this tunnel session was started"""
+ return self._props["region"]
+
+ @property
+ def started_at(self) -> str:
+ """time when the tunnel session first connected to the ngrok servers"""
+ return self._props["started_at"]
+
+ @property
+ def transport(self) -> str:
+ """the transport protocol used to start the tunnel session. Either <code>ngrok/v2</code> or <code>ssh</code>"""
+ return self._props["transport"]
+
+ @property
+ def uri(self) -> str:
+ """URI to the API resource of the tunnel session"""
+ return self._props["uri"]
+
+
+[docs]class TunnelSessionList(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["tunnel_sessions"] = [
+ TunnelSession(client, x) for x in props["tunnel_sessions"]
+ ]
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<TunnelSessionList {}>".format(self.id)
+
+ def __iter__(self):
+ return PagedIterator(self._client, self, "tunnel_sessions")
+
+ @property
+ def tunnel_sessions(self) -> Sequence[TunnelSession]:
+ """list of all tunnel sessions on this account"""
+ return self._props["tunnel_sessions"]
+
+ @property
+ def uri(self) -> str:
+ """URI to the API resource of the tunnel session list"""
+ return self._props["uri"]
+
+ @property
+ def next_page_uri(self) -> str:
+ """URI of the next page, or null if there is no next page"""
+ return self._props["next_page_uri"]
+
+
+[docs]class Tunnel(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["tunnel_session"] = Ref(client, props["tunnel_session"])
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<Tunnel {}>".format(self.id)
+
+ @property
+ def id(self) -> str:
+ """unique tunnel resource identifier"""
+ return self._props["id"]
+
+ @property
+ def public_url(self) -> str:
+ """URL of the tunnel's public endpoint"""
+ return self._props["public_url"]
+
+ @property
+ def started_at(self) -> str:
+ """timestamp when the tunnel was initiated in RFC 3339 format"""
+ return self._props["started_at"]
+
+ @property
+ def metadata(self) -> str:
+ """user-supplied metadata for the tunnel defined in the ngrok configuration file. See the tunnel <a href="https://ngrok.com/docs#tunnel-definitions-metadata">metadata configuration option</a> In API version 0, this value was instead pulled from the top-level <a href="https://ngrok.com/docs#config_metadata">metadata configuration option</a>."""
+ return self._props["metadata"]
+
+ @property
+ def proto(self) -> str:
+ """tunnel protocol. one of <code>http</code>, <code>https</code>, <code>tcp</code> or <code>tls</code>"""
+ return self._props["proto"]
+
+ @property
+ def region(self) -> str:
+ """identifier of tune region where the tunnel is running"""
+ return self._props["region"]
+
+ @property
+ def tunnel_session(self) -> Ref:
+ """reference object pointing to the tunnel session on which this tunnel was started"""
+ return self._props["tunnel_session"]
+
+
+[docs]class TunnelList(object):
+ def __init__(self, client, props):
+ self._client = client
+ self._props = props
+ self._props["tunnels"] = [Tunnel(client, x) for x in props["tunnels"]]
+
+ def __eq__(self, other):
+ return self._props == other._props
+
+ def __repr__(self):
+ return "<TunnelList {}>".format(self.id)
+
+ def __iter__(self):
+ return PagedIterator(self._client, self, "tunnels")
+
+ @property
+ def tunnels(self) -> Sequence[Tunnel]:
+ """the list of all online tunnels on this account"""
+ return self._props["tunnels"]
+
+ @property
+ def uri(self) -> str:
+ """URI of the tunnels list API resource"""
+ return self._props["uri"]
+
+ @property
+ def next_page_uri(self) -> str:
+ """URI of the next page, or null if there is no next page"""
+ return self._props["next_page_uri"]
+
+from __future__ import annotations
+from collections.abc import Iterator
+from typing import Any, Mapping, Sequence
+
+from .api_client import APIClient
+from .objects import *
+
+
+[docs]class AbuseReportsClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def create(
+ self,
+ urls: Sequence[str],
+ metadata: str = "",
+ ) -> AbuseReport:
+ """Creates a new abuse report which will be reviewed by our system and abuse response team. This API is only available to authorized accounts. Contact abuse@ngrok.com to request access
+
+ :param urls: a list of URLs containing suspected abusive content
+ :param metadata: arbitrary user-defined data about this abuse report. Optional, max 4096 bytes.
+ """
+ path = "/abuse_reports"
+ result = self._client.api_client.post(
+ path,
+ dict(
+ urls=urls,
+ metadata=metadata,
+ ),
+ )
+ return AbuseReport(self._client, result)
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> AbuseReport:
+ """Get the detailed status of abuse report by ID.
+
+ :param id: a resource identifier
+ """
+ path = "/abuse_reports/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return AbuseReport(self._client, result)
+
+
+[docs]class APIKeysClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def create(
+ self,
+ description: str = "",
+ metadata: str = "",
+ ) -> APIKey:
+ """Create a new API key. The generated API key can be used to authenticate to the ngrok API.
+
+ :param description: human-readable description of what uses the API key to authenticate. optional, max 255 bytes.
+ :param metadata: arbitrary user-defined data of this API key. optional, max 4096 bytes
+ """
+ path = "/api_keys"
+ result = self._client.api_client.post(
+ path,
+ dict(
+ description=description,
+ metadata=metadata,
+ ),
+ )
+ return APIKey(self._client, result)
+
+[docs] def delete(
+ self,
+ id: str,
+ ):
+ """Delete an API key by ID
+
+ :param id: a resource identifier
+ """
+ path = "/api_keys/{id}"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> APIKey:
+ """Get the details of an API key by ID.
+
+ :param id: a resource identifier
+ """
+ path = "/api_keys/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return APIKey(self._client, result)
+
+[docs] def list(
+ self,
+ before_id: str = None,
+ limit: str = None,
+ ) -> APIKeyList:
+ """List all API keys owned by this account
+
+ :param before_id:
+ :param limit:
+ """
+ path = "/api_keys"
+ result = self._client.api_client.get(
+ path,
+ dict(
+ before_id=before_id,
+ limit=limit,
+ ),
+ )
+ return APIKeyList(self._client, result)
+
+[docs] def update(
+ self,
+ id: str,
+ description: str = None,
+ metadata: str = None,
+ ) -> APIKey:
+ """Update attributes of an API key by ID.
+
+ :param id:
+ :param description: human-readable description of what uses the API key to authenticate. optional, max 255 bytes.
+ :param metadata: arbitrary user-defined data of this API key. optional, max 4096 bytes
+ """
+ path = "/api_keys/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.patch(
+ path,
+ dict(
+ description=description,
+ metadata=metadata,
+ ),
+ )
+ return APIKey(self._client, result)
+
+
+[docs]class CertificateAuthoritiesClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def create(
+ self,
+ ca_pem: str,
+ description: str = "",
+ metadata: str = "",
+ ) -> CertificateAuthority:
+ """Upload a new Certificate Authority
+
+ :param description: human-readable description of this Certificate Authority. optional, max 255 bytes.
+ :param metadata: arbitrary user-defined machine-readable data of this Certificate Authority. optional, max 4096 bytes.
+ :param ca_pem: raw PEM of the Certificate Authority
+ """
+ path = "/certificate_authorities"
+ result = self._client.api_client.post(
+ path,
+ dict(
+ description=description,
+ metadata=metadata,
+ ca_pem=ca_pem,
+ ),
+ )
+ return CertificateAuthority(self._client, result)
+
+[docs] def delete(
+ self,
+ id: str,
+ ):
+ """Delete a Certificate Authority
+
+ :param id: a resource identifier
+ """
+ path = "/certificate_authorities/{id}"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> CertificateAuthority:
+ """Get detailed information about a certficate authority
+
+ :param id: a resource identifier
+ """
+ path = "/certificate_authorities/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return CertificateAuthority(self._client, result)
+
+[docs] def list(
+ self,
+ before_id: str = None,
+ limit: str = None,
+ ) -> CertificateAuthorityList:
+ """List all Certificate Authority on this account
+
+ :param before_id:
+ :param limit:
+ """
+ path = "/certificate_authorities"
+ result = self._client.api_client.get(
+ path,
+ dict(
+ before_id=before_id,
+ limit=limit,
+ ),
+ )
+ return CertificateAuthorityList(self._client, result)
+
+[docs] def update(
+ self,
+ id: str,
+ description: str = None,
+ metadata: str = None,
+ ) -> CertificateAuthority:
+ """Update attributes of a Certificate Authority by ID
+
+ :param id:
+ :param description: human-readable description of this Certificate Authority. optional, max 255 bytes.
+ :param metadata: arbitrary user-defined machine-readable data of this Certificate Authority. optional, max 4096 bytes.
+ """
+ path = "/certificate_authorities/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.patch(
+ path,
+ dict(
+ description=description,
+ metadata=metadata,
+ ),
+ )
+ return CertificateAuthority(self._client, result)
+
+
+[docs]class CredentialsClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def create(
+ self,
+ description: str = "",
+ metadata: str = "",
+ acl: Sequence[str] = [],
+ ) -> Credential:
+ """Create a new tunnel authtoken credential. This authtoken credential can be used to start a new tunnel session. The response to this API call is the only time the generated token is available. If you need it for future use, you must save it securely yourself.
+
+ :param description: human-readable description of who or what will use the credential to authenticate. Optional, max 255 bytes.
+ :param metadata: arbitrary user-defined machine-readable data of this credential. Optional, max 4096 bytes.
+ :param acl: optional list of ACL rules. If unspecified, the credential will have no restrictions. The only allowed ACL rule at this time is the <code>bind</code> rule. The <code>bind</code> rule allows the caller to restrict what domains and addresses the token is allowed to bind. For example, to allow the token to open a tunnel on example.ngrok.io your ACL would include the rule <code>bind:example.ngrok.io</code>. Bind rules may specify a leading wildcard to match multiple domains with a common suffix. For example, you may specify a rule of <code>bind:*.example.com</code> which will allow <code>x.example.com</code>, <code>y.example.com</code>, <code>*.example.com</code>, etc. A rule of <code>'*'</code> is equivalent to no acl at all and will explicitly permit all actions.
+ """
+ path = "/credentials"
+ result = self._client.api_client.post(
+ path,
+ dict(
+ description=description,
+ metadata=metadata,
+ acl=acl,
+ ),
+ )
+ return Credential(self._client, result)
+
+[docs] def delete(
+ self,
+ id: str,
+ ):
+ """Delete a tunnel authtoken credential by ID
+
+ :param id: a resource identifier
+ """
+ path = "/credentials/{id}"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> Credential:
+ """Get detailed information about a tunnel authtoken credential
+
+ :param id: a resource identifier
+ """
+ path = "/credentials/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return Credential(self._client, result)
+
+[docs] def list(
+ self,
+ before_id: str = None,
+ limit: str = None,
+ ) -> CredentialList:
+ """List all tunnel authtoken credentials on this account
+
+ :param before_id:
+ :param limit:
+ """
+ path = "/credentials"
+ result = self._client.api_client.get(
+ path,
+ dict(
+ before_id=before_id,
+ limit=limit,
+ ),
+ )
+ return CredentialList(self._client, result)
+
+[docs] def update(
+ self,
+ id: str,
+ description: str = None,
+ metadata: str = None,
+ acl: Sequence[str] = None,
+ ) -> Credential:
+ """Update attributes of an tunnel authtoken credential by ID
+
+ :param id:
+ :param description: human-readable description of who or what will use the credential to authenticate. Optional, max 255 bytes.
+ :param metadata: arbitrary user-defined machine-readable data of this credential. Optional, max 4096 bytes.
+ :param acl: optional list of ACL rules. If unspecified, the credential will have no restrictions. The only allowed ACL rule at this time is the <code>bind</code> rule. The <code>bind</code> rule allows the caller to restrict what domains and addresses the token is allowed to bind. For example, to allow the token to open a tunnel on example.ngrok.io your ACL would include the rule <code>bind:example.ngrok.io</code>. Bind rules may specify a leading wildcard to match multiple domains with a common suffix. For example, you may specify a rule of <code>bind:*.example.com</code> which will allow <code>x.example.com</code>, <code>y.example.com</code>, <code>*.example.com</code>, etc. A rule of <code>'*'</code> is equivalent to no acl at all and will explicitly permit all actions.
+ """
+ path = "/credentials/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.patch(
+ path,
+ dict(
+ description=description,
+ metadata=metadata,
+ acl=acl,
+ ),
+ )
+ return Credential(self._client, result)
+
+
+[docs]class EventStreamsClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def create(
+ self,
+ metadata: str = "",
+ description: str = "",
+ fields: Sequence[str] = [],
+ event_type: str = "",
+ destination_ids: Sequence[str] = [],
+ sampling_rate: float = 0,
+ ) -> EventStream:
+ """Create a new Event Stream. It will not apply to anything until you associate it with one or more Endpoint Configs.
+
+ :param metadata: Arbitrary user-defined machine-readable data of this Event Stream. Optional, max 4096 bytes.
+ :param description: Human-readable description of the Event Stream. Optional, max 255 bytes.
+ :param fields: A list of protocol-specific fields you want to collect on each event.
+ :param event_type: The protocol that determines which events will be collected. Supported values are <code>tcp_connection_closed</code> and <code>http_request_complete</code>.
+ :param destination_ids: A list of Event Destination IDs which should be used for this Event Stream. Event Streams are required to have at least one Event Destination.
+ :param sampling_rate: The percentage of all events you would like to capture. Valid values range from 0.01, representing 1% of all events to 1.00, representing 100% of all events.
+ """
+ path = "/event_streams"
+ result = self._client.api_client.post(
+ path,
+ dict(
+ metadata=metadata,
+ description=description,
+ fields=fields,
+ event_type=event_type,
+ destination_ids=destination_ids,
+ sampling_rate=sampling_rate,
+ ),
+ )
+ return EventStream(self._client, result)
+
+[docs] def delete(
+ self,
+ id: str,
+ ):
+ """Delete an Event Stream. Associated Event Destinations will be preserved.
+
+ :param id: a resource identifier
+ """
+ path = "/event_streams/{id}"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> EventStream:
+ """Get detailed information about an Event Stream by ID.
+
+ :param id: a resource identifier
+ """
+ path = "/event_streams/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return EventStream(self._client, result)
+
+[docs] def list(
+ self,
+ before_id: str = None,
+ limit: str = None,
+ ) -> EventStreamList:
+ """List all Event Streams available on this account.
+
+ :param before_id:
+ :param limit:
+ """
+ path = "/event_streams"
+ result = self._client.api_client.get(
+ path,
+ dict(
+ before_id=before_id,
+ limit=limit,
+ ),
+ )
+ return EventStreamList(self._client, result)
+
+[docs] def update(
+ self,
+ id: str,
+ metadata: str = None,
+ description: str = None,
+ fields: Sequence[str] = None,
+ destination_ids: Sequence[str] = None,
+ sampling_rate: float = None,
+ ) -> EventStream:
+ """Update attributes of an Event Stream by ID.
+
+ :param id: Unique identifier for this Event Stream.
+ :param metadata: Arbitrary user-defined machine-readable data of this Event Stream. Optional, max 4096 bytes.
+ :param description: Human-readable description of the Event Stream. Optional, max 255 bytes.
+ :param fields: A list of protocol-specific fields you want to collect on each event.
+ :param destination_ids: A list of Event Destination IDs which should be used for this Event Stream. Event Streams are required to have at least one Event Destination.
+ :param sampling_rate: The percentage of all events you would like to capture. Valid values range from 0.01, representing 1% of all events to 1.00, representing 100% of all events.
+ """
+ path = "/event_streams/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.patch(
+ path,
+ dict(
+ metadata=metadata,
+ description=description,
+ fields=fields,
+ destination_ids=destination_ids,
+ sampling_rate=sampling_rate,
+ ),
+ )
+ return EventStream(self._client, result)
+
+
+[docs]class EventDestinationsClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def create(
+ self,
+ metadata: str = "",
+ description: str = "",
+ format: str = "",
+ target: EventTarget = None,
+ ) -> EventDestination:
+ """Create a new Event Destination. It will not apply to anything until it is associated with an Event Stream, and that Event Stream is associated with an Endpoint Config.
+
+ :param metadata: Arbitrary user-defined machine-readable data of this Event Destination. Optional, max 4096 bytes.
+ :param description: Human-readable description of the Event Destination. Optional, max 255 bytes.
+ :param format: The output format you would like to serialize events into when sending to their target. Currently the only accepted value is <code>JSON</code>.
+ :param target: An object that encapsulates where and how to send your events. An event destination must contain exactly one of the following objects, leaving the rest null: <code>kinesis</code>, <code>firehose</code>, <code>cloudwatch_logs</code>, or <code>s3</code>.
+ """
+ path = "/event_destinations"
+ result = self._client.api_client.post(
+ path,
+ dict(
+ metadata=metadata,
+ description=description,
+ format=format,
+ target=target,
+ ),
+ )
+ return EventDestination(self._client, result)
+
+[docs] def delete(
+ self,
+ id: str,
+ ):
+ """Delete an Event Destination. If the Event Destination is still referenced by an Event Stream, this will throw an error until that Event Stream has removed that reference.
+
+ :param id: a resource identifier
+ """
+ path = "/event_destinations/{id}"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> EventDestination:
+ """Get detailed information about an Event Destination by ID.
+
+ :param id: a resource identifier
+ """
+ path = "/event_destinations/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return EventDestination(self._client, result)
+
+[docs] def list(
+ self,
+ before_id: str = None,
+ limit: str = None,
+ ) -> EventDestinationList:
+ """List all Event Destinations on this account.
+
+ :param before_id:
+ :param limit:
+ """
+ path = "/event_destinations"
+ result = self._client.api_client.get(
+ path,
+ dict(
+ before_id=before_id,
+ limit=limit,
+ ),
+ )
+ return EventDestinationList(self._client, result)
+
+[docs] def update(
+ self,
+ id: str,
+ metadata: str = None,
+ description: str = None,
+ format: str = None,
+ target: EventTarget = None,
+ ) -> EventDestination:
+ """Update attributes of an Event Destination.
+
+ :param id: Unique identifier for this Event Destination.
+ :param metadata: Arbitrary user-defined machine-readable data of this Event Destination. Optional, max 4096 bytes.
+ :param description: Human-readable description of the Event Destination. Optional, max 255 bytes.
+ :param format: The output format you would like to serialize events into when sending to their target. Currently the only accepted value is <code>JSON</code>.
+ :param target: An object that encapsulates where and how to send your events. An event destination must contain exactly one of the following objects, leaving the rest null: <code>kinesis</code>, <code>firehose</code>, <code>cloudwatch_logs</code>, or <code>s3</code>.
+ """
+ path = "/event_destinations/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.patch(
+ path,
+ dict(
+ metadata=metadata,
+ description=description,
+ format=format,
+ target=target,
+ ),
+ )
+ return EventDestination(self._client, result)
+
+
+[docs]class IPPoliciesClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def create(
+ self,
+ action: str,
+ description: str = "",
+ metadata: str = "",
+ ) -> IPPolicy:
+ """Create a new IP policy. It will not apply to any traffic until you associate to a traffic source via an endpoint configuration or IP restriction.
+
+ :param description: human-readable description of the source IPs of this IP policy. optional, max 255 bytes.
+ :param metadata: arbitrary user-defined machine-readable data of this IP policy. optional, max 4096 bytes.
+ :param action: the IP policy action. Supported values are <code>allow</code> or <code>deny</code>
+ """
+ path = "/ip_policies"
+ result = self._client.api_client.post(
+ path,
+ dict(
+ description=description,
+ metadata=metadata,
+ action=action,
+ ),
+ )
+ return IPPolicy(self._client, result)
+
+[docs] def delete(
+ self,
+ id: str,
+ ):
+ """Delete an IP policy. If the IP policy is referenced by another object for the purposes of traffic restriction it will be treated as if the IP policy remains but has zero rules.
+
+ :param id: a resource identifier
+ """
+ path = "/ip_policies/{id}"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> IPPolicy:
+ """Get detailed information about an IP policy by ID.
+
+ :param id: a resource identifier
+ """
+ path = "/ip_policies/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return IPPolicy(self._client, result)
+
+[docs] def list(
+ self,
+ before_id: str = None,
+ limit: str = None,
+ ) -> IPPolicyList:
+ """List all IP policies on this account
+
+ :param before_id:
+ :param limit:
+ """
+ path = "/ip_policies"
+ result = self._client.api_client.get(
+ path,
+ dict(
+ before_id=before_id,
+ limit=limit,
+ ),
+ )
+ return IPPolicyList(self._client, result)
+
+[docs] def update(
+ self,
+ id: str,
+ description: str = None,
+ metadata: str = None,
+ ) -> IPPolicy:
+ """Update attributes of an IP policy by ID
+
+ :param id:
+ :param description: human-readable description of the source IPs of this IP policy. optional, max 255 bytes.
+ :param metadata: arbitrary user-defined machine-readable data of this IP policy. optional, max 4096 bytes.
+ """
+ path = "/ip_policies/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.patch(
+ path,
+ dict(
+ description=description,
+ metadata=metadata,
+ ),
+ )
+ return IPPolicy(self._client, result)
+
+
+[docs]class IPPolicyRulesClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def create(
+ self,
+ cidr: str,
+ ip_policy_id: str,
+ description: str = "",
+ metadata: str = "",
+ ) -> IPPolicyRule:
+ """Create a new IP policy rule attached to an IP Policy.
+
+ :param description: human-readable description of the source IPs of this IP rule. optional, max 255 bytes.
+ :param metadata: arbitrary user-defined machine-readable data of this IP policy rule. optional, max 4096 bytes.
+ :param cidr: an IP or IP range specified in CIDR notation. IPv4 and IPv6 are both supported.
+ :param ip_policy_id: ID of the IP policy this IP policy rule will be attached to
+ """
+ path = "/ip_policy_rules"
+ result = self._client.api_client.post(
+ path,
+ dict(
+ description=description,
+ metadata=metadata,
+ cidr=cidr,
+ ip_policy_id=ip_policy_id,
+ ),
+ )
+ return IPPolicyRule(self._client, result)
+
+[docs] def delete(
+ self,
+ id: str,
+ ):
+ """Delete an IP policy rule.
+
+ :param id: a resource identifier
+ """
+ path = "/ip_policy_rules/{id}"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> IPPolicyRule:
+ """Get detailed information about an IP policy rule by ID.
+
+ :param id: a resource identifier
+ """
+ path = "/ip_policy_rules/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return IPPolicyRule(self._client, result)
+
+[docs] def list(
+ self,
+ before_id: str = None,
+ limit: str = None,
+ ) -> IPPolicyRuleList:
+ """List all IP policy rules on this account
+
+ :param before_id:
+ :param limit:
+ """
+ path = "/ip_policy_rules"
+ result = self._client.api_client.get(
+ path,
+ dict(
+ before_id=before_id,
+ limit=limit,
+ ),
+ )
+ return IPPolicyRuleList(self._client, result)
+
+[docs] def update(
+ self,
+ id: str,
+ description: str = None,
+ metadata: str = None,
+ cidr: str = None,
+ ) -> IPPolicyRule:
+ """Update attributes of an IP policy rule by ID
+
+ :param id:
+ :param description: human-readable description of the source IPs of this IP rule. optional, max 255 bytes.
+ :param metadata: arbitrary user-defined machine-readable data of this IP policy rule. optional, max 4096 bytes.
+ :param cidr: an IP or IP range specified in CIDR notation. IPv4 and IPv6 are both supported.
+ """
+ path = "/ip_policy_rules/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.patch(
+ path,
+ dict(
+ description=description,
+ metadata=metadata,
+ cidr=cidr,
+ ),
+ )
+ return IPPolicyRule(self._client, result)
+
+
+[docs]class IPRestrictionsClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def create(
+ self,
+ type: str,
+ ip_policy_ids: Sequence[str],
+ description: str = "",
+ metadata: str = "",
+ enforced: bool = False,
+ ) -> IPRestriction:
+ """Create a new IP restriction
+
+ :param description: human-readable description of this IP restriction. optional, max 255 bytes.
+ :param metadata: arbitrary user-defined machine-readable data of this IP restriction. optional, max 4096 bytes.
+ :param enforced: true if the IP restriction will be enforce. if false, only warnings will be issued
+ :param type: the type of IP restriction. this defines what traffic will be restricted with the attached policies. four values are currently supported: <code>dashboard</code>, <code>api</code>, <code>agent</code>, and <code>endpoints</code>
+ :param ip_policy_ids: the set of IP policy identifiers that are used to enforce the restriction
+ """
+ path = "/ip_restrictions"
+ result = self._client.api_client.post(
+ path,
+ dict(
+ description=description,
+ metadata=metadata,
+ enforced=enforced,
+ type=type,
+ ip_policy_ids=ip_policy_ids,
+ ),
+ )
+ return IPRestriction(self._client, result)
+
+[docs] def delete(
+ self,
+ id: str,
+ ):
+ """Delete an IP restriction
+
+ :param id: a resource identifier
+ """
+ path = "/ip_restrictions/{id}"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> IPRestriction:
+ """Get detailed information about an IP restriction
+
+ :param id: a resource identifier
+ """
+ path = "/ip_restrictions/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return IPRestriction(self._client, result)
+
+[docs] def list(
+ self,
+ before_id: str = None,
+ limit: str = None,
+ ) -> IPRestrictionList:
+ """List all IP restrictions on this account
+
+ :param before_id:
+ :param limit:
+ """
+ path = "/ip_restrictions"
+ result = self._client.api_client.get(
+ path,
+ dict(
+ before_id=before_id,
+ limit=limit,
+ ),
+ )
+ return IPRestrictionList(self._client, result)
+
+[docs] def update(
+ self,
+ id: str,
+ description: str = None,
+ metadata: str = None,
+ enforced: bool = None,
+ ip_policy_ids: Sequence[str] = [],
+ ) -> IPRestriction:
+ """Update attributes of an IP restriction by ID
+
+ :param id:
+ :param description: human-readable description of this IP restriction. optional, max 255 bytes.
+ :param metadata: arbitrary user-defined machine-readable data of this IP restriction. optional, max 4096 bytes.
+ :param enforced: true if the IP restriction will be enforce. if false, only warnings will be issued
+ :param ip_policy_ids: the set of IP policy identifiers that are used to enforce the restriction
+ """
+ path = "/ip_restrictions/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.patch(
+ path,
+ dict(
+ description=description,
+ metadata=metadata,
+ enforced=enforced,
+ ip_policy_ids=ip_policy_ids,
+ ),
+ )
+ return IPRestriction(self._client, result)
+
+
+[docs]class IPWhitelistClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def create(
+ self,
+ description: str = "",
+ metadata: str = "",
+ ip_net: str = "",
+ ) -> IPWhitelistEntry:
+ """Create a new IP whitelist entry that will restrict traffic to all tunnel endpoints on the account.
+
+ :param description: human-readable description of the source IPs for this IP whitelist entry. optional, max 255 bytes.
+ :param metadata: arbitrary user-defined machine-readable data of this IP whitelist entry. optional, max 4096 bytes.
+ :param ip_net: an IP address or IP network range in CIDR notation (e.g. 10.1.1.1 or 10.1.0.0/16) of addresses that will be whitelisted to communicate with your tunnel endpoints
+ """
+ path = "/ip_whitelist"
+ result = self._client.api_client.post(
+ path,
+ dict(
+ description=description,
+ metadata=metadata,
+ ip_net=ip_net,
+ ),
+ )
+ return IPWhitelistEntry(self._client, result)
+
+[docs] def delete(
+ self,
+ id: str,
+ ):
+ """Delete an IP whitelist entry.
+
+ :param id: a resource identifier
+ """
+ path = "/ip_whitelist/{id}"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> IPWhitelistEntry:
+ """Get detailed information about an IP whitelist entry by ID.
+
+ :param id: a resource identifier
+ """
+ path = "/ip_whitelist/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return IPWhitelistEntry(self._client, result)
+
+[docs] def list(
+ self,
+ before_id: str = None,
+ limit: str = None,
+ ) -> IPWhitelistEntryList:
+ """List all IP whitelist entries on this account
+
+ :param before_id:
+ :param limit:
+ """
+ path = "/ip_whitelist"
+ result = self._client.api_client.get(
+ path,
+ dict(
+ before_id=before_id,
+ limit=limit,
+ ),
+ )
+ return IPWhitelistEntryList(self._client, result)
+
+[docs] def update(
+ self,
+ id: str,
+ description: str = None,
+ metadata: str = None,
+ ) -> IPWhitelistEntry:
+ """Update attributes of an IP whitelist entry by ID
+
+ :param id:
+ :param description: human-readable description of the source IPs for this IP whitelist entry. optional, max 255 bytes.
+ :param metadata: arbitrary user-defined machine-readable data of this IP whitelist entry. optional, max 4096 bytes.
+ """
+ path = "/ip_whitelist/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.patch(
+ path,
+ dict(
+ description=description,
+ metadata=metadata,
+ ),
+ )
+ return IPWhitelistEntry(self._client, result)
+
+
+[docs]class EndpointConfigurationsClient(object):
+ """## Endpoint Configuration management
+
+ An [Endpoint Configuration](https://ngrok.com/docs/ngrok-link#api-endpoint-configurations) describes
+ a ngrok network endpoint instance.
+
+ _Endpoints are your gateway to ngrok features!_"""
+
+ def __init__(self, client):
+ self._client = client
+
+[docs] def create(
+ self,
+ type: str = "",
+ description: str = "",
+ metadata: str = "",
+ circuit_breaker: EndpointCircuitBreaker = None,
+ compression: EndpointCompression = None,
+ request_headers: EndpointRequestHeaders = None,
+ response_headers: EndpointResponseHeaders = None,
+ ip_policy: EndpointIPPolicyMutate = None,
+ mutual_tls: EndpointMutualTLSMutate = None,
+ tls_termination: EndpointTLSTermination = None,
+ webhook_validation: EndpointWebhookValidation = None,
+ oauth: EndpointOAuth = None,
+ logging: EndpointLoggingMutate = None,
+ saml: EndpointSAMLMutate = None,
+ oidc: EndpointOIDC = None,
+ ) -> EndpointConfiguration:
+ """Create a new endpoint configuration
+
+ :param type: they type of traffic this endpoint configuration can be applied to. one of: <code>http</code>, <code>https</code>, <code>tcp</code>
+ :param description: human-readable description of what this endpoint configuration will be do when applied or what traffic it will be applied to. Optional, max 255 bytes
+ :param metadata: arbitrary user-defined machine-readable data of this endpoint configuration. Optional, max 4096 bytes.
+ :param circuit_breaker: circuit breaker module configuration or <code>null</code>
+ :param compression: compression module configuration or <code>null</code>
+ :param request_headers: request headers module configuration or <code>null</code>
+ :param response_headers: response headers module configuration or <code>null</code>
+ :param ip_policy: ip policy module configuration or <code>null</code>
+ :param mutual_tls: mutual TLS module configuration or <code>null</code>
+ :param tls_termination: TLS termination module configuration or <code>null</code>
+ :param webhook_validation: webhook validation module configuration or <code>null</code>
+ :param oauth: oauth module configuration or <code>null</code>
+ :param logging: logging module configuration or <code>null</code>
+ :param saml: saml module configuration or <code>null</code>
+ :param oidc: oidc module configuration or <code>null</code>
+ """
+ path = "/endpoint_configurations"
+ result = self._client.api_client.post(
+ path,
+ dict(
+ type=type,
+ description=description,
+ metadata=metadata,
+ circuit_breaker=circuit_breaker,
+ compression=compression,
+ request_headers=request_headers,
+ response_headers=response_headers,
+ ip_policy=ip_policy,
+ mutual_tls=mutual_tls,
+ tls_termination=tls_termination,
+ webhook_validation=webhook_validation,
+ oauth=oauth,
+ logging=logging,
+ saml=saml,
+ oidc=oidc,
+ ),
+ )
+ return EndpointConfiguration(self._client, result)
+
+[docs] def delete(
+ self,
+ id: str,
+ ):
+ """Delete an endpoint configuration. This operation will fail if the endpoint configuration is still referenced by any reserved domain or reserved address.
+
+ :param id: a resource identifier
+ """
+ path = "/endpoint_configurations/{id}"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> EndpointConfiguration:
+ """Returns detailed information about an endpoint configuration
+
+ :param id: a resource identifier
+ """
+ path = "/endpoint_configurations/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return EndpointConfiguration(self._client, result)
+
+[docs] def list(
+ self,
+ before_id: str = None,
+ limit: str = None,
+ ) -> EndpointConfigurationList:
+ """Returns a list of all endpoint configurations on this account
+
+ :param before_id:
+ :param limit:
+ """
+ path = "/endpoint_configurations"
+ result = self._client.api_client.get(
+ path,
+ dict(
+ before_id=before_id,
+ limit=limit,
+ ),
+ )
+ return EndpointConfigurationList(self._client, result)
+
+[docs] def update(
+ self,
+ id: str,
+ description: str = None,
+ metadata: str = None,
+ circuit_breaker: EndpointCircuitBreaker = None,
+ compression: EndpointCompression = None,
+ request_headers: EndpointRequestHeaders = None,
+ response_headers: EndpointResponseHeaders = None,
+ ip_policy: EndpointIPPolicyMutate = None,
+ mutual_tls: EndpointMutualTLSMutate = None,
+ tls_termination: EndpointTLSTermination = None,
+ webhook_validation: EndpointWebhookValidation = None,
+ oauth: EndpointOAuth = None,
+ logging: EndpointLoggingMutate = None,
+ saml: EndpointSAMLMutate = None,
+ oidc: EndpointOIDC = None,
+ ) -> EndpointConfiguration:
+ """Updates an endpoint configuration. If a module is not specified in the update, it will not be modified. However, each module configuration that is specified will completely replace the existing value. There is no way to delete an existing module via this API, instead use the delete module API.
+
+ :param id: unique identifier of this endpoint configuration
+ :param description: human-readable description of what this endpoint configuration will be do when applied or what traffic it will be applied to. Optional, max 255 bytes
+ :param metadata: arbitrary user-defined machine-readable data of this endpoint configuration. Optional, max 4096 bytes.
+ :param circuit_breaker: circuit breaker module configuration or <code>null</code>
+ :param compression: compression module configuration or <code>null</code>
+ :param request_headers: request headers module configuration or <code>null</code>
+ :param response_headers: response headers module configuration or <code>null</code>
+ :param ip_policy: ip policy module configuration or <code>null</code>
+ :param mutual_tls: mutual TLS module configuration or <code>null</code>
+ :param tls_termination: TLS termination module configuration or <code>null</code>
+ :param webhook_validation: webhook validation module configuration or <code>null</code>
+ :param oauth: oauth module configuration or <code>null</code>
+ :param logging: logging module configuration or <code>null</code>
+ :param saml: saml module configuration or <code>null</code>
+ :param oidc: oidc module configuration or <code>null</code>
+ """
+ path = "/endpoint_configurations/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.patch(
+ path,
+ dict(
+ description=description,
+ metadata=metadata,
+ circuit_breaker=circuit_breaker,
+ compression=compression,
+ request_headers=request_headers,
+ response_headers=response_headers,
+ ip_policy=ip_policy,
+ mutual_tls=mutual_tls,
+ tls_termination=tls_termination,
+ webhook_validation=webhook_validation,
+ oauth=oauth,
+ logging=logging,
+ saml=saml,
+ oidc=oidc,
+ ),
+ )
+ return EndpointConfiguration(self._client, result)
+
+
+[docs]class EndpointLoggingModuleClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def replace(
+ self,
+ id: str,
+ module: EndpointLoggingMutate = None,
+ ) -> EndpointLogging:
+ """
+
+ :param id:
+ :param module:
+ """
+ path = "/endpoint_configurations/{id}/logging"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.put(
+ path,
+ dict(
+ module=module,
+ ),
+ )
+ return EndpointLogging(self._client, result)
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> EndpointLogging:
+ """
+
+ :param id: a resource identifier
+ """
+ path = "/endpoint_configurations/{id}/logging"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return EndpointLogging(self._client, result)
+
+[docs] def delete(
+ self,
+ id: str,
+ ):
+ """
+
+ :param id: a resource identifier
+ """
+ path = "/endpoint_configurations/{id}/logging"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+
+[docs]class EndpointCircuitBreakerModuleClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def replace(
+ self,
+ id: str,
+ module: EndpointCircuitBreaker = None,
+ ) -> EndpointCircuitBreaker:
+ """
+
+ :param id:
+ :param module:
+ """
+ path = "/endpoint_configurations/{id}/circuit_breaker"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.put(
+ path,
+ dict(
+ module=module,
+ ),
+ )
+ return EndpointCircuitBreaker(self._client, result)
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> EndpointCircuitBreaker:
+ """
+
+ :param id: a resource identifier
+ """
+ path = "/endpoint_configurations/{id}/circuit_breaker"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return EndpointCircuitBreaker(self._client, result)
+
+[docs] def delete(
+ self,
+ id: str,
+ ):
+ """
+
+ :param id: a resource identifier
+ """
+ path = "/endpoint_configurations/{id}/circuit_breaker"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+
+[docs]class EndpointCompressionModuleClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def replace(
+ self,
+ id: str,
+ module: EndpointCompression = None,
+ ) -> EndpointCompression:
+ """
+
+ :param id:
+ :param module:
+ """
+ path = "/endpoint_configurations/{id}/compression"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.put(
+ path,
+ dict(
+ module=module,
+ ),
+ )
+ return EndpointCompression(self._client, result)
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> EndpointCompression:
+ """
+
+ :param id: a resource identifier
+ """
+ path = "/endpoint_configurations/{id}/compression"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return EndpointCompression(self._client, result)
+
+[docs] def delete(
+ self,
+ id: str,
+ ):
+ """
+
+ :param id: a resource identifier
+ """
+ path = "/endpoint_configurations/{id}/compression"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+
+[docs]class EndpointTLSTerminationModuleClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def replace(
+ self,
+ id: str,
+ module: EndpointTLSTermination = None,
+ ) -> EndpointTLSTermination:
+ """
+
+ :param id:
+ :param module:
+ """
+ path = "/endpoint_configurations/{id}/tls_termination"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.put(
+ path,
+ dict(
+ module=module,
+ ),
+ )
+ return EndpointTLSTermination(self._client, result)
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> EndpointTLSTermination:
+ """
+
+ :param id: a resource identifier
+ """
+ path = "/endpoint_configurations/{id}/tls_termination"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return EndpointTLSTermination(self._client, result)
+
+[docs] def delete(
+ self,
+ id: str,
+ ):
+ """
+
+ :param id: a resource identifier
+ """
+ path = "/endpoint_configurations/{id}/tls_termination"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+
+[docs]class EndpointIPPolicyModuleClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def replace(
+ self,
+ id: str,
+ module: EndpointIPPolicyMutate = None,
+ ) -> EndpointIPPolicy:
+ """
+
+ :param id:
+ :param module:
+ """
+ path = "/endpoint_configurations/{id}/ip_policy"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.put(
+ path,
+ dict(
+ module=module,
+ ),
+ )
+ return EndpointIPPolicy(self._client, result)
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> EndpointIPPolicy:
+ """
+
+ :param id: a resource identifier
+ """
+ path = "/endpoint_configurations/{id}/ip_policy"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return EndpointIPPolicy(self._client, result)
+
+[docs] def delete(
+ self,
+ id: str,
+ ):
+ """
+
+ :param id: a resource identifier
+ """
+ path = "/endpoint_configurations/{id}/ip_policy"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+
+[docs]class EndpointMutualTLSModuleClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def replace(
+ self,
+ id: str,
+ module: EndpointMutualTLSMutate = None,
+ ) -> EndpointMutualTLS:
+ """
+
+ :param id:
+ :param module:
+ """
+ path = "/endpoint_configurations/{id}/mutual_tls"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.put(
+ path,
+ dict(
+ module=module,
+ ),
+ )
+ return EndpointMutualTLS(self._client, result)
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> EndpointMutualTLS:
+ """
+
+ :param id: a resource identifier
+ """
+ path = "/endpoint_configurations/{id}/mutual_tls"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return EndpointMutualTLS(self._client, result)
+
+[docs] def delete(
+ self,
+ id: str,
+ ):
+ """
+
+ :param id: a resource identifier
+ """
+ path = "/endpoint_configurations/{id}/mutual_tls"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+
+[docs]class EndpointRequestHeadersModuleClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def replace(
+ self,
+ id: str,
+ module: EndpointRequestHeaders = None,
+ ) -> EndpointRequestHeaders:
+ """
+
+ :param id:
+ :param module:
+ """
+ path = "/endpoint_configurations/{id}/request_headers"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.put(
+ path,
+ dict(
+ module=module,
+ ),
+ )
+ return EndpointRequestHeaders(self._client, result)
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> EndpointRequestHeaders:
+ """
+
+ :param id: a resource identifier
+ """
+ path = "/endpoint_configurations/{id}/request_headers"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return EndpointRequestHeaders(self._client, result)
+
+[docs] def delete(
+ self,
+ id: str,
+ ):
+ """
+
+ :param id: a resource identifier
+ """
+ path = "/endpoint_configurations/{id}/request_headers"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+
+[docs]class EndpointResponseHeadersModuleClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def replace(
+ self,
+ id: str,
+ module: EndpointResponseHeaders = None,
+ ) -> EndpointResponseHeaders:
+ """
+
+ :param id:
+ :param module:
+ """
+ path = "/endpoint_configurations/{id}/response_headers"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.put(
+ path,
+ dict(
+ module=module,
+ ),
+ )
+ return EndpointResponseHeaders(self._client, result)
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> EndpointResponseHeaders:
+ """
+
+ :param id: a resource identifier
+ """
+ path = "/endpoint_configurations/{id}/response_headers"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return EndpointResponseHeaders(self._client, result)
+
+[docs] def delete(
+ self,
+ id: str,
+ ):
+ """
+
+ :param id: a resource identifier
+ """
+ path = "/endpoint_configurations/{id}/response_headers"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+
+[docs]class EndpointOAuthModuleClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def replace(
+ self,
+ id: str,
+ module: EndpointOAuth = None,
+ ) -> EndpointOAuth:
+ """
+
+ :param id:
+ :param module:
+ """
+ path = "/endpoint_configurations/{id}/oauth"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.put(
+ path,
+ dict(
+ module=module,
+ ),
+ )
+ return EndpointOAuth(self._client, result)
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> EndpointOAuth:
+ """
+
+ :param id: a resource identifier
+ """
+ path = "/endpoint_configurations/{id}/oauth"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return EndpointOAuth(self._client, result)
+
+[docs] def delete(
+ self,
+ id: str,
+ ):
+ """
+
+ :param id: a resource identifier
+ """
+ path = "/endpoint_configurations/{id}/oauth"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+
+[docs]class EndpointWebhookValidationModuleClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def replace(
+ self,
+ id: str,
+ module: EndpointWebhookValidation = None,
+ ) -> EndpointWebhookValidation:
+ """
+
+ :param id:
+ :param module:
+ """
+ path = "/endpoint_configurations/{id}/webhook_validation"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.put(
+ path,
+ dict(
+ module=module,
+ ),
+ )
+ return EndpointWebhookValidation(self._client, result)
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> EndpointWebhookValidation:
+ """
+
+ :param id: a resource identifier
+ """
+ path = "/endpoint_configurations/{id}/webhook_validation"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return EndpointWebhookValidation(self._client, result)
+
+[docs] def delete(
+ self,
+ id: str,
+ ):
+ """
+
+ :param id: a resource identifier
+ """
+ path = "/endpoint_configurations/{id}/webhook_validation"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+
+[docs]class EndpointSAMLModuleClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def replace(
+ self,
+ id: str,
+ module: EndpointSAMLMutate = None,
+ ) -> EndpointSAML:
+ """
+
+ :param id:
+ :param module:
+ """
+ path = "/endpoint_configurations/{id}/saml"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.put(
+ path,
+ dict(
+ module=module,
+ ),
+ )
+ return EndpointSAML(self._client, result)
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> EndpointSAML:
+ """
+
+ :param id: a resource identifier
+ """
+ path = "/endpoint_configurations/{id}/saml"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return EndpointSAML(self._client, result)
+
+[docs] def delete(
+ self,
+ id: str,
+ ):
+ """
+
+ :param id: a resource identifier
+ """
+ path = "/endpoint_configurations/{id}/saml"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+
+[docs]class EndpointOIDCModuleClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def replace(
+ self,
+ id: str,
+ module: EndpointOIDC = None,
+ ) -> EndpointOIDC:
+ """
+
+ :param id:
+ :param module:
+ """
+ path = "/endpoint_configurations/{id}/oidc"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.put(
+ path,
+ dict(
+ module=module,
+ ),
+ )
+ return EndpointOIDC(self._client, result)
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> EndpointOIDC:
+ """
+
+ :param id: a resource identifier
+ """
+ path = "/endpoint_configurations/{id}/oidc"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return EndpointOIDC(self._client, result)
+
+[docs] def delete(
+ self,
+ id: str,
+ ):
+ """
+
+ :param id: a resource identifier
+ """
+ path = "/endpoint_configurations/{id}/oidc"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+
+[docs]class ReservedAddrsClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def create(
+ self,
+ description: str = "",
+ metadata: str = "",
+ region: str = "",
+ endpoint_configuration_id: str = "",
+ ) -> ReservedAddr:
+ """Create a new reserved address.
+
+ :param description: human-readable description of what this reserved address will be used for
+ :param metadata: arbitrary user-defined machine-readable data of this reserved address. Optional, max 4096 bytes.
+ :param region: reserve the address in this geographic ngrok datacenter. Optional, default is us. (au, eu, ap, us, jp, in, sa)
+ :param endpoint_configuration_id: ID of an endpoint configuration of type tcp that will be used to handle inbound traffic to this address
+ """
+ path = "/reserved_addrs"
+ result = self._client.api_client.post(
+ path,
+ dict(
+ description=description,
+ metadata=metadata,
+ region=region,
+ endpoint_configuration_id=endpoint_configuration_id,
+ ),
+ )
+ return ReservedAddr(self._client, result)
+
+[docs] def delete(
+ self,
+ id: str,
+ ):
+ """Delete a reserved address.
+
+ :param id: a resource identifier
+ """
+ path = "/reserved_addrs/{id}"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> ReservedAddr:
+ """Get the details of a reserved address.
+
+ :param id: a resource identifier
+ """
+ path = "/reserved_addrs/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return ReservedAddr(self._client, result)
+
+[docs] def list(
+ self,
+ before_id: str = None,
+ limit: str = None,
+ ) -> ReservedAddrList:
+ """List all reserved addresses on this account.
+
+ :param before_id:
+ :param limit:
+ """
+ path = "/reserved_addrs"
+ result = self._client.api_client.get(
+ path,
+ dict(
+ before_id=before_id,
+ limit=limit,
+ ),
+ )
+ return ReservedAddrList(self._client, result)
+
+[docs] def update(
+ self,
+ id: str,
+ description: str = None,
+ metadata: str = None,
+ endpoint_configuration_id: str = None,
+ ) -> ReservedAddr:
+ """Update the attributes of a reserved address.
+
+ :param id:
+ :param description: human-readable description of what this reserved address will be used for
+ :param metadata: arbitrary user-defined machine-readable data of this reserved address. Optional, max 4096 bytes.
+ :param endpoint_configuration_id: ID of an endpoint configuration of type tcp that will be used to handle inbound traffic to this address
+ """
+ path = "/reserved_addrs/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.patch(
+ path,
+ dict(
+ description=description,
+ metadata=metadata,
+ endpoint_configuration_id=endpoint_configuration_id,
+ ),
+ )
+ return ReservedAddr(self._client, result)
+
+[docs] def delete_endpoint_config(
+ self,
+ id: str,
+ ):
+ """Detach the endpoint configuration attached to a reserved address.
+
+ :param id: a resource identifier
+ """
+ path = "/reserved_addrs/{id}/endpoint_configuration"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+
+[docs]class ReservedDomainsClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def create(
+ self,
+ name: str,
+ region: str = "",
+ description: str = "",
+ metadata: str = "",
+ http_endpoint_configuration_id: str = "",
+ https_endpoint_configuration_id: str = "",
+ certificate_id: str = None,
+ certificate_management_policy: ReservedDomainCertPolicy = None,
+ ) -> ReservedDomain:
+ """Create a new reserved domain.
+
+ :param 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 region: reserve the domain in this geographic ngrok datacenter. Optional, default is us. (au, eu, ap, us, jp, in, sa)
+ :param description: human-readable description of what this reserved domain will be used for
+ :param metadata: arbitrary user-defined machine-readable data of this reserved domain. Optional, max 4096 bytes.
+ :param http_endpoint_configuration_id: ID of an endpoint configuration of type http that will be used to handle inbound http traffic to this domain
+ :param https_endpoint_configuration_id: ID of an endpoint configuration of type https that will be used to handle inbound https traffic to this domain
+ :param 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 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`.
+ """
+ path = "/reserved_domains"
+ result = self._client.api_client.post(
+ path,
+ dict(
+ name=name,
+ region=region,
+ description=description,
+ metadata=metadata,
+ http_endpoint_configuration_id=http_endpoint_configuration_id,
+ https_endpoint_configuration_id=https_endpoint_configuration_id,
+ certificate_id=certificate_id,
+ certificate_management_policy=certificate_management_policy,
+ ),
+ )
+ return ReservedDomain(self._client, result)
+
+[docs] def delete(
+ self,
+ id: str,
+ ):
+ """Delete a reserved domain.
+
+ :param id: a resource identifier
+ """
+ path = "/reserved_domains/{id}"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> ReservedDomain:
+ """Get the details of a reserved domain.
+
+ :param id: a resource identifier
+ """
+ path = "/reserved_domains/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return ReservedDomain(self._client, result)
+
+[docs] def list(
+ self,
+ before_id: str = None,
+ limit: str = None,
+ ) -> ReservedDomainList:
+ """List all reserved domains on this account.
+
+ :param before_id:
+ :param limit:
+ """
+ path = "/reserved_domains"
+ result = self._client.api_client.get(
+ path,
+ dict(
+ before_id=before_id,
+ limit=limit,
+ ),
+ )
+ return ReservedDomainList(self._client, result)
+
+[docs] def update(
+ self,
+ id: str,
+ description: str = None,
+ metadata: str = None,
+ http_endpoint_configuration_id: str = None,
+ https_endpoint_configuration_id: str = None,
+ certificate_id: str = None,
+ certificate_management_policy: ReservedDomainCertPolicy = None,
+ ) -> ReservedDomain:
+ """Update the attributes of a reserved domain.
+
+ :param id:
+ :param description: human-readable description of what this reserved domain will be used for
+ :param metadata: arbitrary user-defined machine-readable data of this reserved domain. Optional, max 4096 bytes.
+ :param http_endpoint_configuration_id: ID of an endpoint configuration of type http that will be used to handle inbound http traffic to this domain
+ :param https_endpoint_configuration_id: ID of an endpoint configuration of type https that will be used to handle inbound https traffic to this domain
+ :param 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 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`.
+ """
+ path = "/reserved_domains/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.patch(
+ path,
+ dict(
+ description=description,
+ metadata=metadata,
+ http_endpoint_configuration_id=http_endpoint_configuration_id,
+ https_endpoint_configuration_id=https_endpoint_configuration_id,
+ certificate_id=certificate_id,
+ certificate_management_policy=certificate_management_policy,
+ ),
+ )
+ return ReservedDomain(self._client, result)
+
+[docs] def delete_certificate_management_policy(
+ self,
+ id: str,
+ ):
+ """Detach the certificate management policy attached to a reserved domain.
+
+ :param id: a resource identifier
+ """
+ path = "/reserved_domains/{id}/certificate_management_policy"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+[docs] def delete_certificate(
+ self,
+ id: str,
+ ):
+ """Detach the certificate attached to a reserved domain.
+
+ :param id: a resource identifier
+ """
+ path = "/reserved_domains/{id}/certificate"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+[docs] def delete_http_endpoint_config(
+ self,
+ id: str,
+ ):
+ """Detach the http endpoint configuration attached to a reserved domain.
+
+ :param id: a resource identifier
+ """
+ path = "/reserved_domains/{id}/http_endpoint_configuration"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+[docs] def delete_https_endpoint_config(
+ self,
+ id: str,
+ ):
+ """Detach the https endpoint configuration attached to a reserved domain.
+
+ :param id: a resource identifier
+ """
+ path = "/reserved_domains/{id}/https_endpoint_configuration"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+
+[docs]class SSHCertificateAuthoritiesClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def create(
+ self,
+ description: str = "",
+ metadata: str = "",
+ private_key_type: str = "",
+ elliptic_curve: str = "",
+ key_size: int = 0,
+ ) -> SSHCertificateAuthority:
+ """Create a new SSH Certificate Authority
+
+ :param description: human-readable description of this SSH Certificate Authority. optional, max 255 bytes.
+ :param metadata: arbitrary user-defined machine-readable data of this SSH Certificate Authority. optional, max 4096 bytes.
+ :param private_key_type: the type of private key to generate. one of <code>rsa</code>, <code>ecdsa</code>, <code>ed25519</code>
+ :param elliptic_curve: the type of elliptic curve to use when creating an ECDSA key
+ :param key_size: the key size to use when creating an RSA key. one of <code>2048</code> or <code>4096</code>
+ """
+ path = "/ssh_certificate_authorities"
+ result = self._client.api_client.post(
+ path,
+ dict(
+ description=description,
+ metadata=metadata,
+ private_key_type=private_key_type,
+ elliptic_curve=elliptic_curve,
+ key_size=key_size,
+ ),
+ )
+ return SSHCertificateAuthority(self._client, result)
+
+[docs] def delete(
+ self,
+ id: str,
+ ):
+ """Delete an SSH Certificate Authority
+
+ :param id: a resource identifier
+ """
+ path = "/ssh_certificate_authorities/{id}"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> SSHCertificateAuthority:
+ """Get detailed information about an SSH Certficate Authority
+
+ :param id: a resource identifier
+ """
+ path = "/ssh_certificate_authorities/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return SSHCertificateAuthority(self._client, result)
+
+[docs] def list(
+ self,
+ before_id: str = None,
+ limit: str = None,
+ ) -> SSHCertificateAuthorityList:
+ """List all SSH Certificate Authorities on this account
+
+ :param before_id:
+ :param limit:
+ """
+ path = "/ssh_certificate_authorities"
+ result = self._client.api_client.get(
+ path,
+ dict(
+ before_id=before_id,
+ limit=limit,
+ ),
+ )
+ return SSHCertificateAuthorityList(self._client, result)
+
+[docs] def update(
+ self,
+ id: str,
+ description: str = None,
+ metadata: str = None,
+ ) -> SSHCertificateAuthority:
+ """Update an SSH Certificate Authority
+
+ :param id:
+ :param description: human-readable description of this SSH Certificate Authority. optional, max 255 bytes.
+ :param metadata: arbitrary user-defined machine-readable data of this SSH Certificate Authority. optional, max 4096 bytes.
+ """
+ path = "/ssh_certificate_authorities/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.patch(
+ path,
+ dict(
+ description=description,
+ metadata=metadata,
+ ),
+ )
+ return SSHCertificateAuthority(self._client, result)
+
+
+[docs]class SSHCredentialsClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def create(
+ self,
+ public_key: str,
+ description: str = "",
+ metadata: str = "",
+ acl: Sequence[str] = [],
+ ) -> SSHCredential:
+ """Create a new ssh_credential from an uploaded public SSH key. This ssh credential can be used to start new tunnels via ngrok's SSH gateway.
+
+ :param description: human-readable description of who or what will use the ssh credential to authenticate. Optional, max 255 bytes.
+ :param metadata: arbitrary user-defined machine-readable data of this ssh credential. Optional, max 4096 bytes.
+ :param acl: optional list of ACL rules. If unspecified, the credential will have no restrictions. The only allowed ACL rule at this time is the <code>bind</code> rule. The <code>bind</code> rule allows the caller to restrict what domains and addresses the token is allowed to bind. For example, to allow the token to open a tunnel on example.ngrok.io your ACL would include the rule <code>bind:example.ngrok.io</code>. Bind rules may specify a leading wildcard to match multiple domains with a common suffix. For example, you may specify a rule of <code>bind:*.example.com</code> which will allow <code>x.example.com</code>, <code>y.example.com</code>, <code>*.example.com</code>, etc. A rule of <code>'*'</code> is equivalent to no acl at all and will explicitly permit all actions.
+ :param public_key: the PEM-encoded public key of the SSH keypair that will be used to authenticate
+ """
+ path = "/ssh_credentials"
+ result = self._client.api_client.post(
+ path,
+ dict(
+ description=description,
+ metadata=metadata,
+ acl=acl,
+ public_key=public_key,
+ ),
+ )
+ return SSHCredential(self._client, result)
+
+[docs] def delete(
+ self,
+ id: str,
+ ):
+ """Delete an ssh_credential by ID
+
+ :param id: a resource identifier
+ """
+ path = "/ssh_credentials/{id}"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> SSHCredential:
+ """Get detailed information about an ssh_credential
+
+ :param id: a resource identifier
+ """
+ path = "/ssh_credentials/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return SSHCredential(self._client, result)
+
+[docs] def list(
+ self,
+ before_id: str = None,
+ limit: str = None,
+ ) -> SSHCredentialList:
+ """List all ssh credentials on this account
+
+ :param before_id:
+ :param limit:
+ """
+ path = "/ssh_credentials"
+ result = self._client.api_client.get(
+ path,
+ dict(
+ before_id=before_id,
+ limit=limit,
+ ),
+ )
+ return SSHCredentialList(self._client, result)
+
+[docs] def update(
+ self,
+ id: str,
+ description: str = None,
+ metadata: str = None,
+ acl: Sequence[str] = None,
+ ) -> SSHCredential:
+ """Update attributes of an ssh_credential by ID
+
+ :param id:
+ :param description: human-readable description of who or what will use the ssh credential to authenticate. Optional, max 255 bytes.
+ :param metadata: arbitrary user-defined machine-readable data of this ssh credential. Optional, max 4096 bytes.
+ :param acl: optional list of ACL rules. If unspecified, the credential will have no restrictions. The only allowed ACL rule at this time is the <code>bind</code> rule. The <code>bind</code> rule allows the caller to restrict what domains and addresses the token is allowed to bind. For example, to allow the token to open a tunnel on example.ngrok.io your ACL would include the rule <code>bind:example.ngrok.io</code>. Bind rules may specify a leading wildcard to match multiple domains with a common suffix. For example, you may specify a rule of <code>bind:*.example.com</code> which will allow <code>x.example.com</code>, <code>y.example.com</code>, <code>*.example.com</code>, etc. A rule of <code>'*'</code> is equivalent to no acl at all and will explicitly permit all actions.
+ """
+ path = "/ssh_credentials/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.patch(
+ path,
+ dict(
+ description=description,
+ metadata=metadata,
+ acl=acl,
+ ),
+ )
+ return SSHCredential(self._client, result)
+
+
+[docs]class SSHHostCertificatesClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def create(
+ self,
+ ssh_certificate_authority_id: str,
+ public_key: str,
+ principals: Sequence[str] = [],
+ valid_after: str = "",
+ valid_until: str = "",
+ description: str = "",
+ metadata: str = "",
+ ) -> SSHHostCertificate:
+ """Create a new SSH Host Certificate
+
+ :param ssh_certificate_authority_id: the ssh certificate authority that is used to sign this ssh host certificate
+ :param public_key: a public key in OpenSSH Authorized Keys format that this certificate signs
+ :param principals: the list of principals included in the ssh host certificate. This is the list of hostnames and/or IP addresses that are authorized to serve SSH traffic with this certificate. Dangerously, if no principals are specified, this certificate is considered valid for all hosts.
+ :param valid_after: The time when the host certificate becomes valid, in RFC 3339 format. Defaults to the current time if unspecified.
+ :param valid_until: The time when this host certificate becomes invalid, in RFC 3339 format. If unspecified, a default value of one year in the future will be used. The OpenSSH certificates RFC calls this <code>valid_before</code>.
+ :param description: human-readable description of this SSH Host Certificate. optional, max 255 bytes.
+ :param metadata: arbitrary user-defined machine-readable data of this SSH Host Certificate. optional, max 4096 bytes.
+ """
+ path = "/ssh_host_certificates"
+ result = self._client.api_client.post(
+ path,
+ dict(
+ ssh_certificate_authority_id=ssh_certificate_authority_id,
+ public_key=public_key,
+ principals=principals,
+ valid_after=valid_after,
+ valid_until=valid_until,
+ description=description,
+ metadata=metadata,
+ ),
+ )
+ return SSHHostCertificate(self._client, result)
+
+[docs] def delete(
+ self,
+ id: str,
+ ):
+ """Delete an SSH Host Certificate
+
+ :param id: a resource identifier
+ """
+ path = "/ssh_host_certificates/{id}"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> SSHHostCertificate:
+ """Get detailed information about an SSH Host Certficate
+
+ :param id: a resource identifier
+ """
+ path = "/ssh_host_certificates/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return SSHHostCertificate(self._client, result)
+
+[docs] def list(
+ self,
+ before_id: str = None,
+ limit: str = None,
+ ) -> SSHHostCertificateList:
+ """List all SSH Host Certificates issued on this account
+
+ :param before_id:
+ :param limit:
+ """
+ path = "/ssh_host_certificates"
+ result = self._client.api_client.get(
+ path,
+ dict(
+ before_id=before_id,
+ limit=limit,
+ ),
+ )
+ return SSHHostCertificateList(self._client, result)
+
+[docs] def update(
+ self,
+ id: str,
+ description: str = None,
+ metadata: str = None,
+ ) -> SSHHostCertificate:
+ """Update an SSH Host Certificate
+
+ :param id:
+ :param description: human-readable description of this SSH Host Certificate. optional, max 255 bytes.
+ :param metadata: arbitrary user-defined machine-readable data of this SSH Host Certificate. optional, max 4096 bytes.
+ """
+ path = "/ssh_host_certificates/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.patch(
+ path,
+ dict(
+ description=description,
+ metadata=metadata,
+ ),
+ )
+ return SSHHostCertificate(self._client, result)
+
+
+[docs]class SSHUserCertificatesClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def create(
+ self,
+ ssh_certificate_authority_id: str,
+ public_key: str,
+ principals: Sequence[str] = [],
+ critical_options: Mapping[str, str] = {},
+ extensions: Mapping[str, str] = {},
+ valid_after: str = "",
+ valid_until: str = "",
+ description: str = "",
+ metadata: str = "",
+ ) -> SSHUserCertificate:
+ """Create a new SSH User Certificate
+
+ :param ssh_certificate_authority_id: the ssh certificate authority that is used to sign this ssh user certificate
+ :param public_key: a public key in OpenSSH Authorized Keys format that this certificate signs
+ :param principals: the list of principals included in the ssh user certificate. This is the list of usernames that the certificate holder may sign in as on a machine authorizinig the signing certificate authority. Dangerously, if no principals are specified, this certificate may be used to log in as any user.
+ :param critical_options: A map of critical options included in the certificate. Only two critical options are currently defined by OpenSSH: <code>force-command</code> and <code>source-address</code>. See <a href="https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.certkeys">the OpenSSH certificate protocol spec</a> for additional details.
+ :param extensions: A map of extensions included in the certificate. Extensions are additional metadata that can be interpreted by the SSH server for any purpose. These can be used to permit or deny the ability to open a terminal, do port forwarding, x11 forwarding, and more. If unspecified, the certificate will include limited permissions with the following extension map: <code>{"permit-pty": "", "permit-user-rc": ""}</code> OpenSSH understands a number of predefined extensions. See <a href="https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.certkeys">the OpenSSH certificate protocol spec</a> for additional details.
+ :param valid_after: The time when the user certificate becomes valid, in RFC 3339 format. Defaults to the current time if unspecified.
+ :param valid_until: The time when this host certificate becomes invalid, in RFC 3339 format. If unspecified, a default value of 24 hours will be used. The OpenSSH certificates RFC calls this <code>valid_before</code>.
+ :param description: human-readable description of this SSH User Certificate. optional, max 255 bytes.
+ :param metadata: arbitrary user-defined machine-readable data of this SSH User Certificate. optional, max 4096 bytes.
+ """
+ path = "/ssh_user_certificates"
+ result = self._client.api_client.post(
+ path,
+ dict(
+ ssh_certificate_authority_id=ssh_certificate_authority_id,
+ public_key=public_key,
+ principals=principals,
+ critical_options=critical_options,
+ extensions=extensions,
+ valid_after=valid_after,
+ valid_until=valid_until,
+ description=description,
+ metadata=metadata,
+ ),
+ )
+ return SSHUserCertificate(self._client, result)
+
+[docs] def delete(
+ self,
+ id: str,
+ ):
+ """Delete an SSH User Certificate
+
+ :param id: a resource identifier
+ """
+ path = "/ssh_user_certificates/{id}"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> SSHUserCertificate:
+ """Get detailed information about an SSH User Certficate
+
+ :param id: a resource identifier
+ """
+ path = "/ssh_user_certificates/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return SSHUserCertificate(self._client, result)
+
+[docs] def list(
+ self,
+ before_id: str = None,
+ limit: str = None,
+ ) -> SSHUserCertificateList:
+ """List all SSH User Certificates issued on this account
+
+ :param before_id:
+ :param limit:
+ """
+ path = "/ssh_user_certificates"
+ result = self._client.api_client.get(
+ path,
+ dict(
+ before_id=before_id,
+ limit=limit,
+ ),
+ )
+ return SSHUserCertificateList(self._client, result)
+
+[docs] def update(
+ self,
+ id: str,
+ description: str = None,
+ metadata: str = None,
+ ) -> SSHUserCertificate:
+ """Update an SSH User Certificate
+
+ :param id:
+ :param description: human-readable description of this SSH User Certificate. optional, max 255 bytes.
+ :param metadata: arbitrary user-defined machine-readable data of this SSH User Certificate. optional, max 4096 bytes.
+ """
+ path = "/ssh_user_certificates/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.patch(
+ path,
+ dict(
+ description=description,
+ metadata=metadata,
+ ),
+ )
+ return SSHUserCertificate(self._client, result)
+
+
+[docs]class TLSCertificatesClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def create(
+ self,
+ certificate_pem: str,
+ private_key_pem: str,
+ description: str = "",
+ metadata: str = "",
+ ) -> TLSCertificate:
+ """Upload a new TLS certificate
+
+ :param description: human-readable description of this TLS certificate. optional, max 255 bytes.
+ :param metadata: arbitrary user-defined machine-readable data of this TLS certificate. optional, max 4096 bytes.
+ :param certificate_pem: chain of PEM-encoded certificates, leaf first. See <a href="#tls-certificates-pem">Certificate Bundles</a>.
+ :param private_key_pem: private key for the TLS certificate, PEM-encoded. See <a href="#tls-certificates-key">Private Keys</a>.
+ """
+ path = "/tls_certificates"
+ result = self._client.api_client.post(
+ path,
+ dict(
+ description=description,
+ metadata=metadata,
+ certificate_pem=certificate_pem,
+ private_key_pem=private_key_pem,
+ ),
+ )
+ return TLSCertificate(self._client, result)
+
+[docs] def delete(
+ self,
+ id: str,
+ ):
+ """Delete a TLS certificate
+
+ :param id: a resource identifier
+ """
+ path = "/tls_certificates/{id}"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.delete(path, dict())
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> TLSCertificate:
+ """Get detailed information about a TLS certificate
+
+ :param id: a resource identifier
+ """
+ path = "/tls_certificates/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return TLSCertificate(self._client, result)
+
+[docs] def list(
+ self,
+ before_id: str = None,
+ limit: str = None,
+ ) -> TLSCertificateList:
+ """List all TLS certificates on this account
+
+ :param before_id:
+ :param limit:
+ """
+ path = "/tls_certificates"
+ result = self._client.api_client.get(
+ path,
+ dict(
+ before_id=before_id,
+ limit=limit,
+ ),
+ )
+ return TLSCertificateList(self._client, result)
+
+[docs] def update(
+ self,
+ id: str,
+ description: str = None,
+ metadata: str = None,
+ ) -> TLSCertificate:
+ """Update attributes of a TLS Certificate by ID
+
+ :param id:
+ :param description: human-readable description of this TLS certificate. optional, max 255 bytes.
+ :param metadata: arbitrary user-defined machine-readable data of this TLS certificate. optional, max 4096 bytes.
+ """
+ path = "/tls_certificates/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.patch(
+ path,
+ dict(
+ description=description,
+ metadata=metadata,
+ ),
+ )
+ return TLSCertificate(self._client, result)
+
+
+[docs]class TunnelSessionsClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def list(
+ self,
+ before_id: str = None,
+ limit: str = None,
+ ) -> TunnelSessionList:
+ """List all online tunnel sessions running on this account.
+
+ :param before_id:
+ :param limit:
+ """
+ path = "/tunnel_sessions"
+ result = self._client.api_client.get(
+ path,
+ dict(
+ before_id=before_id,
+ limit=limit,
+ ),
+ )
+ return TunnelSessionList(self._client, result)
+
+[docs] def get(
+ self,
+ id: str,
+ ) -> TunnelSession:
+ """Get the detailed status of a tunnel session by ID
+
+ :param id: a resource identifier
+ """
+ path = "/tunnel_sessions/{id}"
+ path = path.format(
+ id=id,
+ )
+ result = self._client.api_client.get(path, dict())
+ return TunnelSession(self._client, result)
+
+[docs] def restart(
+ self,
+ id: str,
+ ):
+ """Issues a command instructing the ngrok agent to restart. The agent restarts itself by calling exec() on platforms that support it. This operation is notably not supported on Windows. When an agent restarts, it reconnects with a new tunnel session ID.
+
+ :param id: a resource identifier
+ """
+ path = "/tunnel_sessions/{id}/restart"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.post(path, dict())
+
+[docs] def stop(
+ self,
+ id: str,
+ ):
+ """Issues a command instructing the ngrok agent that started this tunnel session to exit.
+
+ :param id: a resource identifier
+ """
+ path = "/tunnel_sessions/{id}/stop"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.post(path, dict())
+
+[docs] def update(
+ self,
+ id: str,
+ ):
+ """Issues a command instructing the ngrok agent to update itself to the latest version. After this call completes successfully, the ngrok agent will be in the update process. A caller should wait some amount of time to allow the update to complete (at least 10 seconds) before making a call to the Restart endpoint to request that the agent restart itself to start using the new code. This call will never update an ngrok agent to a new major version which could cause breaking compatibility issues. If you wish to update to a new major version, that must be done manually. Still, please be aware that updating your ngrok agent could break your integration. This call will fail in any of the following circumstances: there is no update available the ngrok agent's configuration disabled update checks the agent is currently in process of updating the agent has already successfully updated but has not yet been restarted
+
+ :param id:
+ """
+ path = "/tunnel_sessions/{id}/update"
+ path = path.format(
+ id=id,
+ )
+ self._client.api_client.post(path, dict())
+
+
+[docs]class TunnelsClient(object):
+ def __init__(self, client):
+ self._client = client
+
+[docs] def list(
+ self,
+ before_id: str = None,
+ limit: str = None,
+ ) -> TunnelList:
+ """List all online tunnels currently running on the account.
+
+ :param before_id:
+ :param limit:
+ """
+ path = "/tunnels"
+ result = self._client.api_client.get(
+ path,
+ dict(
+ before_id=before_id,
+ limit=limit,
+ ),
+ )
+ return TunnelList(self._client, result)
+