diff --git a/doc/source/index.rst b/doc/source/index.rst index d20c758..da90c86 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -129,41 +129,9 @@ API Reference application_sessions application_users tunnel_sessions - failover_backends - http_response_backends - static_backends - tunnel_group_backends - weighted_backends bot_users certificate_authorities credentials - edges_https_routes - edges_https - https_edge_mutual_tls_module - https_edge_tls_termination_module - edge_route_backend_module - edge_route_ip_restriction_module - edge_route_request_headers_module - edge_route_response_headers_module - edge_route_compression_module - edge_route_circuit_breaker_module - edge_route_webhook_verification_module - edge_route_o_auth_module - edge_route_saml_module - edge_route_oidc_module - edge_route_websocket_tcp_converter_module - edge_route_user_agent_filter_module - edge_route_traffic_policy_module - edges_tcp - tcp_edge_backend_module - tcp_edge_ip_restriction_module - tcp_edge_traffic_policy_module - edges_tls - tls_edge_backend_module - tls_edge_ip_restriction_module - tls_edge_mutual_tls_module - tls_edge_tls_termination_module - tls_edge_traffic_policy_module endpoints event_destinations event_subscriptions diff --git a/ngrok/client.py b/ngrok/client.py index ce75648..d1396db 100644 --- a/ngrok/client.py +++ b/ngrok/client.py @@ -174,105 +174,3 @@ class Client(object): def vaults(self) -> VaultsClient: """Vaults is an api service for securely storing and managing sensitive data such as secrets, credentials, and tokens.""" return VaultsClient(self) - - @property - def backends(self): - ns = collections.namedtuple( - "Namespace", - [ - "failover", - "http_response", - "static_address", - "tunnel_group", - "weighted", - ], - ) - return ns( - failover=FailoverBackendsClient(self), - http_response=HTTPResponseBackendsClient(self), - static_address=StaticBackendsClient(self), - tunnel_group=TunnelGroupBackendsClient(self), - weighted=WeightedBackendsClient(self), - ) - - @property - def edges(self): - ns = collections.namedtuple( - "Namespace", - [ - "https_routes", - "https", - "tcp", - "tls", - ], - ) - return ns( - https_routes=EdgesHTTPSRoutesClient(self), - https=EdgesHTTPSClient(self), - tcp=EdgesTCPClient(self), - tls=EdgesTLSClient(self), - ) - - @property - def edge_modules(self): - ns = collections.namedtuple( - "Namespace", - [ - "https_edge_mutual_tls", - "https_edge_tls_termination", - "https_edge_route_backend", - "https_edge_route_ip_restriction", - "https_edge_route_request_headers", - "https_edge_route_response_headers", - "https_edge_route_compression", - "https_edge_route_circuit_breaker", - "https_edge_route_webhook_verification", - "https_edge_route_oauth", - "https_edge_route_saml", - "https_edge_route_oidc", - "https_edge_route_websocket_tcp_converter", - "https_edge_route_user_agent_filter", - "https_edge_route_traffic_policy", - "tcp_edge_backend", - "tcp_edge_ip_restriction", - "tcp_edge_traffic_policy", - "tls_edge_backend", - "tls_edge_ip_restriction", - "tls_edge_mutual_tls", - "tls_edge_tls_termination", - "tls_edge_traffic_policy", - ], - ) - return ns( - https_edge_mutual_tls=HTTPSEdgeMutualTLSModuleClient(self), - https_edge_tls_termination=HTTPSEdgeTLSTerminationModuleClient(self), - https_edge_route_backend=EdgeRouteBackendModuleClient(self), - https_edge_route_ip_restriction=EdgeRouteIPRestrictionModuleClient(self), - https_edge_route_request_headers=EdgeRouteRequestHeadersModuleClient(self), - https_edge_route_response_headers=EdgeRouteResponseHeadersModuleClient( - self - ), - https_edge_route_compression=EdgeRouteCompressionModuleClient(self), - https_edge_route_circuit_breaker=EdgeRouteCircuitBreakerModuleClient(self), - https_edge_route_webhook_verification=EdgeRouteWebhookVerificationModuleClient( - self - ), - https_edge_route_oauth=EdgeRouteOAuthModuleClient(self), - https_edge_route_saml=EdgeRouteSAMLModuleClient(self), - https_edge_route_oidc=EdgeRouteOIDCModuleClient(self), - https_edge_route_websocket_tcp_converter=EdgeRouteWebsocketTCPConverterModuleClient( - self - ), - https_edge_route_user_agent_filter=EdgeRouteUserAgentFilterModuleClient( - self - ), - https_edge_route_traffic_policy=EdgeRouteTrafficPolicyModuleClient(self), - tcp_edge_backend=TCPEdgeBackendModuleClient(self), - tcp_edge_ip_restriction=TCPEdgeIPRestrictionModuleClient(self), - tcp_edge_traffic_policy=TCPEdgeTrafficPolicyModuleClient(self), - tls_edge_backend=TLSEdgeBackendModuleClient(self), - tls_edge_ip_restriction=TLSEdgeIPRestrictionModuleClient(self), - tls_edge_mutual_tls=TLSEdgeMutualTLSModuleClient(self), - tls_edge_tls_termination=TLSEdgeTLSTerminationModuleClient(self), - tls_edge_traffic_policy=TLSEdgeTrafficPolicyModuleClient(self), - ) diff --git a/ngrok/datatypes.py b/ngrok/datatypes.py index bab3a76..90e9a92 100644 --- a/ngrok/datatypes.py +++ b/ngrok/datatypes.py @@ -945,573 +945,6 @@ class TunnelSessionList(object): return self._props["next_page_uri"] -class FailoverBackend(object): - def __init__(self, client, props): - self._client = client - self._props = props - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - def delete( - self, - ): - self._client.backends.failover.delete( - id=self.id, - ) - - def update( - self, - description: str = None, - metadata: str = None, - backends: Sequence[str] = [], - ): - self._client.backends.failover.update( - id=self.id, - description=description, - metadata=metadata, - backends=backends, - ) - - @property - def id(self) -> str: - """unique identifier for this Failover backend""" - return self._props["id"] - - @property - def uri(self) -> str: - """URI of the FailoverBackend API resource""" - return self._props["uri"] - - @property - def created_at(self) -> datetime: - """timestamp when the backend was created, RFC 3339 format""" - return self._props["created_at"] - - @property - def description(self) -> str: - """human-readable description of this backend. Optional""" - return self._props["description"] - - @property - def metadata(self) -> str: - """arbitrary user-defined machine-readable data of this backend. Optional""" - return self._props["metadata"] - - @property - def backends(self) -> Sequence[str]: - """the ids of the child backends in order""" - return self._props["backends"] - - -class FailoverBackendList(object): - def __init__(self, client, props): - self._client = client - self._props = props - self._props["backends"] = ( - [FailoverBackend(client, x) for x in props["backends"]] - if props.get("backends") is not None - else [] - ) - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - def __iter__(self): - return PagedIterator(self._client, self, "backends") - - @property - def backends(self) -> Sequence[FailoverBackend]: - """the list of all Failover backends on this account""" - return self._props["backends"] - - @property - def uri(self) -> str: - """URI of the Failover backends 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"] - - -class HTTPResponseBackend(object): - def __init__(self, client, props): - self._client = client - self._props = props - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - def delete( - self, - ): - self._client.backends.http_response.delete( - id=self.id, - ) - - def update( - self, - description: str = None, - metadata: str = None, - body: str = None, - headers: Mapping[str, str] = None, - status_code: int = None, - ): - self._client.backends.http_response.update( - id=self.id, - description=description, - metadata=metadata, - body=body, - headers=headers, - status_code=status_code, - ) - - @property - def id(self) -> str: - return self._props["id"] - - @property - def uri(self) -> str: - """URI of the HTTPResponseBackend API resource""" - return self._props["uri"] - - @property - def created_at(self) -> datetime: - """timestamp when the backend was created, RFC 3339 format""" - return self._props["created_at"] - - @property - def description(self) -> str: - """human-readable description of this backend. Optional""" - return self._props["description"] - - @property - def metadata(self) -> str: - """arbitrary user-defined machine-readable data of this backend. Optional""" - return self._props["metadata"] - - @property - def body(self) -> str: - """body to return as fixed content""" - return self._props["body"] - - @property - def headers(self) -> Mapping[str, str]: - """headers to return""" - return self._props["headers"] - - @property - def status_code(self) -> int: - """status code to return""" - return self._props["status_code"] - - -class HTTPResponseBackendList(object): - def __init__(self, client, props): - self._client = client - self._props = props - self._props["backends"] = ( - [HTTPResponseBackend(client, x) for x in props["backends"]] - if props.get("backends") is not None - else [] - ) - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - def __iter__(self): - return PagedIterator(self._client, self, "backends") - - @property - def backends(self) -> Sequence[HTTPResponseBackend]: - return self._props["backends"] - - @property - def uri(self) -> str: - return self._props["uri"] - - @property - def next_page_uri(self) -> str: - return self._props["next_page_uri"] - - -class StaticBackend(object): - def __init__(self, client, props): - self._client = client - self._props = props - self._props["tls"] = ( - StaticBackendTLS(client, props["tls"]) - if props.get("tls") is not None - else None - ) - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - def delete( - self, - ): - self._client.backends.static_address.delete( - id=self.id, - ) - - def update( - self, - description: str = None, - metadata: str = None, - address: str = "", - tls: StaticBackendTLS = None, - ): - self._client.backends.static_address.update( - id=self.id, - description=description, - metadata=metadata, - address=address, - tls=tls, - ) - - @property - def id(self) -> str: - """unique identifier for this static backend""" - return self._props["id"] - - @property - def uri(self) -> str: - """URI of the StaticBackend API resource""" - return self._props["uri"] - - @property - def created_at(self) -> datetime: - """timestamp when the backend was created, RFC 3339 format""" - return self._props["created_at"] - - @property - def description(self) -> str: - """human-readable description of this backend. Optional""" - return self._props["description"] - - @property - def metadata(self) -> str: - """arbitrary user-defined machine-readable data of this backend. Optional""" - return self._props["metadata"] - - @property - def address(self) -> str: - """the address to forward to""" - return self._props["address"] - - @property - def tls(self) -> StaticBackendTLS: - """tls configuration to use""" - return self._props["tls"] - - -class StaticBackendTLS(object): - def __init__(self, client, props): - self._client = client - self._props = props - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - @property - def enabled(self) -> bool: - """if TLS is checked""" - return self._props["enabled"] - - -class StaticBackendList(object): - def __init__(self, client, props): - self._client = client - self._props = props - self._props["backends"] = ( - [StaticBackend(client, x) for x in props["backends"]] - if props.get("backends") is not None - else [] - ) - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - def __iter__(self): - return PagedIterator(self._client, self, "backends") - - @property - def backends(self) -> Sequence[StaticBackend]: - """the list of all static backends on this account""" - return self._props["backends"] - - @property - def uri(self) -> str: - """URI of the static backends 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"] - - -class TunnelGroupBackend(object): - def __init__(self, client, props): - self._client = client - self._props = props - self._props["tunnels"] = ( - [Ref(client, x) for x in props["tunnels"]] - if props.get("tunnels") is not None - else [] - ) - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - def delete( - self, - ): - self._client.backends.tunnel_group.delete( - id=self.id, - ) - - def update( - self, - description: str = None, - metadata: str = None, - labels: Mapping[str, str] = {}, - ): - self._client.backends.tunnel_group.update( - id=self.id, - description=description, - metadata=metadata, - labels=labels, - ) - - @property - def id(self) -> str: - """unique identifier for this TunnelGroup backend""" - return self._props["id"] - - @property - def uri(self) -> str: - """URI of the TunnelGroupBackend API resource""" - return self._props["uri"] - - @property - def created_at(self) -> datetime: - """timestamp when the backend was created, RFC 3339 format""" - return self._props["created_at"] - - @property - def description(self) -> str: - """human-readable description of this backend. Optional""" - return self._props["description"] - - @property - def metadata(self) -> str: - """arbitrary user-defined machine-readable data of this backend. Optional""" - return self._props["metadata"] - - @property - def labels(self) -> Mapping[str, str]: - """labels to watch for tunnels on, e.g. app->foo, dc->bar""" - return self._props["labels"] - - @property - def tunnels(self) -> Sequence[Ref]: - """tunnels matching this backend""" - return self._props["tunnels"] - - -class TunnelGroupBackendList(object): - def __init__(self, client, props): - self._client = client - self._props = props - self._props["backends"] = ( - [TunnelGroupBackend(client, x) for x in props["backends"]] - if props.get("backends") is not None - else [] - ) - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - def __iter__(self): - return PagedIterator(self._client, self, "backends") - - @property - def backends(self) -> Sequence[TunnelGroupBackend]: - """the list of all TunnelGroup backends on this account""" - return self._props["backends"] - - @property - def uri(self) -> str: - """URI of the TunnelGroup backends 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"] - - -class WeightedBackend(object): - def __init__(self, client, props): - self._client = client - self._props = props - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - def delete( - self, - ): - self._client.backends.weighted.delete( - id=self.id, - ) - - def update( - self, - description: str = None, - metadata: str = None, - backends: Mapping[str, int] = {}, - ): - self._client.backends.weighted.update( - id=self.id, - description=description, - metadata=metadata, - backends=backends, - ) - - @property - def id(self) -> str: - """unique identifier for this Weighted backend""" - return self._props["id"] - - @property - def uri(self) -> str: - """URI of the WeightedBackend API resource""" - return self._props["uri"] - - @property - def created_at(self) -> datetime: - """timestamp when the backend was created, RFC 3339 format""" - return self._props["created_at"] - - @property - def description(self) -> str: - """human-readable description of this backend. Optional""" - return self._props["description"] - - @property - def metadata(self) -> str: - """arbitrary user-defined machine-readable data of this backend. Optional""" - return self._props["metadata"] - - @property - def backends(self) -> Mapping[str, int]: - """the ids of the child backends to their weights [0-10000]""" - return self._props["backends"] - - -class WeightedBackendList(object): - def __init__(self, client, props): - self._client = client - self._props = props - self._props["backends"] = ( - [WeightedBackend(client, x) for x in props["backends"]] - if props.get("backends") is not None - else [] - ) - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - def __iter__(self): - return PagedIterator(self._client, self, "backends") - - @property - def backends(self) -> Sequence[WeightedBackend]: - """the list of all Weighted backends on this account""" - return self._props["backends"] - - @property - def uri(self) -> str: - """URI of the Weighted backends 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"] - - class BotUser(object): def __init__(self, client, props): self._client = client @@ -1847,1800 +1280,6 @@ class CredentialList(object): return self._props["next_page_uri"] -class EndpointWebhookValidation(object): - def __init__(self, client, props): - self._client = client - self._props = props - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format( - self.id, repr(self._props) - ) - else: - return "".format(repr(self._props)) - - @property - def enabled(self) -> bool: - """``true`` if the module will be applied to traffic, ``false`` to disable. default ``true`` 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 defined at `https://ngrok.com/docs/cloud-edge/modules/webhook-verification `_""" - 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"] - - -class EndpointCompression(object): - def __init__(self, client, props): - self._client = client - self._props = props - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - @property - def enabled(self) -> bool: - """``true`` if the module will be applied to traffic, ``false`` to disable. default ``true`` if unspecified""" - return self._props["enabled"] - - -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"]] - if props.get("certificate_authorities") is not None - else [] - ) - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - @property - def enabled(self) -> bool: - """``true`` if the module will be applied to traffic, ``false`` to disable. default ``true`` 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"] - - -class EndpointMutualTLSMutate(object): - def __init__(self, client, props): - self._client = client - self._props = props - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - @property - def enabled(self) -> bool: - """``true`` if the module will be applied to traffic, ``false`` to disable. default ``true`` 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 presented by the initiator of the TLS connection""" - return self._props["certificate_authority_ids"] - - -class EndpointTLSTermination(object): - def __init__(self, client, props): - self._client = client - self._props = props - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - @property - def enabled(self) -> bool: - """``true`` if the module will be applied to traffic, ``false`` to disable. default ``true`` if unspecified""" - return self._props["enabled"] - - @property - def terminate_at(self) -> str: - """``edge`` if the ngrok edge should terminate TLS traffic, ``upstream`` if TLS traffic should be passed through to the upstream ngrok agent / application server for termination. if ``upstream`` 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 ``terminate_at`` is set to ``upstream``.""" - return self._props["min_version"] - - -class EndpointTLSTerminationAtEdge(object): - def __init__(self, client, props): - self._client = client - self._props = props - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format( - self.id, repr(self._props) - ) - else: - return "".format(repr(self._props)) - - @property - def enabled(self) -> bool: - """``true`` if the module will be applied to traffic, ``false`` to disable. default ``true`` if unspecified""" - return self._props["enabled"] - - @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 ``terminate_at`` is set to ``upstream``.""" - return self._props["min_version"] - - -class EndpointRequestHeaders(object): - def __init__(self, client, props): - self._client = client - self._props = props - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - @property - def enabled(self) -> bool: - """``true`` if the module will be applied to traffic, ``false`` to disable. default ``true`` 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"] - - -class EndpointResponseHeaders(object): - def __init__(self, client, props): - self._client = client - self._props = props - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - @property - def enabled(self) -> bool: - """``true`` if the module will be applied to traffic, ``false`` to disable. default ``true`` 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"] - - -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"]] - if props.get("ip_policies") is not None - else [] - ) - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - @property - def enabled(self) -> bool: - """``true`` if the module will be applied to traffic, ``false`` to disable. default ``true`` if unspecified""" - return self._props["enabled"] - - @property - def ip_policies(self) -> Sequence[Ref]: - """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_policies"] - - -class EndpointIPPolicyMutate(object): - def __init__(self, client, props): - self._client = client - self._props = props - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - @property - def enabled(self) -> bool: - """``true`` if the module will be applied to traffic, ``false`` to disable. default ``true`` 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"] - - -class EndpointCircuitBreaker(object): - def __init__(self, client, props): - self._client = client - self._props = props - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - @property - def enabled(self) -> bool: - """``true`` if the module will be applied to traffic, ``false`` to disable. default ``true`` if unspecified""" - return self._props["enabled"] - - @property - def tripped_duration(self) -> timedelta: - """Integer number of seconds after which the circuit is tripped to wait before re-evaluating upstream health""" - return timedelta(seconds=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"] - - -class EndpointOAuth(object): - def __init__(self, client, props): - self._client = client - self._props = props - self._props["provider"] = ( - EndpointOAuthProvider(client, props["provider"]) - if props.get("provider") is not None - else None - ) - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - @property - def enabled(self) -> bool: - """``true`` if the module will be applied to traffic, ``false`` to disable. default ``true`` 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) -> timedelta: - """Integer number of seconds of the maximum duration of an authenticated session. After this period is exceeded, a user must reauthenticate.""" - return timedelta(seconds=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"] - - -class EndpointOAuthProvider(object): - def __init__(self, client, props): - self._client = client - self._props = props - self._props["github"] = ( - EndpointOAuthGitHub(client, props["github"]) - if props.get("github") is not None - else None - ) - self._props["facebook"] = ( - EndpointOAuthFacebook(client, props["facebook"]) - if props.get("facebook") is not None - else None - ) - self._props["microsoft"] = ( - EndpointOAuthMicrosoft(client, props["microsoft"]) - if props.get("microsoft") is not None - else None - ) - self._props["google"] = ( - EndpointOAuthGoogle(client, props["google"]) - if props.get("google") is not None - else None - ) - self._props["linkedin"] = ( - EndpointOAuthLinkedIn(client, props["linkedin"]) - if props.get("linkedin") is not None - else None - ) - self._props["gitlab"] = ( - EndpointOAuthGitLab(client, props["gitlab"]) - if props.get("gitlab") is not None - else None - ) - self._props["twitch"] = ( - EndpointOAuthTwitch(client, props["twitch"]) - if props.get("twitch") is not None - else None - ) - self._props["amazon"] = ( - EndpointOAuthAmazon(client, props["amazon"]) - if props.get("amazon") is not None - else None - ) - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - @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"] - - @property - def linkedin(self) -> EndpointOAuthLinkedIn: - """configuration for using linkedin as the identity provider""" - return self._props["linkedin"] - - @property - def gitlab(self) -> EndpointOAuthGitLab: - """configuration for using gitlab as the identity provider""" - return self._props["gitlab"] - - @property - def twitch(self) -> EndpointOAuthTwitch: - """configuration for using twitch as the identity provider""" - return self._props["twitch"] - - @property - def amazon(self) -> EndpointOAuthAmazon: - """configuration for using amazon as the identity provider""" - return self._props["amazon"] - - -class EndpointOAuthGitHub(object): - def __init__(self, client, props): - self._client = client - self._props = props - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - @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 ``client_id``.""" - 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 ``client_id`` and ``client_secret`` 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. ``org-name/team-name``""" - 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"] - - -class EndpointOAuthFacebook(object): - def __init__(self, client, props): - self._client = client - self._props = props - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - @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 ``client_id``.""" - 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 ``client_id`` and ``client_secret`` 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"] - - -class EndpointOAuthMicrosoft(object): - def __init__(self, client, props): - self._client = client - self._props = props - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - @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 ``client_id``.""" - 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 ``client_id`` and ``client_secret`` 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"] - - -class EndpointOAuthGoogle(object): - def __init__(self, client, props): - self._client = client - self._props = props - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - @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 ``client_id``.""" - 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 ``client_id`` and ``client_secret`` 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"] - - -class EndpointOAuthLinkedIn(object): - def __init__(self, client, props): - self._client = client - self._props = props - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - @property - def client_id(self) -> str: - return self._props["client_id"] - - @property - def client_secret(self) -> str: - return self._props["client_secret"] - - @property - def scopes(self) -> Sequence[str]: - return self._props["scopes"] - - @property - def email_addresses(self) -> Sequence[str]: - return self._props["email_addresses"] - - @property - def email_domains(self) -> Sequence[str]: - return self._props["email_domains"] - - -class EndpointOAuthGitLab(object): - def __init__(self, client, props): - self._client = client - self._props = props - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - @property - def client_id(self) -> str: - return self._props["client_id"] - - @property - def client_secret(self) -> str: - return self._props["client_secret"] - - @property - def scopes(self) -> Sequence[str]: - return self._props["scopes"] - - @property - def email_addresses(self) -> Sequence[str]: - return self._props["email_addresses"] - - @property - def email_domains(self) -> Sequence[str]: - return self._props["email_domains"] - - -class EndpointOAuthTwitch(object): - def __init__(self, client, props): - self._client = client - self._props = props - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - @property - def client_id(self) -> str: - return self._props["client_id"] - - @property - def client_secret(self) -> str: - return self._props["client_secret"] - - @property - def scopes(self) -> Sequence[str]: - return self._props["scopes"] - - @property - def email_addresses(self) -> Sequence[str]: - return self._props["email_addresses"] - - @property - def email_domains(self) -> Sequence[str]: - return self._props["email_domains"] - - -class EndpointOAuthAmazon(object): - def __init__(self, client, props): - self._client = client - self._props = props - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - @property - def client_id(self) -> str: - return self._props["client_id"] - - @property - def client_secret(self) -> str: - return self._props["client_secret"] - - @property - def scopes(self) -> Sequence[str]: - return self._props["scopes"] - - @property - def email_addresses(self) -> Sequence[str]: - return self._props["email_addresses"] - - @property - def email_domains(self) -> Sequence[str]: - return self._props["email_domains"] - - -class EndpointSAML(object): - def __init__(self, client, props): - self._client = client - self._props = props - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - @property - def enabled(self) -> bool: - """``true`` if the module will be applied to traffic, ``false`` to disable. default ``true`` 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) -> timedelta: - """Integer number of seconds of the maximum duration of an authenticated session. After this period is exceeded, a user must reauthenticate.""" - return timedelta(seconds=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 ``RelayState`` 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"] - - @property - def nameid_format(self) -> str: - """Defines the name identifier format the SP expects the IdP to use in its assertions to identify subjects. If unspecified, a default value of ``urn:oasis:names:tc:SAML:2.0:nameid-format:persistent`` will be used. A subset of the allowed values enumerated by the SAML specification are supported.""" - return self._props["nameid_format"] - - -class EndpointSAMLMutate(object): - def __init__(self, client, props): - self._client = client - self._props = props - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - @property - def enabled(self) -> bool: - """``true`` if the module will be applied to traffic, ``false`` to disable. default ``true`` 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) -> timedelta: - """Integer number of seconds of the maximum duration of an authenticated session. After this period is exceeded, a user must reauthenticate.""" - return timedelta(seconds=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 ``RelayState`` 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 nameid_format(self) -> str: - """Defines the name identifier format the SP expects the IdP to use in its assertions to identify subjects. If unspecified, a default value of ``urn:oasis:names:tc:SAML:2.0:nameid-format:persistent`` will be used. A subset of the allowed values enumerated by the SAML specification are supported.""" - return self._props["nameid_format"] - - -class EndpointOIDC(object): - def __init__(self, client, props): - self._client = client - self._props = props - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - @property - def enabled(self) -> bool: - """``true`` if the module will be applied to traffic, ``false`` to disable. default ``true`` 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) -> timedelta: - """Integer number of seconds of the maximum duration of an authenticated session. After this period is exceeded, a user must reauthenticate.""" - return timedelta(seconds=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"] - - -class EndpointBackend(object): - def __init__(self, client, props): - self._client = client - self._props = props - self._props["backend"] = ( - Ref(client, props["backend"]) if props.get("backend") is not None else None - ) - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - @property - def enabled(self) -> bool: - """``true`` if the module will be applied to traffic, ``false`` to disable. default ``true`` if unspecified""" - return self._props["enabled"] - - @property - def backend(self) -> Ref: - """backend to be used to back this endpoint""" - return self._props["backend"] - - -class EndpointBackendMutate(object): - def __init__(self, client, props): - self._client = client - self._props = props - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - @property - def enabled(self) -> bool: - """``true`` if the module will be applied to traffic, ``false`` to disable. default ``true`` if unspecified""" - return self._props["enabled"] - - @property - def backend_id(self) -> str: - """backend to be used to back this endpoint""" - return self._props["backend_id"] - - -class EndpointWebsocketTCPConverter(object): - def __init__(self, client, props): - self._client = client - self._props = props - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format( - self.id, repr(self._props) - ) - else: - return "".format(repr(self._props)) - - @property - def enabled(self) -> bool: - """``true`` if the module will be applied to traffic, ``false`` to disable. default ``true`` if unspecified""" - return self._props["enabled"] - - -class EndpointUserAgentFilter(object): - def __init__(self, client, props): - self._client = client - self._props = props - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - @property - def enabled(self) -> bool: - return self._props["enabled"] - - @property - def allow(self) -> Sequence[str]: - return self._props["allow"] - - @property - def deny(self) -> Sequence[str]: - return self._props["deny"] - - -class EndpointTrafficPolicy(object): - def __init__(self, client, props): - self._client = client - self._props = props - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - @property - def enabled(self) -> bool: - """``true`` if the module will be applied to traffic, ``false`` to disable. default ``true`` if unspecified""" - return self._props["enabled"] - - @property - def value(self) -> str: - """the traffic policy that should be applied to the traffic on your endpoint.""" - return self._props["value"] - - -class HTTPSEdgeRoute(object): - def __init__(self, client, props): - self._client = client - self._props = props - self._props["backend"] = ( - EndpointBackend(client, props["backend"]) - if props.get("backend") is not None - else None - ) - self._props["ip_restriction"] = ( - EndpointIPPolicy(client, props["ip_restriction"]) - if props.get("ip_restriction") is not None - else None - ) - self._props["circuit_breaker"] = ( - EndpointCircuitBreaker(client, props["circuit_breaker"]) - if props.get("circuit_breaker") is not None - else None - ) - self._props["compression"] = ( - EndpointCompression(client, props["compression"]) - if props.get("compression") is not None - else None - ) - self._props["request_headers"] = ( - EndpointRequestHeaders(client, props["request_headers"]) - if props.get("request_headers") is not None - else None - ) - self._props["response_headers"] = ( - EndpointResponseHeaders(client, props["response_headers"]) - if props.get("response_headers") is not None - else None - ) - self._props["webhook_verification"] = ( - EndpointWebhookValidation(client, props["webhook_verification"]) - if props.get("webhook_verification") is not None - else None - ) - self._props["oauth"] = ( - EndpointOAuth(client, props["oauth"]) - if props.get("oauth") is not None - else None - ) - self._props["saml"] = ( - EndpointSAML(client, props["saml"]) - if props.get("saml") is not None - else None - ) - self._props["oidc"] = ( - EndpointOIDC(client, props["oidc"]) - if props.get("oidc") is not None - else None - ) - self._props["websocket_tcp_converter"] = ( - EndpointWebsocketTCPConverter(client, props["websocket_tcp_converter"]) - if props.get("websocket_tcp_converter") is not None - else None - ) - self._props["user_agent_filter"] = ( - EndpointUserAgentFilter(client, props["user_agent_filter"]) - if props.get("user_agent_filter") is not None - else None - ) - self._props["traffic_policy"] = ( - EndpointTrafficPolicy(client, props["traffic_policy"]) - if props.get("traffic_policy") is not None - else None - ) - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - def update( - self, - match_type: str = "", - match: str = "", - description: str = "", - metadata: str = "", - backend: EndpointBackendMutate = None, - ip_restriction: EndpointIPPolicyMutate = None, - circuit_breaker: EndpointCircuitBreaker = None, - compression: EndpointCompression = None, - request_headers: EndpointRequestHeaders = None, - response_headers: EndpointResponseHeaders = None, - webhook_verification: EndpointWebhookValidation = None, - oauth: EndpointOAuth = None, - saml: EndpointSAMLMutate = None, - oidc: EndpointOIDC = None, - websocket_tcp_converter: EndpointWebsocketTCPConverter = None, - user_agent_filter: EndpointUserAgentFilter = None, - traffic_policy: EndpointTrafficPolicy = None, - ): - self._client.edges.https_routes.update( - edge_id=self.edge_id, - id=self.id, - match_type=match_type, - match=match, - description=description, - metadata=metadata, - backend=backend, - ip_restriction=ip_restriction, - circuit_breaker=circuit_breaker, - compression=compression, - request_headers=request_headers, - response_headers=response_headers, - webhook_verification=webhook_verification, - oauth=oauth, - saml=saml, - oidc=oidc, - websocket_tcp_converter=websocket_tcp_converter, - user_agent_filter=user_agent_filter, - traffic_policy=traffic_policy, - ) - - def delete( - self, - ): - self._client.edges.https_routes.delete( - edge_id=self.edge_id, - id=self.id, - ) - - @property - def edge_id(self) -> str: - """unique identifier of this edge""" - return self._props["edge_id"] - - @property - def id(self) -> str: - """unique identifier of this edge route""" - return self._props["id"] - - @property - def created_at(self) -> datetime: - """timestamp when the edge configuration was created, RFC 3339 format""" - return self._props["created_at"] - - @property - def match_type(self) -> str: - """Type of match to use for this route. Valid values are "exact_path" and "path_prefix".""" - return self._props["match_type"] - - @property - def match(self) -> str: - """Route selector: "/blog" or "example.com" or "example.com/blog" """ - return self._props["match"] - - @property - def uri(self) -> str: - """URI of the edge API resource""" - return self._props["uri"] - - @property - def description(self) -> str: - """human-readable description of what this edge will be used for; optional, max 255 bytes.""" - return self._props["description"] - - @property - def metadata(self) -> str: - """arbitrary user-defined machine-readable data of this edge. Optional, max 4096 bytes.""" - return self._props["metadata"] - - @property - def backend(self) -> EndpointBackend: - """backend module configuration or ``null``""" - return self._props["backend"] - - @property - def ip_restriction(self) -> EndpointIPPolicy: - """ip restriction module configuration or ``null``""" - return self._props["ip_restriction"] - - @property - def circuit_breaker(self) -> EndpointCircuitBreaker: - """circuit breaker module configuration or ``null``""" - return self._props["circuit_breaker"] - - @property - def compression(self) -> EndpointCompression: - """compression module configuration or ``null``""" - return self._props["compression"] - - @property - def request_headers(self) -> EndpointRequestHeaders: - """request headers module configuration or ``null``""" - return self._props["request_headers"] - - @property - def response_headers(self) -> EndpointResponseHeaders: - """response headers module configuration or ``null``""" - return self._props["response_headers"] - - @property - def webhook_verification(self) -> EndpointWebhookValidation: - """webhook verification module configuration or ``null``""" - return self._props["webhook_verification"] - - @property - def oauth(self) -> EndpointOAuth: - """oauth module configuration or ``null``""" - return self._props["oauth"] - - @property - def saml(self) -> EndpointSAML: - """saml module configuration or ``null``""" - return self._props["saml"] - - @property - def oidc(self) -> EndpointOIDC: - """oidc module configuration or ``null``""" - return self._props["oidc"] - - @property - def websocket_tcp_converter(self) -> EndpointWebsocketTCPConverter: - """websocket to tcp adapter configuration or ``null``""" - return self._props["websocket_tcp_converter"] - - @property - def user_agent_filter(self) -> EndpointUserAgentFilter: - return self._props["user_agent_filter"] - - @property - def traffic_policy(self) -> EndpointTrafficPolicy: - """the traffic policy associated with this edge or null""" - return self._props["traffic_policy"] - - -class HTTPSEdgeList(object): - def __init__(self, client, props): - self._client = client - self._props = props - self._props["https_edges"] = ( - [HTTPSEdge(client, x) for x in props["https_edges"]] - if props.get("https_edges") is not None - else [] - ) - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - def __iter__(self): - return PagedIterator(self._client, self, "https_edges") - - @property - def https_edges(self) -> Sequence[HTTPSEdge]: - """the list of all HTTPS Edges on this account""" - return self._props["https_edges"] - - @property - def uri(self) -> str: - """URI of the HTTPS Edge 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"] - - -class HTTPSEdge(object): - def __init__(self, client, props): - self._client = client - self._props = props - self._props["mutual_tls"] = ( - EndpointMutualTLS(client, props["mutual_tls"]) - if props.get("mutual_tls") is not None - else None - ) - self._props["tls_termination"] = ( - EndpointTLSTermination(client, props["tls_termination"]) - if props.get("tls_termination") is not None - else None - ) - self._props["routes"] = ( - [HTTPSEdgeRoute(client, x) for x in props["routes"]] - if props.get("routes") is not None - else [] - ) - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - def update( - self, - description: str = None, - metadata: str = None, - hostports: Sequence[str] = None, - mutual_tls: EndpointMutualTLSMutate = None, - tls_termination: EndpointTLSTerminationAtEdge = None, - ): - self._client.edges.https.update( - id=self.id, - description=description, - metadata=metadata, - hostports=hostports, - mutual_tls=mutual_tls, - tls_termination=tls_termination, - ) - - def delete( - self, - ): - self._client.edges.https.delete( - id=self.id, - ) - - @property - def id(self) -> str: - """unique identifier of this edge""" - return self._props["id"] - - @property - def description(self) -> str: - """human-readable description of what this edge will be used for; optional, max 255 bytes.""" - return self._props["description"] - - @property - def metadata(self) -> str: - """arbitrary user-defined machine-readable data of this edge; optional, max 4096 bytes.""" - return self._props["metadata"] - - @property - def created_at(self) -> datetime: - """timestamp when the edge configuration was created, RFC 3339 format""" - return self._props["created_at"] - - @property - def uri(self) -> str: - """URI of the edge API resource""" - return self._props["uri"] - - @property - def hostports(self) -> Sequence[str]: - """hostports served by this edge""" - return self._props["hostports"] - - @property - def mutual_tls(self) -> EndpointMutualTLS: - """edge modules""" - return self._props["mutual_tls"] - - @property - def tls_termination(self) -> EndpointTLSTermination: - return self._props["tls_termination"] - - @property - def routes(self) -> Sequence[HTTPSEdgeRoute]: - """routes""" - return self._props["routes"] - - -class TCPEdgeList(object): - def __init__(self, client, props): - self._client = client - self._props = props - self._props["tcp_edges"] = ( - [TCPEdge(client, x) for x in props["tcp_edges"]] - if props.get("tcp_edges") is not None - else [] - ) - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - def __iter__(self): - return PagedIterator(self._client, self, "tcp_edges") - - @property - def tcp_edges(self) -> Sequence[TCPEdge]: - """the list of all TCP Edges on this account""" - return self._props["tcp_edges"] - - @property - def uri(self) -> str: - """URI of the TCP Edge 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"] - - -class TCPEdge(object): - def __init__(self, client, props): - self._client = client - self._props = props - self._props["backend"] = ( - EndpointBackend(client, props["backend"]) - if props.get("backend") is not None - else None - ) - self._props["ip_restriction"] = ( - EndpointIPPolicy(client, props["ip_restriction"]) - if props.get("ip_restriction") is not None - else None - ) - self._props["traffic_policy"] = ( - EndpointTrafficPolicy(client, props["traffic_policy"]) - if props.get("traffic_policy") is not None - else None - ) - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - def update( - self, - description: str = None, - metadata: str = None, - hostports: Sequence[str] = None, - backend: EndpointBackendMutate = None, - ip_restriction: EndpointIPPolicyMutate = None, - traffic_policy: EndpointTrafficPolicy = None, - ): - self._client.edges.tcp.update( - id=self.id, - description=description, - metadata=metadata, - hostports=hostports, - backend=backend, - ip_restriction=ip_restriction, - traffic_policy=traffic_policy, - ) - - def delete( - self, - ): - self._client.edges.tcp.delete( - id=self.id, - ) - - @property - def id(self) -> str: - """unique identifier of this edge""" - return self._props["id"] - - @property - def description(self) -> str: - """human-readable description of what this edge will be used for; optional, max 255 bytes.""" - return self._props["description"] - - @property - def metadata(self) -> str: - """arbitrary user-defined machine-readable data of this edge. Optional, max 4096 bytes.""" - return self._props["metadata"] - - @property - def created_at(self) -> datetime: - """timestamp when the edge was created, RFC 3339 format""" - return self._props["created_at"] - - @property - def uri(self) -> str: - """URI of the edge API resource""" - return self._props["uri"] - - @property - def hostports(self) -> Sequence[str]: - """hostports served by this edge""" - return self._props["hostports"] - - @property - def backend(self) -> EndpointBackend: - """edge modules""" - return self._props["backend"] - - @property - def ip_restriction(self) -> EndpointIPPolicy: - return self._props["ip_restriction"] - - @property - def traffic_policy(self) -> EndpointTrafficPolicy: - """the traffic policy associated with this edge or null""" - return self._props["traffic_policy"] - - -class TLSEdgeList(object): - def __init__(self, client, props): - self._client = client - self._props = props - self._props["tls_edges"] = ( - [TLSEdge(client, x) for x in props["tls_edges"]] - if props.get("tls_edges") is not None - else [] - ) - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - def __iter__(self): - return PagedIterator(self._client, self, "tls_edges") - - @property - def tls_edges(self) -> Sequence[TLSEdge]: - """the list of all TLS Edges on this account""" - return self._props["tls_edges"] - - @property - def uri(self) -> str: - """URI of the TLS Edge 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"] - - -class TLSEdge(object): - def __init__(self, client, props): - self._client = client - self._props = props - self._props["backend"] = ( - EndpointBackend(client, props["backend"]) - if props.get("backend") is not None - else None - ) - self._props["ip_restriction"] = ( - EndpointIPPolicy(client, props["ip_restriction"]) - if props.get("ip_restriction") is not None - else None - ) - self._props["mutual_tls"] = ( - EndpointMutualTLS(client, props["mutual_tls"]) - if props.get("mutual_tls") is not None - else None - ) - self._props["tls_termination"] = ( - EndpointTLSTermination(client, props["tls_termination"]) - if props.get("tls_termination") is not None - else None - ) - self._props["traffic_policy"] = ( - EndpointTrafficPolicy(client, props["traffic_policy"]) - if props.get("traffic_policy") is not None - else None - ) - - def __eq__(self, other): - return self._props == other._props - - def __str__(self): - if "id" in self._props: - return "".format(self.id, repr(self._props)) - else: - return "".format(repr(self._props)) - - def update( - self, - description: str = None, - metadata: str = None, - hostports: Sequence[str] = None, - backend: EndpointBackendMutate = None, - ip_restriction: EndpointIPPolicyMutate = None, - mutual_tls: EndpointMutualTLSMutate = None, - tls_termination: EndpointTLSTermination = None, - traffic_policy: EndpointTrafficPolicy = None, - ): - self._client.edges.tls.update( - id=self.id, - description=description, - metadata=metadata, - hostports=hostports, - backend=backend, - ip_restriction=ip_restriction, - mutual_tls=mutual_tls, - tls_termination=tls_termination, - traffic_policy=traffic_policy, - ) - - def delete( - self, - ): - self._client.edges.tls.delete( - id=self.id, - ) - - @property - def id(self) -> str: - """unique identifier of this edge""" - return self._props["id"] - - @property - def description(self) -> str: - """human-readable description of what this edge will be used for; optional, max 255 bytes.""" - return self._props["description"] - - @property - def metadata(self) -> str: - """arbitrary user-defined machine-readable data of this edge. Optional, max 4096 bytes.""" - return self._props["metadata"] - - @property - def created_at(self) -> datetime: - """timestamp when the edge configuration was created, RFC 3339 format""" - return self._props["created_at"] - - @property - def uri(self) -> str: - """URI of the edge API resource""" - return self._props["uri"] - - @property - def hostports(self) -> Sequence[str]: - """hostports served by this edge""" - return self._props["hostports"] - - @property - def backend(self) -> EndpointBackend: - """edge modules""" - return self._props["backend"] - - @property - def ip_restriction(self) -> EndpointIPPolicy: - return self._props["ip_restriction"] - - @property - def mutual_tls(self) -> EndpointMutualTLS: - return self._props["mutual_tls"] - - @property - def tls_termination(self) -> EndpointTLSTermination: - return self._props["tls_termination"] - - @property - def traffic_policy(self) -> EndpointTrafficPolicy: - """the traffic policy associated with this edge or null""" - return self._props["traffic_policy"] - - class Endpoint(object): def __init__(self, client, props): self._client = client diff --git a/ngrok/services.py b/ngrok/services.py index e464de1..27d971e 100644 --- a/ngrok/services.py +++ b/ngrok/services.py @@ -503,595 +503,6 @@ class TunnelSessionsClient(object): self._client.http_client.post(path, body_arg) -class FailoverBackendsClient(object): - """A Failover backend defines failover behavior within a list of referenced - backends. Traffic is sent to the first backend in the list. If that backend - is offline or no connection can be established, ngrok attempts to connect to - the next backend in the list until one is successful.""" - - def __init__(self, client): - self._client = client - - def create( - self, - description: str = "", - metadata: str = "", - backends: Sequence[str] = [], - ) -> FailoverBackend: - """Create a new Failover backend - - :param description: human-readable description of this backend. Optional - :param metadata: arbitrary user-defined machine-readable data of this backend. Optional - :param backends: the ids of the child backends in order - - https://ngrok.com/docs/api#api-failover-backends-create - """ - path = "/backends/failover" - body_arg = dict( - description=description, - metadata=metadata, - backends=backends, - ) - result = self._client.http_client.post(path, body_arg) - return FailoverBackend(self._client, result) - - def delete( - self, - id: str, - ): - """Delete a Failover backend by ID. - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-failover-backends-delete - """ - path = "/backends/failover/{id}" - path = path.format( - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - def get( - self, - id: str, - ) -> FailoverBackend: - """Get detailed information about a Failover backend by ID - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-failover-backends-get - """ - path = "/backends/failover/{id}" - path = path.format( - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return FailoverBackend(self._client, result) - - def list( - self, - before_id: str = None, - limit: str = None, - ) -> FailoverBackendList: - """List all Failover backends on this account - - :param before_id: - :param limit: - - https://ngrok.com/docs/api#api-failover-backends-list - """ - path = "/backends/failover" - body_arg = dict( - before_id=before_id, - limit=limit, - ) - result = self._client.http_client.get(path, body_arg) - return FailoverBackendList(self._client, result) - - def update( - self, - id: str, - description: str = None, - metadata: str = None, - backends: Sequence[str] = [], - ) -> FailoverBackend: - """Update Failover backend by ID - - :param id: - :param description: human-readable description of this backend. Optional - :param metadata: arbitrary user-defined machine-readable data of this backend. Optional - :param backends: the ids of the child backends in order - - https://ngrok.com/docs/api#api-failover-backends-update - """ - path = "/backends/failover/{id}" - path = path.format( - id=id, - ) - body_arg = dict( - description=description, - metadata=metadata, - backends=backends, - ) - result = self._client.http_client.patch(path, body_arg) - return FailoverBackend(self._client, result) - - -class HTTPResponseBackendsClient(object): - def __init__(self, client): - self._client = client - - def create( - self, - description: str = "", - metadata: str = "", - body: str = "", - headers: Mapping[str, str] = {}, - status_code: int = None, - ) -> HTTPResponseBackend: - """ - - :param description: human-readable description of this backend. Optional - :param metadata: arbitrary user-defined machine-readable data of this backend. Optional - :param body: body to return as fixed content - :param headers: headers to return - :param status_code: status code to return - - https://ngrok.com/docs/api#api-http-response-backends-create - """ - path = "/backends/http_response" - body_arg = dict( - description=description, - metadata=metadata, - body=body, - headers=headers, - status_code=status_code, - ) - result = self._client.http_client.post(path, body_arg) - return HTTPResponseBackend(self._client, result) - - def delete( - self, - id: str, - ): - """ - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-http-response-backends-delete - """ - path = "/backends/http_response/{id}" - path = path.format( - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - def get( - self, - id: str, - ) -> HTTPResponseBackend: - """ - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-http-response-backends-get - """ - path = "/backends/http_response/{id}" - path = path.format( - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return HTTPResponseBackend(self._client, result) - - def list( - self, - before_id: str = None, - limit: str = None, - ) -> HTTPResponseBackendList: - """ - - :param before_id: - :param limit: - - https://ngrok.com/docs/api#api-http-response-backends-list - """ - path = "/backends/http_response" - body_arg = dict( - before_id=before_id, - limit=limit, - ) - result = self._client.http_client.get(path, body_arg) - return HTTPResponseBackendList(self._client, result) - - def update( - self, - id: str, - description: str = None, - metadata: str = None, - body: str = None, - headers: Mapping[str, str] = None, - status_code: int = None, - ) -> HTTPResponseBackend: - """ - - :param id: - :param description: human-readable description of this backend. Optional - :param metadata: arbitrary user-defined machine-readable data of this backend. Optional - :param body: body to return as fixed content - :param headers: headers to return - :param status_code: status code to return - - https://ngrok.com/docs/api#api-http-response-backends-update - """ - path = "/backends/http_response/{id}" - path = path.format( - id=id, - ) - body_arg = dict( - description=description, - metadata=metadata, - body=body, - headers=headers, - status_code=status_code, - ) - result = self._client.http_client.patch(path, body_arg) - return HTTPResponseBackend(self._client, result) - - -class StaticBackendsClient(object): - """A static backend sends traffic to a TCP address (hostname and port) that - is reachable on the public internet.""" - - def __init__(self, client): - self._client = client - - def create( - self, - description: str = "", - metadata: str = "", - address: str = "", - tls: StaticBackendTLS = None, - ) -> StaticBackend: - """Create a new static backend - - :param description: human-readable description of this backend. Optional - :param metadata: arbitrary user-defined machine-readable data of this backend. Optional - :param address: the address to forward to - :param tls: tls configuration to use - - https://ngrok.com/docs/api#api-static-backends-create - """ - path = "/backends/static" - body_arg = dict( - description=description, - metadata=metadata, - address=address, - tls=extract_props(tls), - ) - result = self._client.http_client.post(path, body_arg) - return StaticBackend(self._client, result) - - def delete( - self, - id: str, - ): - """Delete a static backend by ID. - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-static-backends-delete - """ - path = "/backends/static/{id}" - path = path.format( - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - def get( - self, - id: str, - ) -> StaticBackend: - """Get detailed information about a static backend by ID - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-static-backends-get - """ - path = "/backends/static/{id}" - path = path.format( - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return StaticBackend(self._client, result) - - def list( - self, - before_id: str = None, - limit: str = None, - ) -> StaticBackendList: - """List all static backends on this account - - :param before_id: - :param limit: - - https://ngrok.com/docs/api#api-static-backends-list - """ - path = "/backends/static" - body_arg = dict( - before_id=before_id, - limit=limit, - ) - result = self._client.http_client.get(path, body_arg) - return StaticBackendList(self._client, result) - - def update( - self, - id: str, - description: str = None, - metadata: str = None, - address: str = "", - tls: StaticBackendTLS = None, - ) -> StaticBackend: - """Update static backend by ID - - :param id: - :param description: human-readable description of this backend. Optional - :param metadata: arbitrary user-defined machine-readable data of this backend. Optional - :param address: the address to forward to - :param tls: tls configuration to use - - https://ngrok.com/docs/api#api-static-backends-update - """ - path = "/backends/static/{id}" - path = path.format( - id=id, - ) - body_arg = dict( - description=description, - metadata=metadata, - address=address, - tls=extract_props(tls), - ) - result = self._client.http_client.patch(path, body_arg) - return StaticBackend(self._client, result) - - -class TunnelGroupBackendsClient(object): - """A Tunnel Group Backend balances traffic among all online tunnels that match - a label selector.""" - - def __init__(self, client): - self._client = client - - def create( - self, - description: str = "", - metadata: str = "", - labels: Mapping[str, str] = {}, - ) -> TunnelGroupBackend: - """Create a new TunnelGroup backend - - :param description: human-readable description of this backend. Optional - :param metadata: arbitrary user-defined machine-readable data of this backend. Optional - :param labels: labels to watch for tunnels on, e.g. app->foo, dc->bar - - https://ngrok.com/docs/api#api-tunnel-group-backends-create - """ - path = "/backends/tunnel_group" - body_arg = dict( - description=description, - metadata=metadata, - labels=labels, - ) - result = self._client.http_client.post(path, body_arg) - return TunnelGroupBackend(self._client, result) - - def delete( - self, - id: str, - ): - """Delete a TunnelGroup backend by ID. - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-tunnel-group-backends-delete - """ - path = "/backends/tunnel_group/{id}" - path = path.format( - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - def get( - self, - id: str, - ) -> TunnelGroupBackend: - """Get detailed information about a TunnelGroup backend by ID - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-tunnel-group-backends-get - """ - path = "/backends/tunnel_group/{id}" - path = path.format( - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return TunnelGroupBackend(self._client, result) - - def list( - self, - before_id: str = None, - limit: str = None, - ) -> TunnelGroupBackendList: - """List all TunnelGroup backends on this account - - :param before_id: - :param limit: - - https://ngrok.com/docs/api#api-tunnel-group-backends-list - """ - path = "/backends/tunnel_group" - body_arg = dict( - before_id=before_id, - limit=limit, - ) - result = self._client.http_client.get(path, body_arg) - return TunnelGroupBackendList(self._client, result) - - def update( - self, - id: str, - description: str = None, - metadata: str = None, - labels: Mapping[str, str] = {}, - ) -> TunnelGroupBackend: - """Update TunnelGroup backend by ID - - :param id: - :param description: human-readable description of this backend. Optional - :param metadata: arbitrary user-defined machine-readable data of this backend. Optional - :param labels: labels to watch for tunnels on, e.g. app->foo, dc->bar - - https://ngrok.com/docs/api#api-tunnel-group-backends-update - """ - path = "/backends/tunnel_group/{id}" - path = path.format( - id=id, - ) - body_arg = dict( - description=description, - metadata=metadata, - labels=labels, - ) - result = self._client.http_client.patch(path, body_arg) - return TunnelGroupBackend(self._client, result) - - -class WeightedBackendsClient(object): - """A Weighted Backend balances traffic among the referenced backends. Traffic - is assigned proportionally to each based on its weight. The percentage of - traffic is calculated by dividing a backend's weight by the sum of all - weights.""" - - def __init__(self, client): - self._client = client - - def create( - self, - description: str = "", - metadata: str = "", - backends: Mapping[str, int] = {}, - ) -> WeightedBackend: - """Create a new Weighted backend - - :param description: human-readable description of this backend. Optional - :param metadata: arbitrary user-defined machine-readable data of this backend. Optional - :param backends: the ids of the child backends to their weights [0-10000] - - https://ngrok.com/docs/api#api-weighted-backends-create - """ - path = "/backends/weighted" - body_arg = dict( - description=description, - metadata=metadata, - backends=backends, - ) - result = self._client.http_client.post(path, body_arg) - return WeightedBackend(self._client, result) - - def delete( - self, - id: str, - ): - """Delete a Weighted backend by ID. - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-weighted-backends-delete - """ - path = "/backends/weighted/{id}" - path = path.format( - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - def get( - self, - id: str, - ) -> WeightedBackend: - """Get detailed information about a Weighted backend by ID - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-weighted-backends-get - """ - path = "/backends/weighted/{id}" - path = path.format( - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return WeightedBackend(self._client, result) - - def list( - self, - before_id: str = None, - limit: str = None, - ) -> WeightedBackendList: - """List all Weighted backends on this account - - :param before_id: - :param limit: - - https://ngrok.com/docs/api#api-weighted-backends-list - """ - path = "/backends/weighted" - body_arg = dict( - before_id=before_id, - limit=limit, - ) - result = self._client.http_client.get(path, body_arg) - return WeightedBackendList(self._client, result) - - def update( - self, - id: str, - description: str = None, - metadata: str = None, - backends: Mapping[str, int] = {}, - ) -> WeightedBackend: - """Update Weighted backend by ID - - :param id: - :param description: human-readable description of this backend. Optional - :param metadata: arbitrary user-defined machine-readable data of this backend. Optional - :param backends: the ids of the child backends to their weights [0-10000] - - https://ngrok.com/docs/api#api-weighted-backends-update - """ - path = "/backends/weighted/{id}" - path = path.format( - id=id, - ) - body_arg = dict( - description=description, - metadata=metadata, - backends=backends, - ) - result = self._client.http_client.patch(path, body_arg) - return WeightedBackend(self._client, result) - - class BotUsersClient(object): def __init__(self, client): self._client = client @@ -1430,2085 +841,6 @@ class CredentialsClient(object): return Credential(self._client, result) -class EdgesHTTPSRoutesClient(object): - def __init__(self, client): - self._client = client - - def create( - self, - edge_id: str, - match_type: str, - match: str, - description: str = "", - metadata: str = "", - backend: EndpointBackendMutate = None, - ip_restriction: EndpointIPPolicyMutate = None, - circuit_breaker: EndpointCircuitBreaker = None, - compression: EndpointCompression = None, - request_headers: EndpointRequestHeaders = None, - response_headers: EndpointResponseHeaders = None, - webhook_verification: EndpointWebhookValidation = None, - oauth: EndpointOAuth = None, - saml: EndpointSAMLMutate = None, - oidc: EndpointOIDC = None, - websocket_tcp_converter: EndpointWebsocketTCPConverter = None, - user_agent_filter: EndpointUserAgentFilter = None, - traffic_policy: EndpointTrafficPolicy = None, - ) -> HTTPSEdgeRoute: - """Create an HTTPS Edge Route - - :param edge_id: unique identifier of this edge - :param match_type: Type of match to use for this route. Valid values are "exact_path" and "path_prefix". - :param match: Route selector: "/blog" or "example.com" or "example.com/blog" - :param description: human-readable description of what this edge will be used for; optional, max 255 bytes. - :param metadata: arbitrary user-defined machine-readable data of this edge. Optional, max 4096 bytes. - :param backend: backend module configuration or ``null`` - :param ip_restriction: ip restriction module configuration or ``null`` - :param circuit_breaker: circuit breaker module configuration or ``null`` - :param compression: compression module configuration or ``null`` - :param request_headers: request headers module configuration or ``null`` - :param response_headers: response headers module configuration or ``null`` - :param webhook_verification: webhook verification module configuration or ``null`` - :param oauth: oauth module configuration or ``null`` - :param saml: saml module configuration or ``null`` - :param oidc: oidc module configuration or ``null`` - :param websocket_tcp_converter: websocket to tcp adapter configuration or ``null`` - :param user_agent_filter: - :param traffic_policy: the traffic policy associated with this edge or null - - https://ngrok.com/docs/api#api-edges-https-routes-create - """ - path = "/edges/https/{edge_id}/routes" - path = path.format( - edge_id=edge_id, - ) - body_arg = dict( - match_type=match_type, - match=match, - description=description, - metadata=metadata, - backend=extract_props(backend), - ip_restriction=extract_props(ip_restriction), - circuit_breaker=extract_props(circuit_breaker), - compression=extract_props(compression), - request_headers=extract_props(request_headers), - response_headers=extract_props(response_headers), - webhook_verification=extract_props(webhook_verification), - oauth=extract_props(oauth), - saml=extract_props(saml), - oidc=extract_props(oidc), - websocket_tcp_converter=extract_props(websocket_tcp_converter), - user_agent_filter=extract_props(user_agent_filter), - traffic_policy=extract_props(traffic_policy), - ) - result = self._client.http_client.post(path, body_arg) - return HTTPSEdgeRoute(self._client, result) - - def get( - self, - edge_id: str, - id: str, - ) -> HTTPSEdgeRoute: - """Get an HTTPS Edge Route by ID - - :param edge_id: unique identifier of this edge - :param id: unique identifier of this edge route - - https://ngrok.com/docs/api#api-edges-https-routes-get - """ - path = "/edges/https/{edge_id}/routes/{id}" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return HTTPSEdgeRoute(self._client, result) - - def update( - self, - edge_id: str, - id: str, - match_type: str = "", - match: str = "", - description: str = "", - metadata: str = "", - backend: EndpointBackendMutate = None, - ip_restriction: EndpointIPPolicyMutate = None, - circuit_breaker: EndpointCircuitBreaker = None, - compression: EndpointCompression = None, - request_headers: EndpointRequestHeaders = None, - response_headers: EndpointResponseHeaders = None, - webhook_verification: EndpointWebhookValidation = None, - oauth: EndpointOAuth = None, - saml: EndpointSAMLMutate = None, - oidc: EndpointOIDC = None, - websocket_tcp_converter: EndpointWebsocketTCPConverter = None, - user_agent_filter: EndpointUserAgentFilter = None, - traffic_policy: EndpointTrafficPolicy = None, - ) -> HTTPSEdgeRoute: - """Updates an HTTPS Edge Route by ID. 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 edge_id: unique identifier of this edge - :param id: unique identifier of this edge route - :param match_type: Type of match to use for this route. Valid values are "exact_path" and "path_prefix". - :param match: Route selector: "/blog" or "example.com" or "example.com/blog" - :param description: human-readable description of what this edge will be used for; optional, max 255 bytes. - :param metadata: arbitrary user-defined machine-readable data of this edge. Optional, max 4096 bytes. - :param backend: backend module configuration or ``null`` - :param ip_restriction: ip restriction module configuration or ``null`` - :param circuit_breaker: circuit breaker module configuration or ``null`` - :param compression: compression module configuration or ``null`` - :param request_headers: request headers module configuration or ``null`` - :param response_headers: response headers module configuration or ``null`` - :param webhook_verification: webhook verification module configuration or ``null`` - :param oauth: oauth module configuration or ``null`` - :param saml: saml module configuration or ``null`` - :param oidc: oidc module configuration or ``null`` - :param websocket_tcp_converter: websocket to tcp adapter configuration or ``null`` - :param user_agent_filter: - :param traffic_policy: the traffic policy associated with this edge or null - - https://ngrok.com/docs/api#api-edges-https-routes-update - """ - path = "/edges/https/{edge_id}/routes/{id}" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = dict( - match_type=match_type, - match=match, - description=description, - metadata=metadata, - backend=extract_props(backend), - ip_restriction=extract_props(ip_restriction), - circuit_breaker=extract_props(circuit_breaker), - compression=extract_props(compression), - request_headers=extract_props(request_headers), - response_headers=extract_props(response_headers), - webhook_verification=extract_props(webhook_verification), - oauth=extract_props(oauth), - saml=extract_props(saml), - oidc=extract_props(oidc), - websocket_tcp_converter=extract_props(websocket_tcp_converter), - user_agent_filter=extract_props(user_agent_filter), - traffic_policy=extract_props(traffic_policy), - ) - result = self._client.http_client.patch(path, body_arg) - return HTTPSEdgeRoute(self._client, result) - - def delete( - self, - edge_id: str, - id: str, - ): - """Delete an HTTPS Edge Route by ID - - :param edge_id: unique identifier of this edge - :param id: unique identifier of this edge route - - https://ngrok.com/docs/api#api-edges-https-routes-delete - """ - path = "/edges/https/{edge_id}/routes/{id}" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - -class EdgesHTTPSClient(object): - def __init__(self, client): - self._client = client - - def create( - self, - description: str = "", - metadata: str = "", - hostports: Sequence[str] = None, - mutual_tls: EndpointMutualTLSMutate = None, - tls_termination: EndpointTLSTerminationAtEdge = None, - ) -> HTTPSEdge: - """Create an HTTPS Edge - - :param description: human-readable description of what this edge will be used for; optional, max 255 bytes. - :param metadata: arbitrary user-defined machine-readable data of this edge; optional, max 4096 bytes. - :param hostports: hostports served by this edge - :param mutual_tls: edge modules - :param tls_termination: - - https://ngrok.com/docs/api#api-edges-https-create - """ - path = "/edges/https" - body_arg = dict( - description=description, - metadata=metadata, - hostports=hostports, - mutual_tls=extract_props(mutual_tls), - tls_termination=extract_props(tls_termination), - ) - result = self._client.http_client.post(path, body_arg) - return HTTPSEdge(self._client, result) - - def get( - self, - id: str, - ) -> HTTPSEdge: - """Get an HTTPS Edge by ID - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-edges-https-get - """ - path = "/edges/https/{id}" - path = path.format( - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return HTTPSEdge(self._client, result) - - def list( - self, - before_id: str = None, - limit: str = None, - ) -> HTTPSEdgeList: - """Returns a list of all HTTPS Edges on this account - - :param before_id: - :param limit: - - https://ngrok.com/docs/api#api-edges-https-list - """ - path = "/edges/https" - body_arg = dict( - before_id=before_id, - limit=limit, - ) - result = self._client.http_client.get(path, body_arg) - return HTTPSEdgeList(self._client, result) - - def update( - self, - id: str, - description: str = None, - metadata: str = None, - hostports: Sequence[str] = None, - mutual_tls: EndpointMutualTLSMutate = None, - tls_termination: EndpointTLSTerminationAtEdge = None, - ) -> HTTPSEdge: - """Updates an HTTPS Edge by ID. 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 edge - :param description: human-readable description of what this edge will be used for; optional, max 255 bytes. - :param metadata: arbitrary user-defined machine-readable data of this edge; optional, max 4096 bytes. - :param hostports: hostports served by this edge - :param mutual_tls: edge modules - :param tls_termination: - - https://ngrok.com/docs/api#api-edges-https-update - """ - path = "/edges/https/{id}" - path = path.format( - id=id, - ) - body_arg = dict( - description=description, - metadata=metadata, - hostports=hostports, - mutual_tls=extract_props(mutual_tls), - tls_termination=extract_props(tls_termination), - ) - result = self._client.http_client.patch(path, body_arg) - return HTTPSEdge(self._client, result) - - def delete( - self, - id: str, - ): - """Delete an HTTPS Edge by ID - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-edges-https-delete - """ - path = "/edges/https/{id}" - path = path.format( - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - -class HTTPSEdgeMutualTLSModuleClient(object): - def __init__(self, client): - self._client = client - - def replace( - self, - id: str, - module: EndpointMutualTLSMutate = None, - ) -> EndpointMutualTLS: - """ - - :param id: - :param module: - - https://ngrok.com/docs/api#api-https-edge-mutual-tls-module-replace - """ - path = "/edges/https/{id}/mutual_tls" - path = path.format( - id=id, - ) - body_arg = extract_props(module) - result = self._client.http_client.put(path, body_arg) - return EndpointMutualTLS(self._client, result) - - def get( - self, - id: str, - ) -> EndpointMutualTLS: - """ - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-https-edge-mutual-tls-module-get - """ - path = "/edges/https/{id}/mutual_tls" - path = path.format( - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return EndpointMutualTLS(self._client, result) - - def delete( - self, - id: str, - ): - """ - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-https-edge-mutual-tls-module-delete - """ - path = "/edges/https/{id}/mutual_tls" - path = path.format( - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - -class HTTPSEdgeTLSTerminationModuleClient(object): - def __init__(self, client): - self._client = client - - def replace( - self, - id: str, - module: EndpointTLSTerminationAtEdge = None, - ) -> EndpointTLSTermination: - """ - - :param id: - :param module: - - https://ngrok.com/docs/api#api-https-edge-tls-termination-module-replace - """ - path = "/edges/https/{id}/tls_termination" - path = path.format( - id=id, - ) - body_arg = extract_props(module) - result = self._client.http_client.put(path, body_arg) - return EndpointTLSTermination(self._client, result) - - def get( - self, - id: str, - ) -> EndpointTLSTermination: - """ - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-https-edge-tls-termination-module-get - """ - path = "/edges/https/{id}/tls_termination" - path = path.format( - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return EndpointTLSTermination(self._client, result) - - def delete( - self, - id: str, - ): - """ - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-https-edge-tls-termination-module-delete - """ - path = "/edges/https/{id}/tls_termination" - path = path.format( - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - -class EdgeRouteBackendModuleClient(object): - def __init__(self, client): - self._client = client - - def replace( - self, - edge_id: str, - id: str, - module: EndpointBackendMutate = None, - ) -> EndpointBackend: - """ - - :param edge_id: - :param id: - :param module: - - https://ngrok.com/docs/api#api-edge-route-backend-module-replace - """ - path = "/edges/https/{edge_id}/routes/{id}/backend" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = extract_props(module) - result = self._client.http_client.put(path, body_arg) - return EndpointBackend(self._client, result) - - def get( - self, - edge_id: str, - id: str, - ) -> EndpointBackend: - """ - - :param edge_id: unique identifier of this edge - :param id: unique identifier of this edge route - - https://ngrok.com/docs/api#api-edge-route-backend-module-get - """ - path = "/edges/https/{edge_id}/routes/{id}/backend" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return EndpointBackend(self._client, result) - - def delete( - self, - edge_id: str, - id: str, - ): - """ - - :param edge_id: unique identifier of this edge - :param id: unique identifier of this edge route - - https://ngrok.com/docs/api#api-edge-route-backend-module-delete - """ - path = "/edges/https/{edge_id}/routes/{id}/backend" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - -class EdgeRouteIPRestrictionModuleClient(object): - def __init__(self, client): - self._client = client - - def replace( - self, - edge_id: str, - id: str, - module: EndpointIPPolicyMutate = None, - ) -> EndpointIPPolicy: - """ - - :param edge_id: - :param id: - :param module: - - https://ngrok.com/docs/api#api-edge-route-ip-restriction-module-replace - """ - path = "/edges/https/{edge_id}/routes/{id}/ip_restriction" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = extract_props(module) - result = self._client.http_client.put(path, body_arg) - return EndpointIPPolicy(self._client, result) - - def get( - self, - edge_id: str, - id: str, - ) -> EndpointIPPolicy: - """ - - :param edge_id: unique identifier of this edge - :param id: unique identifier of this edge route - - https://ngrok.com/docs/api#api-edge-route-ip-restriction-module-get - """ - path = "/edges/https/{edge_id}/routes/{id}/ip_restriction" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return EndpointIPPolicy(self._client, result) - - def delete( - self, - edge_id: str, - id: str, - ): - """ - - :param edge_id: unique identifier of this edge - :param id: unique identifier of this edge route - - https://ngrok.com/docs/api#api-edge-route-ip-restriction-module-delete - """ - path = "/edges/https/{edge_id}/routes/{id}/ip_restriction" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - -class EdgeRouteRequestHeadersModuleClient(object): - def __init__(self, client): - self._client = client - - def replace( - self, - edge_id: str, - id: str, - module: EndpointRequestHeaders = None, - ) -> EndpointRequestHeaders: - """ - - :param edge_id: - :param id: - :param module: - - https://ngrok.com/docs/api#api-edge-route-request-headers-module-replace - """ - path = "/edges/https/{edge_id}/routes/{id}/request_headers" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = extract_props(module) - result = self._client.http_client.put(path, body_arg) - return EndpointRequestHeaders(self._client, result) - - def get( - self, - edge_id: str, - id: str, - ) -> EndpointRequestHeaders: - """ - - :param edge_id: unique identifier of this edge - :param id: unique identifier of this edge route - - https://ngrok.com/docs/api#api-edge-route-request-headers-module-get - """ - path = "/edges/https/{edge_id}/routes/{id}/request_headers" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return EndpointRequestHeaders(self._client, result) - - def delete( - self, - edge_id: str, - id: str, - ): - """ - - :param edge_id: unique identifier of this edge - :param id: unique identifier of this edge route - - https://ngrok.com/docs/api#api-edge-route-request-headers-module-delete - """ - path = "/edges/https/{edge_id}/routes/{id}/request_headers" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - -class EdgeRouteResponseHeadersModuleClient(object): - def __init__(self, client): - self._client = client - - def replace( - self, - edge_id: str, - id: str, - module: EndpointResponseHeaders = None, - ) -> EndpointResponseHeaders: - """ - - :param edge_id: - :param id: - :param module: - - https://ngrok.com/docs/api#api-edge-route-response-headers-module-replace - """ - path = "/edges/https/{edge_id}/routes/{id}/response_headers" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = extract_props(module) - result = self._client.http_client.put(path, body_arg) - return EndpointResponseHeaders(self._client, result) - - def get( - self, - edge_id: str, - id: str, - ) -> EndpointResponseHeaders: - """ - - :param edge_id: unique identifier of this edge - :param id: unique identifier of this edge route - - https://ngrok.com/docs/api#api-edge-route-response-headers-module-get - """ - path = "/edges/https/{edge_id}/routes/{id}/response_headers" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return EndpointResponseHeaders(self._client, result) - - def delete( - self, - edge_id: str, - id: str, - ): - """ - - :param edge_id: unique identifier of this edge - :param id: unique identifier of this edge route - - https://ngrok.com/docs/api#api-edge-route-response-headers-module-delete - """ - path = "/edges/https/{edge_id}/routes/{id}/response_headers" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - -class EdgeRouteCompressionModuleClient(object): - def __init__(self, client): - self._client = client - - def replace( - self, - edge_id: str, - id: str, - module: EndpointCompression = None, - ) -> EndpointCompression: - """ - - :param edge_id: - :param id: - :param module: - - https://ngrok.com/docs/api#api-edge-route-compression-module-replace - """ - path = "/edges/https/{edge_id}/routes/{id}/compression" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = extract_props(module) - result = self._client.http_client.put(path, body_arg) - return EndpointCompression(self._client, result) - - def get( - self, - edge_id: str, - id: str, - ) -> EndpointCompression: - """ - - :param edge_id: unique identifier of this edge - :param id: unique identifier of this edge route - - https://ngrok.com/docs/api#api-edge-route-compression-module-get - """ - path = "/edges/https/{edge_id}/routes/{id}/compression" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return EndpointCompression(self._client, result) - - def delete( - self, - edge_id: str, - id: str, - ): - """ - - :param edge_id: unique identifier of this edge - :param id: unique identifier of this edge route - - https://ngrok.com/docs/api#api-edge-route-compression-module-delete - """ - path = "/edges/https/{edge_id}/routes/{id}/compression" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - -class EdgeRouteCircuitBreakerModuleClient(object): - def __init__(self, client): - self._client = client - - def replace( - self, - edge_id: str, - id: str, - module: EndpointCircuitBreaker = None, - ) -> EndpointCircuitBreaker: - """ - - :param edge_id: - :param id: - :param module: - - https://ngrok.com/docs/api#api-edge-route-circuit-breaker-module-replace - """ - path = "/edges/https/{edge_id}/routes/{id}/circuit_breaker" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = extract_props(module) - result = self._client.http_client.put(path, body_arg) - return EndpointCircuitBreaker(self._client, result) - - def get( - self, - edge_id: str, - id: str, - ) -> EndpointCircuitBreaker: - """ - - :param edge_id: unique identifier of this edge - :param id: unique identifier of this edge route - - https://ngrok.com/docs/api#api-edge-route-circuit-breaker-module-get - """ - path = "/edges/https/{edge_id}/routes/{id}/circuit_breaker" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return EndpointCircuitBreaker(self._client, result) - - def delete( - self, - edge_id: str, - id: str, - ): - """ - - :param edge_id: unique identifier of this edge - :param id: unique identifier of this edge route - - https://ngrok.com/docs/api#api-edge-route-circuit-breaker-module-delete - """ - path = "/edges/https/{edge_id}/routes/{id}/circuit_breaker" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - -class EdgeRouteWebhookVerificationModuleClient(object): - def __init__(self, client): - self._client = client - - def replace( - self, - edge_id: str, - id: str, - module: EndpointWebhookValidation = None, - ) -> EndpointWebhookValidation: - """ - - :param edge_id: - :param id: - :param module: - - https://ngrok.com/docs/api#api-edge-route-webhook-verification-module-replace - """ - path = "/edges/https/{edge_id}/routes/{id}/webhook_verification" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = extract_props(module) - result = self._client.http_client.put(path, body_arg) - return EndpointWebhookValidation(self._client, result) - - def get( - self, - edge_id: str, - id: str, - ) -> EndpointWebhookValidation: - """ - - :param edge_id: unique identifier of this edge - :param id: unique identifier of this edge route - - https://ngrok.com/docs/api#api-edge-route-webhook-verification-module-get - """ - path = "/edges/https/{edge_id}/routes/{id}/webhook_verification" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return EndpointWebhookValidation(self._client, result) - - def delete( - self, - edge_id: str, - id: str, - ): - """ - - :param edge_id: unique identifier of this edge - :param id: unique identifier of this edge route - - https://ngrok.com/docs/api#api-edge-route-webhook-verification-module-delete - """ - path = "/edges/https/{edge_id}/routes/{id}/webhook_verification" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - -class EdgeRouteOAuthModuleClient(object): - def __init__(self, client): - self._client = client - - def replace( - self, - edge_id: str, - id: str, - module: EndpointOAuth = None, - ) -> EndpointOAuth: - """ - - :param edge_id: - :param id: - :param module: - - https://ngrok.com/docs/api#api-edge-route-o-auth-module-replace - """ - path = "/edges/https/{edge_id}/routes/{id}/oauth" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = extract_props(module) - result = self._client.http_client.put(path, body_arg) - return EndpointOAuth(self._client, result) - - def get( - self, - edge_id: str, - id: str, - ) -> EndpointOAuth: - """ - - :param edge_id: unique identifier of this edge - :param id: unique identifier of this edge route - - https://ngrok.com/docs/api#api-edge-route-o-auth-module-get - """ - path = "/edges/https/{edge_id}/routes/{id}/oauth" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return EndpointOAuth(self._client, result) - - def delete( - self, - edge_id: str, - id: str, - ): - """ - - :param edge_id: unique identifier of this edge - :param id: unique identifier of this edge route - - https://ngrok.com/docs/api#api-edge-route-o-auth-module-delete - """ - path = "/edges/https/{edge_id}/routes/{id}/oauth" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - -class EdgeRouteSAMLModuleClient(object): - def __init__(self, client): - self._client = client - - def replace( - self, - edge_id: str, - id: str, - module: EndpointSAMLMutate = None, - ) -> EndpointSAML: - """ - - :param edge_id: - :param id: - :param module: - - https://ngrok.com/docs/api#api-edge-route-saml-module-replace - """ - path = "/edges/https/{edge_id}/routes/{id}/saml" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = extract_props(module) - result = self._client.http_client.put(path, body_arg) - return EndpointSAML(self._client, result) - - def get( - self, - edge_id: str, - id: str, - ) -> EndpointSAML: - """ - - :param edge_id: unique identifier of this edge - :param id: unique identifier of this edge route - - https://ngrok.com/docs/api#api-edge-route-saml-module-get - """ - path = "/edges/https/{edge_id}/routes/{id}/saml" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return EndpointSAML(self._client, result) - - def delete( - self, - edge_id: str, - id: str, - ): - """ - - :param edge_id: unique identifier of this edge - :param id: unique identifier of this edge route - - https://ngrok.com/docs/api#api-edge-route-saml-module-delete - """ - path = "/edges/https/{edge_id}/routes/{id}/saml" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - -class EdgeRouteOIDCModuleClient(object): - def __init__(self, client): - self._client = client - - def replace( - self, - edge_id: str, - id: str, - module: EndpointOIDC = None, - ) -> EndpointOIDC: - """ - - :param edge_id: - :param id: - :param module: - - https://ngrok.com/docs/api#api-edge-route-oidc-module-replace - """ - path = "/edges/https/{edge_id}/routes/{id}/oidc" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = extract_props(module) - result = self._client.http_client.put(path, body_arg) - return EndpointOIDC(self._client, result) - - def get( - self, - edge_id: str, - id: str, - ) -> EndpointOIDC: - """ - - :param edge_id: unique identifier of this edge - :param id: unique identifier of this edge route - - https://ngrok.com/docs/api#api-edge-route-oidc-module-get - """ - path = "/edges/https/{edge_id}/routes/{id}/oidc" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return EndpointOIDC(self._client, result) - - def delete( - self, - edge_id: str, - id: str, - ): - """ - - :param edge_id: unique identifier of this edge - :param id: unique identifier of this edge route - - https://ngrok.com/docs/api#api-edge-route-oidc-module-delete - """ - path = "/edges/https/{edge_id}/routes/{id}/oidc" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - -class EdgeRouteWebsocketTCPConverterModuleClient(object): - def __init__(self, client): - self._client = client - - def replace( - self, - edge_id: str, - id: str, - module: EndpointWebsocketTCPConverter = None, - ) -> EndpointWebsocketTCPConverter: - """ - - :param edge_id: - :param id: - :param module: - - https://ngrok.com/docs/api#api-edge-route-websocket-tcp-converter-module-replace - """ - path = "/edges/https/{edge_id}/routes/{id}/websocket_tcp_converter" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = extract_props(module) - result = self._client.http_client.put(path, body_arg) - return EndpointWebsocketTCPConverter(self._client, result) - - def get( - self, - edge_id: str, - id: str, - ) -> EndpointWebsocketTCPConverter: - """ - - :param edge_id: unique identifier of this edge - :param id: unique identifier of this edge route - - https://ngrok.com/docs/api#api-edge-route-websocket-tcp-converter-module-get - """ - path = "/edges/https/{edge_id}/routes/{id}/websocket_tcp_converter" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return EndpointWebsocketTCPConverter(self._client, result) - - def delete( - self, - edge_id: str, - id: str, - ): - """ - - :param edge_id: unique identifier of this edge - :param id: unique identifier of this edge route - - https://ngrok.com/docs/api#api-edge-route-websocket-tcp-converter-module-delete - """ - path = "/edges/https/{edge_id}/routes/{id}/websocket_tcp_converter" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - -class EdgeRouteUserAgentFilterModuleClient(object): - def __init__(self, client): - self._client = client - - def replace( - self, - edge_id: str, - id: str, - module: EndpointUserAgentFilter = None, - ) -> EndpointUserAgentFilter: - """ - - :param edge_id: - :param id: - :param module: - - https://ngrok.com/docs/api#api-edge-route-user-agent-filter-module-replace - """ - path = "/edges/https/{edge_id}/routes/{id}/user_agent_filter" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = extract_props(module) - result = self._client.http_client.put(path, body_arg) - return EndpointUserAgentFilter(self._client, result) - - def get( - self, - edge_id: str, - id: str, - ) -> EndpointUserAgentFilter: - """ - - :param edge_id: unique identifier of this edge - :param id: unique identifier of this edge route - - https://ngrok.com/docs/api#api-edge-route-user-agent-filter-module-get - """ - path = "/edges/https/{edge_id}/routes/{id}/user_agent_filter" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return EndpointUserAgentFilter(self._client, result) - - def delete( - self, - edge_id: str, - id: str, - ): - """ - - :param edge_id: unique identifier of this edge - :param id: unique identifier of this edge route - - https://ngrok.com/docs/api#api-edge-route-user-agent-filter-module-delete - """ - path = "/edges/https/{edge_id}/routes/{id}/user_agent_filter" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - -class EdgeRouteTrafficPolicyModuleClient(object): - def __init__(self, client): - self._client = client - - def replace( - self, - edge_id: str, - id: str, - module: EndpointTrafficPolicy = None, - ) -> EndpointTrafficPolicy: - """ - - :param edge_id: - :param id: - :param module: - - https://ngrok.com/docs/api#api-edge-route-traffic-policy-module-replace - """ - path = "/edges/https/{edge_id}/routes/{id}/traffic_policy" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = extract_props(module) - result = self._client.http_client.put(path, body_arg) - return EndpointTrafficPolicy(self._client, result) - - def get( - self, - edge_id: str, - id: str, - ) -> EndpointTrafficPolicy: - """ - - :param edge_id: unique identifier of this edge - :param id: unique identifier of this edge route - - https://ngrok.com/docs/api#api-edge-route-traffic-policy-module-get - """ - path = "/edges/https/{edge_id}/routes/{id}/traffic_policy" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return EndpointTrafficPolicy(self._client, result) - - def delete( - self, - edge_id: str, - id: str, - ): - """ - - :param edge_id: unique identifier of this edge - :param id: unique identifier of this edge route - - https://ngrok.com/docs/api#api-edge-route-traffic-policy-module-delete - """ - path = "/edges/https/{edge_id}/routes/{id}/traffic_policy" - path = path.format( - edge_id=edge_id, - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - -class EdgesTCPClient(object): - def __init__(self, client): - self._client = client - - def create( - self, - description: str = "", - metadata: str = "", - hostports: Sequence[str] = None, - backend: EndpointBackendMutate = None, - ip_restriction: EndpointIPPolicyMutate = None, - traffic_policy: EndpointTrafficPolicy = None, - ) -> TCPEdge: - """Create a TCP Edge - - :param description: human-readable description of what this edge will be used for; optional, max 255 bytes. - :param metadata: arbitrary user-defined machine-readable data of this edge. Optional, max 4096 bytes. - :param hostports: hostports served by this edge - :param backend: edge modules - :param ip_restriction: - :param traffic_policy: the traffic policy associated with this edge or null - - https://ngrok.com/docs/api#api-edges-tcp-create - """ - path = "/edges/tcp" - body_arg = dict( - description=description, - metadata=metadata, - hostports=hostports, - backend=extract_props(backend), - ip_restriction=extract_props(ip_restriction), - traffic_policy=extract_props(traffic_policy), - ) - result = self._client.http_client.post(path, body_arg) - return TCPEdge(self._client, result) - - def get( - self, - id: str, - ) -> TCPEdge: - """Get a TCP Edge by ID - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-edges-tcp-get - """ - path = "/edges/tcp/{id}" - path = path.format( - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return TCPEdge(self._client, result) - - def list( - self, - before_id: str = None, - limit: str = None, - ) -> TCPEdgeList: - """Returns a list of all TCP Edges on this account - - :param before_id: - :param limit: - - https://ngrok.com/docs/api#api-edges-tcp-list - """ - path = "/edges/tcp" - body_arg = dict( - before_id=before_id, - limit=limit, - ) - result = self._client.http_client.get(path, body_arg) - return TCPEdgeList(self._client, result) - - def update( - self, - id: str, - description: str = None, - metadata: str = None, - hostports: Sequence[str] = None, - backend: EndpointBackendMutate = None, - ip_restriction: EndpointIPPolicyMutate = None, - traffic_policy: EndpointTrafficPolicy = None, - ) -> TCPEdge: - """Updates a TCP Edge by ID. 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 edge - :param description: human-readable description of what this edge will be used for; optional, max 255 bytes. - :param metadata: arbitrary user-defined machine-readable data of this edge. Optional, max 4096 bytes. - :param hostports: hostports served by this edge - :param backend: edge modules - :param ip_restriction: - :param traffic_policy: the traffic policy associated with this edge or null - - https://ngrok.com/docs/api#api-edges-tcp-update - """ - path = "/edges/tcp/{id}" - path = path.format( - id=id, - ) - body_arg = dict( - description=description, - metadata=metadata, - hostports=hostports, - backend=extract_props(backend), - ip_restriction=extract_props(ip_restriction), - traffic_policy=extract_props(traffic_policy), - ) - result = self._client.http_client.patch(path, body_arg) - return TCPEdge(self._client, result) - - def delete( - self, - id: str, - ): - """Delete a TCP Edge by ID - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-edges-tcp-delete - """ - path = "/edges/tcp/{id}" - path = path.format( - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - -class TCPEdgeBackendModuleClient(object): - def __init__(self, client): - self._client = client - - def replace( - self, - id: str, - module: EndpointBackendMutate = None, - ) -> EndpointBackend: - """ - - :param id: - :param module: - - https://ngrok.com/docs/api#api-tcp-edge-backend-module-replace - """ - path = "/edges/tcp/{id}/backend" - path = path.format( - id=id, - ) - body_arg = extract_props(module) - result = self._client.http_client.put(path, body_arg) - return EndpointBackend(self._client, result) - - def get( - self, - id: str, - ) -> EndpointBackend: - """ - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-tcp-edge-backend-module-get - """ - path = "/edges/tcp/{id}/backend" - path = path.format( - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return EndpointBackend(self._client, result) - - def delete( - self, - id: str, - ): - """ - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-tcp-edge-backend-module-delete - """ - path = "/edges/tcp/{id}/backend" - path = path.format( - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - -class TCPEdgeIPRestrictionModuleClient(object): - def __init__(self, client): - self._client = client - - def replace( - self, - id: str, - module: EndpointIPPolicyMutate = None, - ) -> EndpointIPPolicy: - """ - - :param id: - :param module: - - https://ngrok.com/docs/api#api-tcp-edge-ip-restriction-module-replace - """ - path = "/edges/tcp/{id}/ip_restriction" - path = path.format( - id=id, - ) - body_arg = extract_props(module) - result = self._client.http_client.put(path, body_arg) - return EndpointIPPolicy(self._client, result) - - def get( - self, - id: str, - ) -> EndpointIPPolicy: - """ - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-tcp-edge-ip-restriction-module-get - """ - path = "/edges/tcp/{id}/ip_restriction" - path = path.format( - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return EndpointIPPolicy(self._client, result) - - def delete( - self, - id: str, - ): - """ - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-tcp-edge-ip-restriction-module-delete - """ - path = "/edges/tcp/{id}/ip_restriction" - path = path.format( - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - -class TCPEdgeTrafficPolicyModuleClient(object): - def __init__(self, client): - self._client = client - - def replace( - self, - id: str, - module: EndpointTrafficPolicy = None, - ) -> EndpointTrafficPolicy: - """ - - :param id: - :param module: - - https://ngrok.com/docs/api#api-tcp-edge-traffic-policy-module-replace - """ - path = "/edges/tcp/{id}/traffic_policy" - path = path.format( - id=id, - ) - body_arg = extract_props(module) - result = self._client.http_client.put(path, body_arg) - return EndpointTrafficPolicy(self._client, result) - - def get( - self, - id: str, - ) -> EndpointTrafficPolicy: - """ - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-tcp-edge-traffic-policy-module-get - """ - path = "/edges/tcp/{id}/traffic_policy" - path = path.format( - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return EndpointTrafficPolicy(self._client, result) - - def delete( - self, - id: str, - ): - """ - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-tcp-edge-traffic-policy-module-delete - """ - path = "/edges/tcp/{id}/traffic_policy" - path = path.format( - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - -class EdgesTLSClient(object): - def __init__(self, client): - self._client = client - - def create( - self, - description: str = "", - metadata: str = "", - hostports: Sequence[str] = None, - backend: EndpointBackendMutate = None, - ip_restriction: EndpointIPPolicyMutate = None, - mutual_tls: EndpointMutualTLSMutate = None, - tls_termination: EndpointTLSTermination = None, - traffic_policy: EndpointTrafficPolicy = None, - ) -> TLSEdge: - """Create a TLS Edge - - :param description: human-readable description of what this edge will be used for; optional, max 255 bytes. - :param metadata: arbitrary user-defined machine-readable data of this edge. Optional, max 4096 bytes. - :param hostports: hostports served by this edge - :param backend: edge modules - :param ip_restriction: - :param mutual_tls: - :param tls_termination: - :param traffic_policy: the traffic policy associated with this edge or null - - https://ngrok.com/docs/api#api-edges-tls-create - """ - path = "/edges/tls" - body_arg = dict( - description=description, - metadata=metadata, - hostports=hostports, - backend=extract_props(backend), - ip_restriction=extract_props(ip_restriction), - mutual_tls=extract_props(mutual_tls), - tls_termination=extract_props(tls_termination), - traffic_policy=extract_props(traffic_policy), - ) - result = self._client.http_client.post(path, body_arg) - return TLSEdge(self._client, result) - - def get( - self, - id: str, - ) -> TLSEdge: - """Get a TLS Edge by ID - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-edges-tls-get - """ - path = "/edges/tls/{id}" - path = path.format( - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return TLSEdge(self._client, result) - - def list( - self, - before_id: str = None, - limit: str = None, - ) -> TLSEdgeList: - """Returns a list of all TLS Edges on this account - - :param before_id: - :param limit: - - https://ngrok.com/docs/api#api-edges-tls-list - """ - path = "/edges/tls" - body_arg = dict( - before_id=before_id, - limit=limit, - ) - result = self._client.http_client.get(path, body_arg) - return TLSEdgeList(self._client, result) - - def update( - self, - id: str, - description: str = None, - metadata: str = None, - hostports: Sequence[str] = None, - backend: EndpointBackendMutate = None, - ip_restriction: EndpointIPPolicyMutate = None, - mutual_tls: EndpointMutualTLSMutate = None, - tls_termination: EndpointTLSTermination = None, - traffic_policy: EndpointTrafficPolicy = None, - ) -> TLSEdge: - """Updates a TLS Edge by ID. 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 edge - :param description: human-readable description of what this edge will be used for; optional, max 255 bytes. - :param metadata: arbitrary user-defined machine-readable data of this edge. Optional, max 4096 bytes. - :param hostports: hostports served by this edge - :param backend: edge modules - :param ip_restriction: - :param mutual_tls: - :param tls_termination: - :param traffic_policy: the traffic policy associated with this edge or null - - https://ngrok.com/docs/api#api-edges-tls-update - """ - path = "/edges/tls/{id}" - path = path.format( - id=id, - ) - body_arg = dict( - description=description, - metadata=metadata, - hostports=hostports, - backend=extract_props(backend), - ip_restriction=extract_props(ip_restriction), - mutual_tls=extract_props(mutual_tls), - tls_termination=extract_props(tls_termination), - traffic_policy=extract_props(traffic_policy), - ) - result = self._client.http_client.patch(path, body_arg) - return TLSEdge(self._client, result) - - def delete( - self, - id: str, - ): - """Delete a TLS Edge by ID - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-edges-tls-delete - """ - path = "/edges/tls/{id}" - path = path.format( - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - -class TLSEdgeBackendModuleClient(object): - def __init__(self, client): - self._client = client - - def replace( - self, - id: str, - module: EndpointBackendMutate = None, - ) -> EndpointBackend: - """ - - :param id: - :param module: - - https://ngrok.com/docs/api#api-tls-edge-backend-module-replace - """ - path = "/edges/tls/{id}/backend" - path = path.format( - id=id, - ) - body_arg = extract_props(module) - result = self._client.http_client.put(path, body_arg) - return EndpointBackend(self._client, result) - - def get( - self, - id: str, - ) -> EndpointBackend: - """ - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-tls-edge-backend-module-get - """ - path = "/edges/tls/{id}/backend" - path = path.format( - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return EndpointBackend(self._client, result) - - def delete( - self, - id: str, - ): - """ - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-tls-edge-backend-module-delete - """ - path = "/edges/tls/{id}/backend" - path = path.format( - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - -class TLSEdgeIPRestrictionModuleClient(object): - def __init__(self, client): - self._client = client - - def replace( - self, - id: str, - module: EndpointIPPolicyMutate = None, - ) -> EndpointIPPolicy: - """ - - :param id: - :param module: - - https://ngrok.com/docs/api#api-tls-edge-ip-restriction-module-replace - """ - path = "/edges/tls/{id}/ip_restriction" - path = path.format( - id=id, - ) - body_arg = extract_props(module) - result = self._client.http_client.put(path, body_arg) - return EndpointIPPolicy(self._client, result) - - def get( - self, - id: str, - ) -> EndpointIPPolicy: - """ - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-tls-edge-ip-restriction-module-get - """ - path = "/edges/tls/{id}/ip_restriction" - path = path.format( - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return EndpointIPPolicy(self._client, result) - - def delete( - self, - id: str, - ): - """ - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-tls-edge-ip-restriction-module-delete - """ - path = "/edges/tls/{id}/ip_restriction" - path = path.format( - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - -class TLSEdgeMutualTLSModuleClient(object): - def __init__(self, client): - self._client = client - - def replace( - self, - id: str, - module: EndpointMutualTLSMutate = None, - ) -> EndpointMutualTLS: - """ - - :param id: - :param module: - - https://ngrok.com/docs/api#api-tls-edge-mutual-tls-module-replace - """ - path = "/edges/tls/{id}/mutual_tls" - path = path.format( - id=id, - ) - body_arg = extract_props(module) - result = self._client.http_client.put(path, body_arg) - return EndpointMutualTLS(self._client, result) - - def get( - self, - id: str, - ) -> EndpointMutualTLS: - """ - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-tls-edge-mutual-tls-module-get - """ - path = "/edges/tls/{id}/mutual_tls" - path = path.format( - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return EndpointMutualTLS(self._client, result) - - def delete( - self, - id: str, - ): - """ - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-tls-edge-mutual-tls-module-delete - """ - path = "/edges/tls/{id}/mutual_tls" - path = path.format( - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - -class TLSEdgeTLSTerminationModuleClient(object): - def __init__(self, client): - self._client = client - - def replace( - self, - id: str, - module: EndpointTLSTermination = None, - ) -> EndpointTLSTermination: - """ - - :param id: - :param module: - - https://ngrok.com/docs/api#api-tls-edge-tls-termination-module-replace - """ - path = "/edges/tls/{id}/tls_termination" - path = path.format( - id=id, - ) - body_arg = extract_props(module) - result = self._client.http_client.put(path, body_arg) - return EndpointTLSTermination(self._client, result) - - def get( - self, - id: str, - ) -> EndpointTLSTermination: - """ - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-tls-edge-tls-termination-module-get - """ - path = "/edges/tls/{id}/tls_termination" - path = path.format( - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return EndpointTLSTermination(self._client, result) - - def delete( - self, - id: str, - ): - """ - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-tls-edge-tls-termination-module-delete - """ - path = "/edges/tls/{id}/tls_termination" - path = path.format( - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - -class TLSEdgeTrafficPolicyModuleClient(object): - def __init__(self, client): - self._client = client - - def replace( - self, - id: str, - module: EndpointTrafficPolicy = None, - ) -> EndpointTrafficPolicy: - """ - - :param id: - :param module: - - https://ngrok.com/docs/api#api-tls-edge-traffic-policy-module-replace - """ - path = "/edges/tls/{id}/traffic_policy" - path = path.format( - id=id, - ) - body_arg = extract_props(module) - result = self._client.http_client.put(path, body_arg) - return EndpointTrafficPolicy(self._client, result) - - def get( - self, - id: str, - ) -> EndpointTrafficPolicy: - """ - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-tls-edge-traffic-policy-module-get - """ - path = "/edges/tls/{id}/traffic_policy" - path = path.format( - id=id, - ) - body_arg = None - result = self._client.http_client.get(path, body_arg) - return EndpointTrafficPolicy(self._client, result) - - def delete( - self, - id: str, - ): - """ - - :param id: a resource identifier - - https://ngrok.com/docs/api#api-tls-edge-traffic-policy-module-delete - """ - path = "/edges/tls/{id}/traffic_policy" - path = path.format( - id=id, - ) - body_arg = None - self._client.http_client.delete(path, body_arg) - - class EndpointsClient(object): """Endpoints provides an API for querying the endpoint objects which define what tunnel or edge is used to serve a hostport. diff --git a/setup.py b/setup.py index baa25be..0d0ff97 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ def read_file(filename): setup( name="ngrok-api", - version="0.17.0", + version="0.0.0", description="ngrok HTTP API client library", long_description=read_file("README.md"), long_description_content_type="text/markdown", diff --git a/tests/test_ngrok.py b/tests/test_ngrok.py index c9834df..1edcdeb 100644 --- a/tests/test_ngrok.py +++ b/tests/test_ngrok.py @@ -198,102 +198,7 @@ def test_event_subscriptions(): mock.returns(None) ev_sub.delete() -def test_backends(): - c, mock = setup_api_client() - # create a 404 http response backend - mock.returns(mock_backend_404) - backend_404 = c.backends.http_response.create(description=description, body=body, status_code=status_code) - assert backend_404.body == body - assert backend_404.status_code == status_code - - # create a tunnel group backend - mock.returns(mock_backend_tg) - backend_tg = c.backends.tunnel_group.create(description=description) - assert backend_tg.description == description - - # create a failover backend - mock.returns(mock_backend_fo) - backend_fo = c.backends.failover.create(description=description, backends=[backend_tg.id, backend_404.id]) - assert backend_fo.description == description - - # delete all the backends - mock.returns(None) - backend_fo.delete() - backend_tg.delete() - backend_404.delete() - -def test_tcp_edges(): - c, mock = setup_api_client() - - backend_mutate = ngrok.datatypes.EndpointBackendMutate(c, {"enabled": True, - "backend_id": "bkdtg_26ttrtQgoYT4wF0LbAPyCliCTHu"}) - - # create TCP edge - mock.returns(mock_edge_tcp) - tcp_edg = c.edges.tcp.create(hostports=["1.tcp.ngrok.io:20021"], backend=backend_mutate, description=description) - assert tcp_edg.hostports == ["1.tcp.ngrok.io:20021"] - assert tcp_edg.description == description - - # list TCP edges - mock.returns(f"""{{"tcp_edges": [{mock_edge_tcp}]}}""") - c.edges.tcp.list() - - # delete TCP edge - mock.returns(None) - tcp_edg.delete() - -def test_tls_edges(): - c, mock = setup_api_client() - - backend_mutate = ngrok.datatypes.EndpointBackendMutate(c, {"enabled": True, - "backend_id": "bkdtg_26ttsZg57ucy3iShmgFeW5qnzR9"}) - - # create TLS edge - mock.returns(mock_edge_tls) - tls_edg = c.edges.tls.create(hostports=["utthvga8.ngrok.io:443"], backend=backend_mutate, description=description) - assert tls_edg.hostports == ["utthvga8.ngrok.io:443"] - assert tls_edg.description == description - - # list TLS edges - mock.returns(f"""{{"tls_edges": [{mock_edge_tls}]}}""") - c.edges.tls.list() - - # delete TLS edge - mock.returns(None) - tls_edg.delete() - -def test_https_edges(): - c, mock = setup_api_client() - - # create a https edge - mock.returns(mock_edge_https) - edg = c.edges.https.create(description=description) - assert edg.description == description - - # create a route with a failover backend attached to it - # compression is also enabled - backend_mutate = ngrok.datatypes.EndpointBackendMutate(c, {"enabled": True, - "backend_id": "bkdfo_26tiVQge4Ae9qXVmjORlUUbY6FJ"}) - compression = ngrok.datatypes.EndpointCompression(c, {"enabled": True}) - mock.returns(mock_edge_route_https) - rte = c.edges.https_routes.create(edge_id=edg.id, match_type="path_prefix", match="/", backend=backend_mutate, - compression=compression) - assert rte.match_type == "path_prefix" - assert rte.match == "/" - assert rte.compression is not None - - # update the backend module - mock.returns(mock_edge_route_https) - c.edge_modules.https_edge_route_backend.replace(edge_id=edg.id, id=rte.id, module=backend_mutate) - - # list https edges - mock.returns(f"""{{"https_edges": [{mock_edge_https}]}}""") - c.edges.https.list() - - # delete https edge - mock.returns(None) - edg.delete() description = "Test description"