@ngrok/ngrok-api 0.1.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (283) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +102 -31
  3. package/docs/CNAME +1 -0
  4. package/docs/assets/js/search.js +1 -1
  5. package/docs/classes/client.Ngrok.html +772 -0
  6. package/docs/classes/services.APIKeys.html +354 -0
  7. package/docs/classes/services.AbuseReports.html +261 -0
  8. package/docs/classes/services.AgentIngresses.html +343 -0
  9. package/docs/classes/services.CertificateAuthorities.html +354 -0
  10. package/docs/classes/services.Credentials.html +353 -0
  11. package/docs/classes/services.EdgeRouteBackendModule.html +270 -0
  12. package/docs/classes/services.EdgeRouteCircuitBreakerModule.html +270 -0
  13. package/docs/classes/services.EdgeRouteCompressionModule.html +270 -0
  14. package/docs/classes/services.EdgeRouteIPRestrictionModule.html +270 -0
  15. package/docs/classes/services.EdgeRouteOAuthModule.html +270 -0
  16. package/docs/classes/services.EdgeRouteOIDCModule.html +270 -0
  17. package/docs/classes/services.EdgeRouteRequestHeadersModule.html +270 -0
  18. package/docs/classes/services.EdgeRouteResponseHeadersModule.html +270 -0
  19. package/docs/classes/services.EdgeRouteSAMLModule.html +270 -0
  20. package/docs/classes/services.EdgeRouteWebhookVerificationModule.html +270 -0
  21. package/docs/classes/services.EdgeRouteWebsocketTCPConverterModule.html +270 -0
  22. package/docs/classes/services.EdgesHTTPS.html +343 -0
  23. package/docs/classes/services.EdgesHTTPSRoutes.html +317 -0
  24. package/docs/classes/services.EdgesTCP.html +343 -0
  25. package/docs/classes/services.EdgesTLS.html +343 -0
  26. package/docs/classes/services.Endpoints.html +256 -0
  27. package/docs/classes/services.EventDestinations.html +343 -0
  28. package/docs/classes/services.EventSources.html +349 -0
  29. package/docs/classes/services.EventSubscriptions.html +343 -0
  30. package/docs/classes/services.FailoverBackends.html +353 -0
  31. package/docs/classes/services.HTTPResponseBackends.html +318 -0
  32. package/docs/classes/services.HTTPSEdgeMutualTLSModule.html +270 -0
  33. package/docs/classes/services.HTTPSEdgeTLSTerminationModule.html +270 -0
  34. package/docs/classes/services.IPPolicies.html +353 -0
  35. package/docs/classes/services.IPPolicyRules.html +351 -0
  36. package/docs/classes/services.IPRestrictions.html +355 -0
  37. package/docs/classes/services.ReservedAddrs.html +352 -0
  38. package/docs/classes/services.ReservedDomains.html +417 -0
  39. package/docs/classes/services.SSHCertificateAuthorities.html +351 -0
  40. package/docs/classes/services.SSHCredentials.html +351 -0
  41. package/docs/classes/services.SSHHostCertificates.html +352 -0
  42. package/docs/classes/services.SSHUserCertificates.html +352 -0
  43. package/docs/classes/services.TCPEdgeBackendModule.html +270 -0
  44. package/docs/classes/services.TCPEdgeIPRestrictionModule.html +270 -0
  45. package/docs/classes/services.TLSCertificates.html +354 -0
  46. package/docs/classes/services.TLSEdgeBackendModule.html +270 -0
  47. package/docs/classes/services.TLSEdgeIPRestrictionModule.html +270 -0
  48. package/docs/classes/services.TLSEdgeMutualTLSModule.html +270 -0
  49. package/docs/classes/services.TLSEdgeTLSTerminationModule.html +270 -0
  50. package/docs/classes/services.TunnelGroupBackends.html +351 -0
  51. package/docs/classes/services.TunnelSessions.html +352 -0
  52. package/docs/classes/services.Tunnels.html +255 -0
  53. package/docs/classes/services.WeightedBackends.html +353 -0
  54. package/docs/index.html +103 -546
  55. package/docs/interfaces/client.NgrokConfig.html +179 -0
  56. package/docs/interfaces/{apikey.html → datatypes.APIKey.html} +41 -29
  57. package/docs/interfaces/{apikeycreate.html → datatypes.APIKeyCreate.html} +25 -13
  58. package/docs/interfaces/{apikeylist.html → datatypes.APIKeyList.html} +32 -20
  59. package/docs/interfaces/{apikeyupdate.html → datatypes.APIKeyUpdate.html} +28 -16
  60. package/docs/interfaces/{awsauth.html → datatypes.AWSAuth.html} +27 -15
  61. package/docs/interfaces/{awscredentials.html → datatypes.AWSCredentials.html} +31 -19
  62. package/docs/interfaces/{awsrole.html → datatypes.AWSRole.html} +25 -13
  63. package/docs/interfaces/{abusereport.html → datatypes.AbuseReport.html} +45 -33
  64. package/docs/interfaces/{abusereportcreate.html → datatypes.AbuseReportCreate.html} +25 -13
  65. package/docs/interfaces/{abusereporthostname.html → datatypes.AbuseReportHostname.html} +26 -14
  66. package/docs/interfaces/datatypes.AgentIngress.html +300 -0
  67. package/docs/interfaces/{ipwhitelistentrycreate.html → datatypes.AgentIngressCreate.html} +37 -25
  68. package/docs/interfaces/datatypes.AgentIngressList.html +205 -0
  69. package/docs/interfaces/{ipwhitelistentryupdate.html → datatypes.AgentIngressUpdate.html} +33 -21
  70. package/docs/interfaces/{certificateauthority.html → datatypes.CertificateAuthority.html} +73 -61
  71. package/docs/interfaces/{certificateauthoritycreate.html → datatypes.CertificateAuthorityCreate.html} +31 -19
  72. package/docs/interfaces/{certificateauthoritylist.html → datatypes.CertificateAuthorityList.html} +34 -22
  73. package/docs/interfaces/{certificateauthorityupdate.html → datatypes.CertificateAuthorityUpdate.html} +28 -16
  74. package/docs/interfaces/{credential.html → datatypes.Credential.html} +45 -33
  75. package/docs/interfaces/{credentialcreate.html → datatypes.CredentialCreate.html} +29 -17
  76. package/docs/interfaces/{credentiallist.html → datatypes.CredentialList.html} +32 -20
  77. package/docs/interfaces/{credentialupdate.html → datatypes.CredentialUpdate.html} +32 -20
  78. package/docs/interfaces/{endpointippolicyreplace.html → datatypes.EdgeBackendReplace.html} +29 -17
  79. package/docs/interfaces/{endpointbackendreplace.html → datatypes.EdgeIPRestrictionReplace.html} +29 -17
  80. package/docs/interfaces/{endpointresponseheadersreplace.html → datatypes.EdgeMutualTLSReplace.html} +29 -17
  81. package/docs/interfaces/datatypes.EdgeRouteBackendReplace.html +190 -0
  82. package/docs/interfaces/datatypes.EdgeRouteCircuitBreakerReplace.html +190 -0
  83. package/docs/interfaces/datatypes.EdgeRouteCompressionReplace.html +190 -0
  84. package/docs/interfaces/datatypes.EdgeRouteIPRestrictionReplace.html +190 -0
  85. package/docs/interfaces/{reserveddomaincertnstarget.html → datatypes.EdgeRouteItem.html} +36 -24
  86. package/docs/interfaces/datatypes.EdgeRouteOAuthReplace.html +190 -0
  87. package/docs/interfaces/datatypes.EdgeRouteOIDCReplace.html +190 -0
  88. package/docs/interfaces/datatypes.EdgeRouteRequestHeadersReplace.html +190 -0
  89. package/docs/interfaces/datatypes.EdgeRouteResponseHeadersReplace.html +190 -0
  90. package/docs/interfaces/datatypes.EdgeRouteSAMLReplace.html +190 -0
  91. package/docs/interfaces/datatypes.EdgeRouteWebhookVerificationReplace.html +190 -0
  92. package/docs/interfaces/datatypes.EdgeRouteWebsocketTCPConverterReplace.html +190 -0
  93. package/docs/interfaces/{endpointoauthreplace.html → datatypes.EdgeTLSTerminationAtEdgeReplace.html} +29 -17
  94. package/docs/interfaces/{endpointbasicauthreplace.html → datatypes.EdgeTLSTerminationReplace.html} +29 -17
  95. package/docs/interfaces/{empty.html → datatypes.Empty.html} +18 -7
  96. package/docs/interfaces/datatypes.Endpoint.html +395 -0
  97. package/docs/interfaces/{endpointbackend.html → datatypes.EndpointBackend.html} +27 -15
  98. package/docs/interfaces/{endpointlogging.html → datatypes.EndpointBackendMutate.html} +36 -24
  99. package/docs/interfaces/{endpointcircuitbreaker.html → datatypes.EndpointCircuitBreaker.html} +53 -41
  100. package/docs/interfaces/{endpointcompression.html → datatypes.EndpointCompression.html} +23 -11
  101. package/docs/interfaces/{endpointippolicy.html → datatypes.EndpointIPPolicy.html} +29 -17
  102. package/docs/interfaces/{endpointippolicymutate.html → datatypes.EndpointIPPolicyMutate.html} +29 -17
  103. package/docs/interfaces/datatypes.EndpointList.html +205 -0
  104. package/docs/interfaces/{endpointmutualtls.html → datatypes.EndpointMutualTLS.html} +29 -17
  105. package/docs/interfaces/{endpointmutualtlsmutate.html → datatypes.EndpointMutualTLSMutate.html} +29 -17
  106. package/docs/interfaces/{endpointoauth.html → datatypes.EndpointOAuth.html} +57 -45
  107. package/docs/interfaces/{endpointoauthfacebook.html → datatypes.EndpointOAuthFacebook.html} +48 -36
  108. package/docs/interfaces/{endpointoauthgithub.html → datatypes.EndpointOAuthGitHub.html} +55 -43
  109. package/docs/interfaces/{endpointoauthgoogle.html → datatypes.EndpointOAuthGoogle.html} +48 -36
  110. package/docs/interfaces/{endpointoauthmicrosoft.html → datatypes.EndpointOAuthMicrosoft.html} +48 -36
  111. package/docs/interfaces/{endpointoauthprovider.html → datatypes.EndpointOAuthProvider.html} +35 -23
  112. package/docs/interfaces/{endpointoidc.html → datatypes.EndpointOIDC.html} +65 -53
  113. package/docs/interfaces/{endpointrequestheaders.html → datatypes.EndpointRequestHeaders.html} +29 -17
  114. package/docs/interfaces/{endpointresponseheaders.html → datatypes.EndpointResponseHeaders.html} +29 -17
  115. package/docs/interfaces/{endpointsaml.html → datatypes.EndpointSAML.html} +121 -90
  116. package/docs/interfaces/{endpointsamlmutate.html → datatypes.EndpointSAMLMutate.html} +91 -60
  117. package/docs/interfaces/{endpointtlstermination.html → datatypes.EndpointTLSTermination.html} +37 -25
  118. package/docs/interfaces/{endpointloggingmutate.html → datatypes.EndpointTLSTerminationAtEdge.html} +33 -21
  119. package/docs/interfaces/{endpointwebhookvalidation.html → datatypes.EndpointWebhookValidation.html} +30 -18
  120. package/docs/interfaces/{staticbackendtls.html → datatypes.EndpointWebsocketTCPConverter.html} +27 -15
  121. package/docs/interfaces/{error.html → datatypes.Error.html} +37 -25
  122. package/docs/interfaces/{eventdestination.html → datatypes.EventDestination.html} +46 -34
  123. package/docs/interfaces/{eventdestinationcreate.html → datatypes.EventDestinationCreate.html} +34 -22
  124. package/docs/interfaces/{eventdestinationlist.html → datatypes.EventDestinationList.html} +34 -22
  125. package/docs/interfaces/{eventdestinationupdate.html → datatypes.EventDestinationUpdate.html} +37 -25
  126. package/docs/interfaces/{eventsource.html → datatypes.EventSource.html} +25 -13
  127. package/docs/interfaces/{eventsourcecreate.html → datatypes.EventSourceCreate.html} +28 -16
  128. package/docs/interfaces/{eventsourceitem.html → datatypes.EventSourceItem.html} +28 -16
  129. package/docs/interfaces/{eventsourcelist.html → datatypes.EventSourceList.html} +26 -14
  130. package/docs/interfaces/{eventsourcepaging.html → datatypes.EventSourcePaging.html} +25 -13
  131. package/docs/interfaces/{eventsourcereplace.html → datatypes.EventSourceReplace.html} +22 -10
  132. package/docs/interfaces/{eventsourceupdate.html → datatypes.EventSourceUpdate.html} +28 -16
  133. package/docs/interfaces/{eventsubscription.html → datatypes.EventSubscription.html} +45 -33
  134. package/docs/interfaces/{eventsubscriptioncreate.html → datatypes.EventSubscriptionCreate.html} +36 -24
  135. package/docs/interfaces/{eventsubscriptionlist.html → datatypes.EventSubscriptionList.html} +34 -22
  136. package/docs/interfaces/{eventsubscriptionupdate.html → datatypes.EventSubscriptionUpdate.html} +39 -27
  137. package/docs/interfaces/{eventtarget.html → datatypes.EventTarget.html} +33 -21
  138. package/docs/interfaces/{eventtargetcloudwatchlogs.html → datatypes.EventTargetCloudwatchLogs.html} +30 -18
  139. package/docs/interfaces/{eventtargetfirehose.html → datatypes.EventTargetFirehose.html} +30 -18
  140. package/docs/interfaces/{eventtargetkinesis.html → datatypes.EventTargetKinesis.html} +30 -18
  141. package/docs/interfaces/{staticbackend.html → datatypes.FailoverBackend.html} +52 -40
  142. package/docs/interfaces/{prioritybackendcreate.html → datatypes.FailoverBackendCreate.html} +31 -19
  143. package/docs/interfaces/{prioritybackendlist.html → datatypes.FailoverBackendList.html} +37 -25
  144. package/docs/interfaces/{prioritybackendupdate.html → datatypes.FailoverBackendUpdate.html} +34 -22
  145. package/docs/interfaces/datatypes.HTTPResponseBackend.html +295 -0
  146. package/docs/interfaces/{tunnelgroupbackend.html → datatypes.HTTPResponseBackendCreate.html} +53 -41
  147. package/docs/interfaces/{staticbackendlist.html → datatypes.HTTPResponseBackendList.html} +35 -38
  148. package/docs/interfaces/{tcpedge.html → datatypes.HTTPResponseBackendUpdate.html} +58 -65
  149. package/docs/interfaces/{eventstream.html → datatypes.HTTPSEdge.html} +78 -71
  150. package/docs/interfaces/{staticbackendupdate.html → datatypes.HTTPSEdgeCreate.html} +60 -48
  151. package/docs/interfaces/datatypes.HTTPSEdgeList.html +205 -0
  152. package/docs/interfaces/datatypes.HTTPSEdgeRoute.html +509 -0
  153. package/docs/interfaces/{endpointconfigurationcreate.html → datatypes.HTTPSEdgeRouteCreate.html} +141 -110
  154. package/docs/interfaces/{endpointconfiguration.html → datatypes.HTTPSEdgeRouteUpdate.html} +138 -145
  155. package/docs/interfaces/{tlsedgeupdate.html → datatypes.HTTPSEdgeUpdate.html} +65 -43
  156. package/docs/interfaces/{ippolicy.html → datatypes.IPPolicy.html} +37 -44
  157. package/docs/interfaces/{ippolicycreate.html → datatypes.IPPolicyCreate.html} +25 -32
  158. package/docs/interfaces/{ippolicylist.html → datatypes.IPPolicyList.html} +34 -22
  159. package/docs/interfaces/{ippolicyrule.html → datatypes.IPPolicyRule.html} +65 -34
  160. package/docs/interfaces/{ippolicyrulecreate.html → datatypes.IPPolicyRuleCreate.html} +53 -22
  161. package/docs/interfaces/{ippolicyrulelist.html → datatypes.IPPolicyRuleList.html} +34 -22
  162. package/docs/interfaces/{ippolicyruleupdate.html → datatypes.IPPolicyRuleUpdate.html} +31 -19
  163. package/docs/interfaces/{ippolicyupdate.html → datatypes.IPPolicyUpdate.html} +28 -16
  164. package/docs/interfaces/{iprestriction.html → datatypes.IPRestriction.html} +50 -38
  165. package/docs/interfaces/{iprestrictioncreate.html → datatypes.IPRestrictionCreate.html} +38 -26
  166. package/docs/interfaces/{iprestrictionlist.html → datatypes.IPRestrictionList.html} +34 -22
  167. package/docs/interfaces/{iprestrictionupdate.html → datatypes.IPRestrictionUpdate.html} +37 -25
  168. package/docs/interfaces/{item.html → datatypes.Item.html} +22 -10
  169. package/docs/interfaces/{paging.html → datatypes.Paging.html} +28 -16
  170. package/docs/interfaces/{ref.html → datatypes.Ref.html} +25 -13
  171. package/docs/interfaces/{reservedaddr.html → datatypes.ReservedAddr.html} +43 -50
  172. package/docs/interfaces/{reservedaddrcreate.html → datatypes.ReservedAddrCreate.html} +28 -35
  173. package/docs/interfaces/{reservedaddrlist.html → datatypes.ReservedAddrList.html} +34 -22
  174. package/docs/interfaces/datatypes.ReservedAddrUpdate.html +200 -0
  175. package/docs/interfaces/{reserveddomain.html → datatypes.ReservedDomain.html} +82 -89
  176. package/docs/interfaces/{reserveddomaincertjob.html → datatypes.ReservedDomainCertJob.html} +40 -47
  177. package/docs/interfaces/{reserveddomaincertpolicy.html → datatypes.ReservedDomainCertPolicy.html} +28 -16
  178. package/docs/interfaces/{reserveddomaincertstatus.html → datatypes.ReservedDomainCertStatus.html} +31 -19
  179. package/docs/interfaces/{reserveddomaincreate.html → datatypes.ReservedDomainCreate.html} +45 -71
  180. package/docs/interfaces/{reserveddomainlist.html → datatypes.ReservedDomainList.html} +34 -22
  181. package/docs/interfaces/datatypes.ReservedDomainUpdate.html +238 -0
  182. package/docs/interfaces/{sshcertificateauthority.html → datatypes.SSHCertificateAuthority.html} +49 -37
  183. package/docs/interfaces/{sshcertificateauthoritycreate.html → datatypes.SSHCertificateAuthorityCreate.html} +45 -33
  184. package/docs/interfaces/{sshcertificateauthoritylist.html → datatypes.SSHCertificateAuthorityList.html} +34 -22
  185. package/docs/interfaces/{sshcertificateauthorityupdate.html → datatypes.SSHCertificateAuthorityUpdate.html} +28 -16
  186. package/docs/interfaces/{sshcredential.html → datatypes.SSHCredential.html} +47 -35
  187. package/docs/interfaces/{sshcredentialcreate.html → datatypes.SSHCredentialCreate.html} +35 -23
  188. package/docs/interfaces/{sshcredentiallist.html → datatypes.SSHCredentialList.html} +34 -22
  189. package/docs/interfaces/{sshcredentialupdate.html → datatypes.SSHCredentialUpdate.html} +32 -20
  190. package/docs/interfaces/{sshhostcertificate.html → datatypes.SSHHostCertificate.html} +76 -64
  191. package/docs/interfaces/{sshhostcertificatecreate.html → datatypes.SSHHostCertificateCreate.html} +53 -41
  192. package/docs/interfaces/{sshhostcertificatelist.html → datatypes.SSHHostCertificateList.html} +34 -22
  193. package/docs/interfaces/{sshhostcertificateupdate.html → datatypes.SSHHostCertificateUpdate.html} +28 -16
  194. package/docs/interfaces/{sshusercertificate.html → datatypes.SSHUserCertificate.html} +87 -75
  195. package/docs/interfaces/{sshusercertificatecreate.html → datatypes.SSHUserCertificateCreate.html} +64 -52
  196. package/docs/interfaces/{sshusercertificatelist.html → datatypes.SSHUserCertificateList.html} +34 -22
  197. package/docs/interfaces/{sshusercertificateupdate.html → datatypes.SSHUserCertificateUpdate.html} +28 -16
  198. package/docs/interfaces/{tlsedge.html → datatypes.TCPEdge.html} +69 -66
  199. package/docs/interfaces/{tlsedgecreate.html → datatypes.TCPEdgeCreate.html} +64 -42
  200. package/docs/interfaces/{endpointconfigurationlist.html → datatypes.TCPEdgeList.html} +40 -28
  201. package/docs/interfaces/{eventstreamupdate.html → datatypes.TCPEdgeUpdate.html} +60 -53
  202. package/docs/interfaces/{tlscertificate.html → datatypes.TLSCertificate.html} +134 -122
  203. package/docs/interfaces/{tlscertificatecreate.html → datatypes.TLSCertificateCreate.html} +39 -27
  204. package/docs/interfaces/{tlscertificatelist.html → datatypes.TLSCertificateList.html} +34 -22
  205. package/docs/interfaces/{tlscertificatesans.html → datatypes.TLSCertificateSANs.html} +28 -16
  206. package/docs/interfaces/{tlscertificateupdate.html → datatypes.TLSCertificateUpdate.html} +28 -16
  207. package/docs/interfaces/datatypes.TLSEdge.html +323 -0
  208. package/docs/interfaces/datatypes.TLSEdgeCreate.html +266 -0
  209. package/docs/interfaces/datatypes.TLSEdgeList.html +205 -0
  210. package/docs/interfaces/{reserveddomainupdate.html → datatypes.TLSEdgeUpdate.html} +83 -62
  211. package/docs/interfaces/datatypes.Tunnel.html +357 -0
  212. package/docs/interfaces/datatypes.TunnelGroupBackend.html +281 -0
  213. package/docs/interfaces/{tunnelgroupbackendcreate.html → datatypes.TunnelGroupBackendCreate.html} +28 -16
  214. package/docs/interfaces/{tunnelgroupbackendlist.html → datatypes.TunnelGroupBackendList.html} +32 -20
  215. package/docs/interfaces/{tunnelgroupbackendupdate.html → datatypes.TunnelGroupBackendUpdate.html} +31 -19
  216. package/docs/interfaces/{tunnellist.html → datatypes.TunnelList.html} +32 -20
  217. package/docs/interfaces/{tunnelsession.html → datatypes.TunnelSession.html} +57 -45
  218. package/docs/interfaces/{tunnelsessionlist.html → datatypes.TunnelSessionList.html} +34 -22
  219. package/docs/interfaces/{tunnelsessionsupdate.html → datatypes.TunnelSessionsUpdate.html} +22 -10
  220. package/docs/interfaces/{weightedbackend.html → datatypes.WeightedBackend.html} +56 -25
  221. package/docs/interfaces/{weightedbackendcreate.html → datatypes.WeightedBackendCreate.html} +28 -16
  222. package/docs/interfaces/{weightedbackendlist.html → datatypes.WeightedBackendList.html} +32 -20
  223. package/docs/interfaces/{weightedbackendupdate.html → datatypes.WeightedBackendUpdate.html} +31 -19
  224. package/docs/{interfaces/endpointbasicauth.html → modules/client.html} +38 -20
  225. package/docs/modules/datatypes.html +796 -0
  226. package/docs/modules/services.html +316 -0
  227. package/docs/modules.html +16 -690
  228. package/lib/client.d.ts +179 -0
  229. package/lib/client.d.ts.map +1 -0
  230. package/lib/client.js +126 -0
  231. package/lib/client.js.map +1 -0
  232. package/lib/{types.d.ts → datatypes.d.ts} +729 -660
  233. package/lib/datatypes.d.ts.map +1 -0
  234. package/lib/{types.js → datatypes.js} +1 -1
  235. package/lib/datatypes.js.map +1 -0
  236. package/lib/index.d.ts +2 -378
  237. package/lib/index.d.ts.map +1 -1
  238. package/lib/index.js +2 -2148
  239. package/lib/index.js.map +1 -1
  240. package/lib/services.d.ts +993 -0
  241. package/lib/services.d.ts.map +1 -0
  242. package/lib/services.js +3600 -0
  243. package/lib/services.js.map +1 -0
  244. package/lib/util.d.ts +5 -0
  245. package/lib/util.d.ts.map +1 -0
  246. package/lib/util.js +53 -0
  247. package/lib/util.js.map +1 -0
  248. package/package.json +2 -2
  249. package/src/client.ts +322 -0
  250. package/src/{types.ts → datatypes.ts} +760 -689
  251. package/src/index.ts +2 -1775
  252. package/src/services.ts +3380 -0
  253. package/src/util.ts +48 -0
  254. package/test/apikey.test.js +41 -30
  255. package/docs/classes/ngrok.html +0 -5028
  256. package/docs/interfaces/endpointbackendmutate.html +0 -119
  257. package/docs/interfaces/endpointcircuitbreakerreplace.html +0 -164
  258. package/docs/interfaces/endpointcompressionreplace.html +0 -164
  259. package/docs/interfaces/endpointconfigurationupdate.html +0 -421
  260. package/docs/interfaces/endpointloggingreplace.html +0 -164
  261. package/docs/interfaces/endpointmutualtlsreplace.html +0 -164
  262. package/docs/interfaces/endpointoidcreplace.html +0 -164
  263. package/docs/interfaces/endpointrequestheadersreplace.html +0 -164
  264. package/docs/interfaces/endpointsamlreplace.html +0 -164
  265. package/docs/interfaces/endpointtlsterminationreplace.html +0 -164
  266. package/docs/interfaces/endpointwebhookvalidationreplace.html +0 -164
  267. package/docs/interfaces/eventstreamcreate.html +0 -250
  268. package/docs/interfaces/eventstreamlist.html +0 -193
  269. package/docs/interfaces/eventtargetdebug.html +0 -119
  270. package/docs/interfaces/eventtargets3.html +0 -250
  271. package/docs/interfaces/ipwhitelistentry.html +0 -250
  272. package/docs/interfaces/ipwhitelistentrylist.html +0 -193
  273. package/docs/interfaces/prioritybackend.html +0 -231
  274. package/docs/interfaces/reservedaddrupdate.html +0 -207
  275. package/docs/interfaces/rootresponse.html +0 -164
  276. package/docs/interfaces/sentevent.html +0 -150
  277. package/docs/interfaces/staticbackendcreate.html +0 -212
  278. package/docs/interfaces/tcpedgecreate.html +0 -188
  279. package/docs/interfaces/tcpedgeupdate.html +0 -207
  280. package/docs/interfaces/tunnel.html +0 -269
  281. package/lib/types.d.ts.map +0 -1
  282. package/lib/types.js.map +0 -1
  283. package/test/endpointConfigurations.test.js +0 -63
package/src/index.ts CHANGED
@@ -1,1775 +1,2 @@
1
- // Code generated by apic. DO NOT EDIT.
2
-
3
- import wretch, { Wretcher } from 'wretch';
4
- import * as formData from 'form-data';
5
- import { URLSearchParams } from 'url';
6
- import nodeFetch from 'node-fetch';
7
-
8
- import * as t from './types';
9
-
10
- export * from './types';
11
-
12
- wretch().polyfills({
13
- fetch: nodeFetch,
14
- FormData: formData,
15
- URLSearchParams,
16
- });
17
-
18
- interface Config {
19
- apiToken: string;
20
- baseUrl: string;
21
- }
22
-
23
- export class Ngrok {
24
- token: string;
25
- baseUrl: string;
26
-
27
- rest: Wretcher;
28
-
29
- /**
30
- * Creates an instance of the Ngrok REST client
31
- * @constructor
32
- * @param {Object} config - config.apiToken and config.baseUrl
33
- */
34
- constructor({ baseUrl = 'https://api.ngrok.com', apiToken }: Config) {
35
- this.baseUrl = baseUrl;
36
-
37
- if (apiToken) {
38
- this.token = apiToken;
39
- } else {
40
- throw new Error('Cannot create ngrok client without an API token');
41
- }
42
-
43
- this.rest = wretch()
44
- .url(baseUrl)
45
- .headers({
46
- 'User-Agent': 'ngrok-ts-user-agent',
47
- 'Ngrok-Version': '2',
48
- })
49
- .content('application/json')
50
- .auth('Bearer ' + this.token);
51
- }
52
-
53
- AbuseReports = {
54
- /** Creates a new abuse report which will be reviewed by our system and abuse response team. This API is only available to authorized accounts. Contact abuse@ngrok.com to request access */
55
- create: (arg: t.AbuseReportCreate): Promise<t.AbuseReport> =>
56
- this.rest
57
- .url(`/abuse_reports`)
58
- .post(serializeMap(arg))
59
- .json()
60
- .then(onFulfilled, onRejected),
61
- /** Get the detailed status of abuse report by ID. */
62
- get: (arg: t.Item): Promise<t.AbuseReport> =>
63
- this.rest
64
- .url(`/abuse_reports/${arg.id}`)
65
- .get()
66
- .json()
67
- .then(onFulfilled, onRejected),
68
- };
69
-
70
- APIKeys = {
71
- /** Create a new API key. The generated API key can be used to authenticate to the ngrok API. */
72
- create: (arg: t.APIKeyCreate): Promise<t.APIKey> =>
73
- this.rest
74
- .url(`/api_keys`)
75
- .post(serializeMap(arg))
76
- .json()
77
- .then(onFulfilled, onRejected),
78
- /** Delete an API key by ID */
79
- delete: (arg: t.Item): Promise<t.Empty> =>
80
- this.rest
81
- .url(`/api_keys/${arg.id}`)
82
- .delete()
83
- .json()
84
- .then(onFulfilled, onRejected),
85
- /** Get the details of an API key by ID. */
86
- get: (arg: t.Item): Promise<t.APIKey> =>
87
- this.rest
88
- .url(`/api_keys/${arg.id}`)
89
- .get()
90
- .json()
91
- .then(onFulfilled, onRejected),
92
- /** List all API keys owned by this account */
93
- list: async (): Promise<Array<t.APIKey>> => {
94
- const array: Array<t.APIKey> = [];
95
- for await (const item of this.APIKeys._asyncList()) {
96
- array.push(item);
97
- }
98
- return array;
99
- },
100
- _pagedList: (arg: t.Paging): Promise<t.APIKeyList> =>
101
- this.rest
102
- .url(`/api_keys`)
103
- .query(arg)
104
- .get()
105
- .json()
106
- .then(onFulfilled, onRejected),
107
- _asyncList: async function* () {
108
- const limit = '100';
109
- let nextPage = 'initial loop';
110
- let page: t.Paging = { limit: limit };
111
-
112
- while (nextPage) {
113
- const pagedList = await this._pagedList(page);
114
- nextPage = pagedList.next_page_uri;
115
- const items: t.APIKey[] = pagedList.keys;
116
-
117
- if (nextPage) {
118
- page = {
119
- before_id: items[items.length - 1].id,
120
- limit: limit,
121
- };
122
- }
123
-
124
- for (const item of items) {
125
- yield item;
126
- }
127
- }
128
- },
129
- /** Update attributes of an API key by ID. */
130
- update: (arg: t.APIKeyUpdate): Promise<t.APIKey> =>
131
- this.rest
132
- .url(`/api_keys/${arg.id}`)
133
- .patch(serializeMap(arg))
134
- .json()
135
- .then(onFulfilled, onRejected),
136
- };
137
-
138
- CertificateAuthorities = {
139
- /** Upload a new Certificate Authority */
140
- create: (
141
- arg: t.CertificateAuthorityCreate
142
- ): Promise<t.CertificateAuthority> =>
143
- this.rest
144
- .url(`/certificate_authorities`)
145
- .post(serializeMap(arg))
146
- .json()
147
- .then(onFulfilled, onRejected),
148
- /** Delete a Certificate Authority */
149
- delete: (arg: t.Item): Promise<t.Empty> =>
150
- this.rest
151
- .url(`/certificate_authorities/${arg.id}`)
152
- .delete()
153
- .json()
154
- .then(onFulfilled, onRejected),
155
- /** Get detailed information about a certficate authority */
156
- get: (arg: t.Item): Promise<t.CertificateAuthority> =>
157
- this.rest
158
- .url(`/certificate_authorities/${arg.id}`)
159
- .get()
160
- .json()
161
- .then(onFulfilled, onRejected),
162
- /** List all Certificate Authority on this account */
163
- list: async (): Promise<Array<t.CertificateAuthority>> => {
164
- const array: Array<t.CertificateAuthority> = [];
165
- for await (const item of this.CertificateAuthorities._asyncList()) {
166
- array.push(item);
167
- }
168
- return array;
169
- },
170
- _pagedList: (arg: t.Paging): Promise<t.CertificateAuthorityList> =>
171
- this.rest
172
- .url(`/certificate_authorities`)
173
- .query(arg)
174
- .get()
175
- .json()
176
- .then(onFulfilled, onRejected),
177
- _asyncList: async function* () {
178
- const limit = '100';
179
- let nextPage = 'initial loop';
180
- let page: t.Paging = { limit: limit };
181
-
182
- while (nextPage) {
183
- const pagedList = await this._pagedList(page);
184
- nextPage = pagedList.next_page_uri;
185
- const items: t.CertificateAuthority[] =
186
- pagedList.certificate_authorities;
187
-
188
- if (nextPage) {
189
- page = {
190
- before_id: items[items.length - 1].id,
191
- limit: limit,
192
- };
193
- }
194
-
195
- for (const item of items) {
196
- yield item;
197
- }
198
- }
199
- },
200
- /** Update attributes of a Certificate Authority by ID */
201
- update: (
202
- arg: t.CertificateAuthorityUpdate
203
- ): Promise<t.CertificateAuthority> =>
204
- this.rest
205
- .url(`/certificate_authorities/${arg.id}`)
206
- .patch(serializeMap(arg))
207
- .json()
208
- .then(onFulfilled, onRejected),
209
- };
210
-
211
- Credentials = {
212
- /** Create a new tunnel authtoken credential. This authtoken credential can be used to start a new tunnel session. The response to this API call is the only time the generated token is available. If you need it for future use, you must save it securely yourself. */
213
- create: (arg: t.CredentialCreate): Promise<t.Credential> =>
214
- this.rest
215
- .url(`/credentials`)
216
- .post(serializeMap(arg))
217
- .json()
218
- .then(onFulfilled, onRejected),
219
- /** Delete a tunnel authtoken credential by ID */
220
- delete: (arg: t.Item): Promise<t.Empty> =>
221
- this.rest
222
- .url(`/credentials/${arg.id}`)
223
- .delete()
224
- .json()
225
- .then(onFulfilled, onRejected),
226
- /** Get detailed information about a tunnel authtoken credential */
227
- get: (arg: t.Item): Promise<t.Credential> =>
228
- this.rest
229
- .url(`/credentials/${arg.id}`)
230
- .get()
231
- .json()
232
- .then(onFulfilled, onRejected),
233
- /** List all tunnel authtoken credentials on this account */
234
- list: async (): Promise<Array<t.Credential>> => {
235
- const array: Array<t.Credential> = [];
236
- for await (const item of this.Credentials._asyncList()) {
237
- array.push(item);
238
- }
239
- return array;
240
- },
241
- _pagedList: (arg: t.Paging): Promise<t.CredentialList> =>
242
- this.rest
243
- .url(`/credentials`)
244
- .query(arg)
245
- .get()
246
- .json()
247
- .then(onFulfilled, onRejected),
248
- _asyncList: async function* () {
249
- const limit = '100';
250
- let nextPage = 'initial loop';
251
- let page: t.Paging = { limit: limit };
252
-
253
- while (nextPage) {
254
- const pagedList = await this._pagedList(page);
255
- nextPage = pagedList.next_page_uri;
256
- const items: t.Credential[] = pagedList.credentials;
257
-
258
- if (nextPage) {
259
- page = {
260
- before_id: items[items.length - 1].id,
261
- limit: limit,
262
- };
263
- }
264
-
265
- for (const item of items) {
266
- yield item;
267
- }
268
- }
269
- },
270
- /** Update attributes of an tunnel authtoken credential by ID */
271
- update: (arg: t.CredentialUpdate): Promise<t.Credential> =>
272
- this.rest
273
- .url(`/credentials/${arg.id}`)
274
- .patch(serializeMap(arg))
275
- .json()
276
- .then(onFulfilled, onRejected),
277
- };
278
-
279
- EndpointConfigurations = {
280
- /** Create a new endpoint configuration */
281
- create: (
282
- arg: t.EndpointConfigurationCreate
283
- ): Promise<t.EndpointConfiguration> =>
284
- this.rest
285
- .url(`/endpoint_configurations`)
286
- .post(serializeMap(arg))
287
- .json()
288
- .then(onFulfilled, onRejected),
289
- /** Delete an endpoint configuration. This operation will fail if the endpoint configuration is still referenced by any reserved domain or reserved address. */
290
- delete: (arg: t.Item): Promise<t.Empty> =>
291
- this.rest
292
- .url(`/endpoint_configurations/${arg.id}`)
293
- .delete()
294
- .json()
295
- .then(onFulfilled, onRejected),
296
- /** Returns detailed information about an endpoint configuration */
297
- get: (arg: t.Item): Promise<t.EndpointConfiguration> =>
298
- this.rest
299
- .url(`/endpoint_configurations/${arg.id}`)
300
- .get()
301
- .json()
302
- .then(onFulfilled, onRejected),
303
- /** Returns a list of all endpoint configurations on this account */
304
- list: async (): Promise<Array<t.EndpointConfiguration>> => {
305
- const array: Array<t.EndpointConfiguration> = [];
306
- for await (const item of this.EndpointConfigurations._asyncList()) {
307
- array.push(item);
308
- }
309
- return array;
310
- },
311
- _pagedList: (arg: t.Paging): Promise<t.EndpointConfigurationList> =>
312
- this.rest
313
- .url(`/endpoint_configurations`)
314
- .query(arg)
315
- .get()
316
- .json()
317
- .then(onFulfilled, onRejected),
318
- _asyncList: async function* () {
319
- const limit = '100';
320
- let nextPage = 'initial loop';
321
- let page: t.Paging = { limit: limit };
322
-
323
- while (nextPage) {
324
- const pagedList = await this._pagedList(page);
325
- nextPage = pagedList.next_page_uri;
326
- const items: t.EndpointConfiguration[] =
327
- pagedList.endpoint_configurations;
328
-
329
- if (nextPage) {
330
- page = {
331
- before_id: items[items.length - 1].id,
332
- limit: limit,
333
- };
334
- }
335
-
336
- for (const item of items) {
337
- yield item;
338
- }
339
- }
340
- },
341
- /** Updates an endpoint configuration. If a module is not specified in the update, it will not be modified. However, each module configuration that is specified will completely replace the existing value. There is no way to delete an existing module via this API, instead use the delete module API. */
342
- update: (
343
- arg: t.EndpointConfigurationUpdate
344
- ): Promise<t.EndpointConfiguration> =>
345
- this.rest
346
- .url(`/endpoint_configurations/${arg.id}`)
347
- .patch(serializeMap(arg))
348
- .json()
349
- .then(onFulfilled, onRejected),
350
- };
351
-
352
- EventStreams = {
353
- /** Create a new Event Stream. It will not apply to anything until you associate it with one or more Endpoint Configs. */
354
- create: (arg: t.EventStreamCreate): Promise<t.EventStream> =>
355
- this.rest
356
- .url(`/event_streams`)
357
- .post(serializeMap(arg))
358
- .json()
359
- .then(onFulfilled, onRejected),
360
- /** Delete an Event Stream. Associated Event Destinations will be preserved. */
361
- delete: (arg: t.Item): Promise<t.Empty> =>
362
- this.rest
363
- .url(`/event_streams/${arg.id}`)
364
- .delete()
365
- .json()
366
- .then(onFulfilled, onRejected),
367
- /** Get detailed information about an Event Stream by ID. */
368
- get: (arg: t.Item): Promise<t.EventStream> =>
369
- this.rest
370
- .url(`/event_streams/${arg.id}`)
371
- .get()
372
- .json()
373
- .then(onFulfilled, onRejected),
374
- /** List all Event Streams available on this account. */
375
- list: async (): Promise<Array<t.EventStream>> => {
376
- const array: Array<t.EventStream> = [];
377
- for await (const item of this.EventStreams._asyncList()) {
378
- array.push(item);
379
- }
380
- return array;
381
- },
382
- _pagedList: (arg: t.Paging): Promise<t.EventStreamList> =>
383
- this.rest
384
- .url(`/event_streams`)
385
- .query(arg)
386
- .get()
387
- .json()
388
- .then(onFulfilled, onRejected),
389
- _asyncList: async function* () {
390
- const limit = '100';
391
- let nextPage = 'initial loop';
392
- let page: t.Paging = { limit: limit };
393
-
394
- while (nextPage) {
395
- const pagedList = await this._pagedList(page);
396
- nextPage = pagedList.next_page_uri;
397
- const items: t.EventStream[] = pagedList.event_streams;
398
-
399
- if (nextPage) {
400
- page = {
401
- before_id: items[items.length - 1].id,
402
- limit: limit,
403
- };
404
- }
405
-
406
- for (const item of items) {
407
- yield item;
408
- }
409
- }
410
- },
411
- /** Update attributes of an Event Stream by ID. */
412
- update: (arg: t.EventStreamUpdate): Promise<t.EventStream> =>
413
- this.rest
414
- .url(`/event_streams/${arg.id}`)
415
- .patch(serializeMap(arg))
416
- .json()
417
- .then(onFulfilled, onRejected),
418
- };
419
-
420
- EventDestinations = {
421
- /** Create a new Event Destination. It will not apply to anything until it is associated with an Event Stream, and that Event Stream is associated with an Endpoint Config. */
422
- create: (arg: t.EventDestinationCreate): Promise<t.EventDestination> =>
423
- this.rest
424
- .url(`/event_destinations`)
425
- .post(serializeMap(arg))
426
- .json()
427
- .then(onFulfilled, onRejected),
428
- /** Delete an Event Destination. If the Event Destination is still referenced by an Event Stream, this will throw an error until that Event Stream has removed that reference. */
429
- delete: (arg: t.Item): Promise<t.Empty> =>
430
- this.rest
431
- .url(`/event_destinations/${arg.id}`)
432
- .delete()
433
- .json()
434
- .then(onFulfilled, onRejected),
435
- /** Get detailed information about an Event Destination by ID. */
436
- get: (arg: t.Item): Promise<t.EventDestination> =>
437
- this.rest
438
- .url(`/event_destinations/${arg.id}`)
439
- .get()
440
- .json()
441
- .then(onFulfilled, onRejected),
442
- /** List all Event Destinations on this account. */
443
- list: async (): Promise<Array<t.EventDestination>> => {
444
- const array: Array<t.EventDestination> = [];
445
- for await (const item of this.EventDestinations._asyncList()) {
446
- array.push(item);
447
- }
448
- return array;
449
- },
450
- _pagedList: (arg: t.Paging): Promise<t.EventDestinationList> =>
451
- this.rest
452
- .url(`/event_destinations`)
453
- .query(arg)
454
- .get()
455
- .json()
456
- .then(onFulfilled, onRejected),
457
- _asyncList: async function* () {
458
- const limit = '100';
459
- let nextPage = 'initial loop';
460
- let page: t.Paging = { limit: limit };
461
-
462
- while (nextPage) {
463
- const pagedList = await this._pagedList(page);
464
- nextPage = pagedList.next_page_uri;
465
- const items: t.EventDestination[] = pagedList.event_destinations;
466
-
467
- if (nextPage) {
468
- page = {
469
- before_id: items[items.length - 1].id,
470
- limit: limit,
471
- };
472
- }
473
-
474
- for (const item of items) {
475
- yield item;
476
- }
477
- }
478
- },
479
- /** Update attributes of an Event Destination. */
480
- update: (arg: t.EventDestinationUpdate): Promise<t.EventDestination> =>
481
- this.rest
482
- .url(`/event_destinations/${arg.id}`)
483
- .patch(serializeMap(arg))
484
- .json()
485
- .then(onFulfilled, onRejected),
486
- };
487
-
488
- EventSubscriptions = {
489
- /** Create an Event Subscription. */
490
- create: (arg: t.EventSubscriptionCreate): Promise<t.EventSubscription> =>
491
- this.rest
492
- .url(`/event_subscriptions`)
493
- .post(serializeMap(arg))
494
- .json()
495
- .then(onFulfilled, onRejected),
496
- /** Delete an Event Subscription. */
497
- delete: (arg: t.Item): Promise<t.Empty> =>
498
- this.rest
499
- .url(`/event_subscriptions/${arg.id}`)
500
- .delete()
501
- .json()
502
- .then(onFulfilled, onRejected),
503
- /** Get an Event Subscription by ID. */
504
- get: (arg: t.Item): Promise<t.EventSubscription> =>
505
- this.rest
506
- .url(`/event_subscriptions/${arg.id}`)
507
- .get()
508
- .json()
509
- .then(onFulfilled, onRejected),
510
- /** List this Account's Event Subscriptions. */
511
- list: async (): Promise<Array<t.EventSubscription>> => {
512
- const array: Array<t.EventSubscription> = [];
513
- for await (const item of this.EventSubscriptions._asyncList()) {
514
- array.push(item);
515
- }
516
- return array;
517
- },
518
- _pagedList: (arg: t.Paging): Promise<t.EventSubscriptionList> =>
519
- this.rest
520
- .url(`/event_subscriptions`)
521
- .query(arg)
522
- .get()
523
- .json()
524
- .then(onFulfilled, onRejected),
525
- _asyncList: async function* () {
526
- const limit = '100';
527
- let nextPage = 'initial loop';
528
- let page: t.Paging = { limit: limit };
529
-
530
- while (nextPage) {
531
- const pagedList = await this._pagedList(page);
532
- nextPage = pagedList.next_page_uri;
533
- const items: t.EventSubscription[] = pagedList.event_subscriptions;
534
-
535
- if (nextPage) {
536
- page = {
537
- before_id: items[items.length - 1].id,
538
- limit: limit,
539
- };
540
- }
541
-
542
- for (const item of items) {
543
- yield item;
544
- }
545
- }
546
- },
547
- /** Update an Event Subscription. */
548
- update: (arg: t.EventSubscriptionUpdate): Promise<t.EventSubscription> =>
549
- this.rest
550
- .url(`/event_subscriptions/${arg.id}`)
551
- .patch(serializeMap(arg))
552
- .json()
553
- .then(onFulfilled, onRejected),
554
- };
555
-
556
- EventSources = {
557
- /** Add an additional type for which this event subscription will trigger */
558
- create: (arg: t.EventSourceCreate): Promise<t.EventSource> =>
559
- this.rest
560
- .url(`/event_subscriptions/${arg.subscription_id}/sources`)
561
- .post(serializeMap(arg))
562
- .json()
563
- .then(onFulfilled, onRejected),
564
- /** Remove a type for which this event subscription will trigger */
565
- delete: (arg: t.EventSourceItem): Promise<t.Empty> =>
566
- this.rest
567
- .url(`/event_subscriptions/${arg.subscription_id}/sources/${arg.type}`)
568
- .delete()
569
- .json()
570
- .then(onFulfilled, onRejected),
571
- /** Get the details for a given type that triggers for the given event subscription */
572
- get: (arg: t.EventSourceItem): Promise<t.EventSource> =>
573
- this.rest
574
- .url(`/event_subscriptions/${arg.subscription_id}/sources/${arg.type}`)
575
- .get()
576
- .json()
577
- .then(onFulfilled, onRejected),
578
- /** List the types for which this event subscription will trigger */
579
- list: (arg: t.EventSourcePaging): Promise<t.EventSourceList> =>
580
- this.rest
581
- .url(`/event_subscriptions/${arg.subscription_id}/sources`)
582
- .get()
583
- .json()
584
- .then(onFulfilled, onRejected),
585
- /** Update the type for which this event subscription will trigger */
586
- update: (arg: t.EventSourceUpdate): Promise<t.EventSource> =>
587
- this.rest
588
- .url(`/event_subscriptions/${arg.subscription_id}/sources/${arg.type}`)
589
- .patch(serializeMap(arg))
590
- .json()
591
- .then(onFulfilled, onRejected),
592
- };
593
-
594
- IPPolicies = {
595
- /** Create a new IP policy. It will not apply to any traffic until you associate to a traffic source via an endpoint configuration or IP restriction. */
596
- create: (arg: t.IPPolicyCreate): Promise<t.IPPolicy> =>
597
- this.rest
598
- .url(`/ip_policies`)
599
- .post(serializeMap(arg))
600
- .json()
601
- .then(onFulfilled, onRejected),
602
- /** Delete an IP policy. If the IP policy is referenced by another object for the purposes of traffic restriction it will be treated as if the IP policy remains but has zero rules. */
603
- delete: (arg: t.Item): Promise<t.Empty> =>
604
- this.rest
605
- .url(`/ip_policies/${arg.id}`)
606
- .delete()
607
- .json()
608
- .then(onFulfilled, onRejected),
609
- /** Get detailed information about an IP policy by ID. */
610
- get: (arg: t.Item): Promise<t.IPPolicy> =>
611
- this.rest
612
- .url(`/ip_policies/${arg.id}`)
613
- .get()
614
- .json()
615
- .then(onFulfilled, onRejected),
616
- /** List all IP policies on this account */
617
- list: async (): Promise<Array<t.IPPolicy>> => {
618
- const array: Array<t.IPPolicy> = [];
619
- for await (const item of this.IPPolicies._asyncList()) {
620
- array.push(item);
621
- }
622
- return array;
623
- },
624
- _pagedList: (arg: t.Paging): Promise<t.IPPolicyList> =>
625
- this.rest
626
- .url(`/ip_policies`)
627
- .query(arg)
628
- .get()
629
- .json()
630
- .then(onFulfilled, onRejected),
631
- _asyncList: async function* () {
632
- const limit = '100';
633
- let nextPage = 'initial loop';
634
- let page: t.Paging = { limit: limit };
635
-
636
- while (nextPage) {
637
- const pagedList = await this._pagedList(page);
638
- nextPage = pagedList.next_page_uri;
639
- const items: t.IPPolicy[] = pagedList.ip_policies;
640
-
641
- if (nextPage) {
642
- page = {
643
- before_id: items[items.length - 1].id,
644
- limit: limit,
645
- };
646
- }
647
-
648
- for (const item of items) {
649
- yield item;
650
- }
651
- }
652
- },
653
- /** Update attributes of an IP policy by ID */
654
- update: (arg: t.IPPolicyUpdate): Promise<t.IPPolicy> =>
655
- this.rest
656
- .url(`/ip_policies/${arg.id}`)
657
- .patch(serializeMap(arg))
658
- .json()
659
- .then(onFulfilled, onRejected),
660
- };
661
-
662
- IPPolicyRules = {
663
- /** Create a new IP policy rule attached to an IP Policy. */
664
- create: (arg: t.IPPolicyRuleCreate): Promise<t.IPPolicyRule> =>
665
- this.rest
666
- .url(`/ip_policy_rules`)
667
- .post(serializeMap(arg))
668
- .json()
669
- .then(onFulfilled, onRejected),
670
- /** Delete an IP policy rule. */
671
- delete: (arg: t.Item): Promise<t.Empty> =>
672
- this.rest
673
- .url(`/ip_policy_rules/${arg.id}`)
674
- .delete()
675
- .json()
676
- .then(onFulfilled, onRejected),
677
- /** Get detailed information about an IP policy rule by ID. */
678
- get: (arg: t.Item): Promise<t.IPPolicyRule> =>
679
- this.rest
680
- .url(`/ip_policy_rules/${arg.id}`)
681
- .get()
682
- .json()
683
- .then(onFulfilled, onRejected),
684
- /** List all IP policy rules on this account */
685
- list: async (): Promise<Array<t.IPPolicyRule>> => {
686
- const array: Array<t.IPPolicyRule> = [];
687
- for await (const item of this.IPPolicyRules._asyncList()) {
688
- array.push(item);
689
- }
690
- return array;
691
- },
692
- _pagedList: (arg: t.Paging): Promise<t.IPPolicyRuleList> =>
693
- this.rest
694
- .url(`/ip_policy_rules`)
695
- .query(arg)
696
- .get()
697
- .json()
698
- .then(onFulfilled, onRejected),
699
- _asyncList: async function* () {
700
- const limit = '100';
701
- let nextPage = 'initial loop';
702
- let page: t.Paging = { limit: limit };
703
-
704
- while (nextPage) {
705
- const pagedList = await this._pagedList(page);
706
- nextPage = pagedList.next_page_uri;
707
- const items: t.IPPolicyRule[] = pagedList.ip_policy_rules;
708
-
709
- if (nextPage) {
710
- page = {
711
- before_id: items[items.length - 1].id,
712
- limit: limit,
713
- };
714
- }
715
-
716
- for (const item of items) {
717
- yield item;
718
- }
719
- }
720
- },
721
- /** Update attributes of an IP policy rule by ID */
722
- update: (arg: t.IPPolicyRuleUpdate): Promise<t.IPPolicyRule> =>
723
- this.rest
724
- .url(`/ip_policy_rules/${arg.id}`)
725
- .patch(serializeMap(arg))
726
- .json()
727
- .then(onFulfilled, onRejected),
728
- };
729
-
730
- IPRestrictions = {
731
- /** Create a new IP restriction */
732
- create: (arg: t.IPRestrictionCreate): Promise<t.IPRestriction> =>
733
- this.rest
734
- .url(`/ip_restrictions`)
735
- .post(serializeMap(arg))
736
- .json()
737
- .then(onFulfilled, onRejected),
738
- /** Delete an IP restriction */
739
- delete: (arg: t.Item): Promise<t.Empty> =>
740
- this.rest
741
- .url(`/ip_restrictions/${arg.id}`)
742
- .delete()
743
- .json()
744
- .then(onFulfilled, onRejected),
745
- /** Get detailed information about an IP restriction */
746
- get: (arg: t.Item): Promise<t.IPRestriction> =>
747
- this.rest
748
- .url(`/ip_restrictions/${arg.id}`)
749
- .get()
750
- .json()
751
- .then(onFulfilled, onRejected),
752
- /** List all IP restrictions on this account */
753
- list: async (): Promise<Array<t.IPRestriction>> => {
754
- const array: Array<t.IPRestriction> = [];
755
- for await (const item of this.IPRestrictions._asyncList()) {
756
- array.push(item);
757
- }
758
- return array;
759
- },
760
- _pagedList: (arg: t.Paging): Promise<t.IPRestrictionList> =>
761
- this.rest
762
- .url(`/ip_restrictions`)
763
- .query(arg)
764
- .get()
765
- .json()
766
- .then(onFulfilled, onRejected),
767
- _asyncList: async function* () {
768
- const limit = '100';
769
- let nextPage = 'initial loop';
770
- let page: t.Paging = { limit: limit };
771
-
772
- while (nextPage) {
773
- const pagedList = await this._pagedList(page);
774
- nextPage = pagedList.next_page_uri;
775
- const items: t.IPRestriction[] = pagedList.ip_restrictions;
776
-
777
- if (nextPage) {
778
- page = {
779
- before_id: items[items.length - 1].id,
780
- limit: limit,
781
- };
782
- }
783
-
784
- for (const item of items) {
785
- yield item;
786
- }
787
- }
788
- },
789
- /** Update attributes of an IP restriction by ID */
790
- update: (arg: t.IPRestrictionUpdate): Promise<t.IPRestriction> =>
791
- this.rest
792
- .url(`/ip_restrictions/${arg.id}`)
793
- .patch(serializeMap(arg))
794
- .json()
795
- .then(onFulfilled, onRejected),
796
- };
797
-
798
- IPWhitelist = {
799
- /** Create a new IP whitelist entry that will restrict traffic to all tunnel endpoints on the account. */
800
- create: (arg: t.IPWhitelistEntryCreate): Promise<t.IPWhitelistEntry> =>
801
- this.rest
802
- .url(`/ip_whitelist`)
803
- .post(serializeMap(arg))
804
- .json()
805
- .then(onFulfilled, onRejected),
806
- /** Delete an IP whitelist entry. */
807
- delete: (arg: t.Item): Promise<t.Empty> =>
808
- this.rest
809
- .url(`/ip_whitelist/${arg.id}`)
810
- .delete()
811
- .json()
812
- .then(onFulfilled, onRejected),
813
- /** Get detailed information about an IP whitelist entry by ID. */
814
- get: (arg: t.Item): Promise<t.IPWhitelistEntry> =>
815
- this.rest
816
- .url(`/ip_whitelist/${arg.id}`)
817
- .get()
818
- .json()
819
- .then(onFulfilled, onRejected),
820
- /** List all IP whitelist entries on this account */
821
- list: async (): Promise<Array<t.IPWhitelistEntry>> => {
822
- const array: Array<t.IPWhitelistEntry> = [];
823
- for await (const item of this.IPWhitelist._asyncList()) {
824
- array.push(item);
825
- }
826
- return array;
827
- },
828
- _pagedList: (arg: t.Paging): Promise<t.IPWhitelistEntryList> =>
829
- this.rest
830
- .url(`/ip_whitelist`)
831
- .query(arg)
832
- .get()
833
- .json()
834
- .then(onFulfilled, onRejected),
835
- _asyncList: async function* () {
836
- const limit = '100';
837
- let nextPage = 'initial loop';
838
- let page: t.Paging = { limit: limit };
839
-
840
- while (nextPage) {
841
- const pagedList = await this._pagedList(page);
842
- nextPage = pagedList.next_page_uri;
843
- const items: t.IPWhitelistEntry[] = pagedList.whitelist;
844
-
845
- if (nextPage) {
846
- page = {
847
- before_id: items[items.length - 1].id,
848
- limit: limit,
849
- };
850
- }
851
-
852
- for (const item of items) {
853
- yield item;
854
- }
855
- }
856
- },
857
- /** Update attributes of an IP whitelist entry by ID */
858
- update: (arg: t.IPWhitelistEntryUpdate): Promise<t.IPWhitelistEntry> =>
859
- this.rest
860
- .url(`/ip_whitelist/${arg.id}`)
861
- .patch(serializeMap(arg))
862
- .json()
863
- .then(onFulfilled, onRejected),
864
- };
865
-
866
- EndpointLoggingModule = {
867
- replace: (arg: t.EndpointLoggingReplace): Promise<t.EndpointLogging> =>
868
- this.rest
869
- .url(`/endpoint_configurations/${arg.id}/logging`)
870
- .put(serializeMap(arg))
871
- .json()
872
- .then(onFulfilled, onRejected),
873
- get: (arg: t.Item): Promise<t.EndpointLogging> =>
874
- this.rest
875
- .url(`/endpoint_configurations/${arg.id}/logging`)
876
- .get()
877
- .json()
878
- .then(onFulfilled, onRejected),
879
- delete: (arg: t.Item): Promise<t.Empty> =>
880
- this.rest
881
- .url(`/endpoint_configurations/${arg.id}/logging`)
882
- .delete()
883
- .json()
884
- .then(onFulfilled, onRejected),
885
- };
886
-
887
- EndpointCircuitBreakerModule = {
888
- replace: (
889
- arg: t.EndpointCircuitBreakerReplace
890
- ): Promise<t.EndpointCircuitBreaker> =>
891
- this.rest
892
- .url(`/endpoint_configurations/${arg.id}/circuit_breaker`)
893
- .put(serializeMap(arg))
894
- .json()
895
- .then(onFulfilled, onRejected),
896
- get: (arg: t.Item): Promise<t.EndpointCircuitBreaker> =>
897
- this.rest
898
- .url(`/endpoint_configurations/${arg.id}/circuit_breaker`)
899
- .get()
900
- .json()
901
- .then(onFulfilled, onRejected),
902
- delete: (arg: t.Item): Promise<t.Empty> =>
903
- this.rest
904
- .url(`/endpoint_configurations/${arg.id}/circuit_breaker`)
905
- .delete()
906
- .json()
907
- .then(onFulfilled, onRejected),
908
- };
909
-
910
- EndpointCompressionModule = {
911
- replace: (
912
- arg: t.EndpointCompressionReplace
913
- ): Promise<t.EndpointCompression> =>
914
- this.rest
915
- .url(`/endpoint_configurations/${arg.id}/compression`)
916
- .put(serializeMap(arg))
917
- .json()
918
- .then(onFulfilled, onRejected),
919
- get: (arg: t.Item): Promise<t.EndpointCompression> =>
920
- this.rest
921
- .url(`/endpoint_configurations/${arg.id}/compression`)
922
- .get()
923
- .json()
924
- .then(onFulfilled, onRejected),
925
- delete: (arg: t.Item): Promise<t.Empty> =>
926
- this.rest
927
- .url(`/endpoint_configurations/${arg.id}/compression`)
928
- .delete()
929
- .json()
930
- .then(onFulfilled, onRejected),
931
- };
932
-
933
- EndpointTLSTerminationModule = {
934
- replace: (
935
- arg: t.EndpointTLSTerminationReplace
936
- ): Promise<t.EndpointTLSTermination> =>
937
- this.rest
938
- .url(`/endpoint_configurations/${arg.id}/tls_termination`)
939
- .put(serializeMap(arg))
940
- .json()
941
- .then(onFulfilled, onRejected),
942
- get: (arg: t.Item): Promise<t.EndpointTLSTermination> =>
943
- this.rest
944
- .url(`/endpoint_configurations/${arg.id}/tls_termination`)
945
- .get()
946
- .json()
947
- .then(onFulfilled, onRejected),
948
- delete: (arg: t.Item): Promise<t.Empty> =>
949
- this.rest
950
- .url(`/endpoint_configurations/${arg.id}/tls_termination`)
951
- .delete()
952
- .json()
953
- .then(onFulfilled, onRejected),
954
- };
955
-
956
- EndpointIPPolicyModule = {
957
- replace: (arg: t.EndpointIPPolicyReplace): Promise<t.EndpointIPPolicy> =>
958
- this.rest
959
- .url(`/endpoint_configurations/${arg.id}/ip_policy`)
960
- .put(serializeMap(arg))
961
- .json()
962
- .then(onFulfilled, onRejected),
963
- get: (arg: t.Item): Promise<t.EndpointIPPolicy> =>
964
- this.rest
965
- .url(`/endpoint_configurations/${arg.id}/ip_policy`)
966
- .get()
967
- .json()
968
- .then(onFulfilled, onRejected),
969
- delete: (arg: t.Item): Promise<t.Empty> =>
970
- this.rest
971
- .url(`/endpoint_configurations/${arg.id}/ip_policy`)
972
- .delete()
973
- .json()
974
- .then(onFulfilled, onRejected),
975
- };
976
-
977
- EndpointMutualTLSModule = {
978
- replace: (arg: t.EndpointMutualTLSReplace): Promise<t.EndpointMutualTLS> =>
979
- this.rest
980
- .url(`/endpoint_configurations/${arg.id}/mutual_tls`)
981
- .put(serializeMap(arg))
982
- .json()
983
- .then(onFulfilled, onRejected),
984
- get: (arg: t.Item): Promise<t.EndpointMutualTLS> =>
985
- this.rest
986
- .url(`/endpoint_configurations/${arg.id}/mutual_tls`)
987
- .get()
988
- .json()
989
- .then(onFulfilled, onRejected),
990
- delete: (arg: t.Item): Promise<t.Empty> =>
991
- this.rest
992
- .url(`/endpoint_configurations/${arg.id}/mutual_tls`)
993
- .delete()
994
- .json()
995
- .then(onFulfilled, onRejected),
996
- };
997
-
998
- EndpointRequestHeadersModule = {
999
- replace: (
1000
- arg: t.EndpointRequestHeadersReplace
1001
- ): Promise<t.EndpointRequestHeaders> =>
1002
- this.rest
1003
- .url(`/endpoint_configurations/${arg.id}/request_headers`)
1004
- .put(serializeMap(arg))
1005
- .json()
1006
- .then(onFulfilled, onRejected),
1007
- get: (arg: t.Item): Promise<t.EndpointRequestHeaders> =>
1008
- this.rest
1009
- .url(`/endpoint_configurations/${arg.id}/request_headers`)
1010
- .get()
1011
- .json()
1012
- .then(onFulfilled, onRejected),
1013
- delete: (arg: t.Item): Promise<t.Empty> =>
1014
- this.rest
1015
- .url(`/endpoint_configurations/${arg.id}/request_headers`)
1016
- .delete()
1017
- .json()
1018
- .then(onFulfilled, onRejected),
1019
- };
1020
-
1021
- EndpointResponseHeadersModule = {
1022
- replace: (
1023
- arg: t.EndpointResponseHeadersReplace
1024
- ): Promise<t.EndpointResponseHeaders> =>
1025
- this.rest
1026
- .url(`/endpoint_configurations/${arg.id}/response_headers`)
1027
- .put(serializeMap(arg))
1028
- .json()
1029
- .then(onFulfilled, onRejected),
1030
- get: (arg: t.Item): Promise<t.EndpointResponseHeaders> =>
1031
- this.rest
1032
- .url(`/endpoint_configurations/${arg.id}/response_headers`)
1033
- .get()
1034
- .json()
1035
- .then(onFulfilled, onRejected),
1036
- delete: (arg: t.Item): Promise<t.Empty> =>
1037
- this.rest
1038
- .url(`/endpoint_configurations/${arg.id}/response_headers`)
1039
- .delete()
1040
- .json()
1041
- .then(onFulfilled, onRejected),
1042
- };
1043
-
1044
- EndpointOAuthModule = {
1045
- replace: (arg: t.EndpointOAuthReplace): Promise<t.EndpointOAuth> =>
1046
- this.rest
1047
- .url(`/endpoint_configurations/${arg.id}/oauth`)
1048
- .put(serializeMap(arg))
1049
- .json()
1050
- .then(onFulfilled, onRejected),
1051
- get: (arg: t.Item): Promise<t.EndpointOAuth> =>
1052
- this.rest
1053
- .url(`/endpoint_configurations/${arg.id}/oauth`)
1054
- .get()
1055
- .json()
1056
- .then(onFulfilled, onRejected),
1057
- delete: (arg: t.Item): Promise<t.Empty> =>
1058
- this.rest
1059
- .url(`/endpoint_configurations/${arg.id}/oauth`)
1060
- .delete()
1061
- .json()
1062
- .then(onFulfilled, onRejected),
1063
- };
1064
-
1065
- EndpointWebhookValidationModule = {
1066
- replace: (
1067
- arg: t.EndpointWebhookValidationReplace
1068
- ): Promise<t.EndpointWebhookValidation> =>
1069
- this.rest
1070
- .url(`/endpoint_configurations/${arg.id}/webhook_validation`)
1071
- .put(serializeMap(arg))
1072
- .json()
1073
- .then(onFulfilled, onRejected),
1074
- get: (arg: t.Item): Promise<t.EndpointWebhookValidation> =>
1075
- this.rest
1076
- .url(`/endpoint_configurations/${arg.id}/webhook_validation`)
1077
- .get()
1078
- .json()
1079
- .then(onFulfilled, onRejected),
1080
- delete: (arg: t.Item): Promise<t.Empty> =>
1081
- this.rest
1082
- .url(`/endpoint_configurations/${arg.id}/webhook_validation`)
1083
- .delete()
1084
- .json()
1085
- .then(onFulfilled, onRejected),
1086
- };
1087
-
1088
- EndpointSAMLModule = {
1089
- replace: (arg: t.EndpointSAMLReplace): Promise<t.EndpointSAML> =>
1090
- this.rest
1091
- .url(`/endpoint_configurations/${arg.id}/saml`)
1092
- .put(serializeMap(arg))
1093
- .json()
1094
- .then(onFulfilled, onRejected),
1095
- get: (arg: t.Item): Promise<t.EndpointSAML> =>
1096
- this.rest
1097
- .url(`/endpoint_configurations/${arg.id}/saml`)
1098
- .get()
1099
- .json()
1100
- .then(onFulfilled, onRejected),
1101
- delete: (arg: t.Item): Promise<t.Empty> =>
1102
- this.rest
1103
- .url(`/endpoint_configurations/${arg.id}/saml`)
1104
- .delete()
1105
- .json()
1106
- .then(onFulfilled, onRejected),
1107
- };
1108
-
1109
- EndpointOIDCModule = {
1110
- replace: (arg: t.EndpointOIDCReplace): Promise<t.EndpointOIDC> =>
1111
- this.rest
1112
- .url(`/endpoint_configurations/${arg.id}/oidc`)
1113
- .put(serializeMap(arg))
1114
- .json()
1115
- .then(onFulfilled, onRejected),
1116
- get: (arg: t.Item): Promise<t.EndpointOIDC> =>
1117
- this.rest
1118
- .url(`/endpoint_configurations/${arg.id}/oidc`)
1119
- .get()
1120
- .json()
1121
- .then(onFulfilled, onRejected),
1122
- delete: (arg: t.Item): Promise<t.Empty> =>
1123
- this.rest
1124
- .url(`/endpoint_configurations/${arg.id}/oidc`)
1125
- .delete()
1126
- .json()
1127
- .then(onFulfilled, onRejected),
1128
- };
1129
-
1130
- ReservedAddrs = {
1131
- /** Create a new reserved address. */
1132
- create: (arg: t.ReservedAddrCreate): Promise<t.ReservedAddr> =>
1133
- this.rest
1134
- .url(`/reserved_addrs`)
1135
- .post(serializeMap(arg))
1136
- .json()
1137
- .then(onFulfilled, onRejected),
1138
- /** Delete a reserved address. */
1139
- delete: (arg: t.Item): Promise<t.Empty> =>
1140
- this.rest
1141
- .url(`/reserved_addrs/${arg.id}`)
1142
- .delete()
1143
- .json()
1144
- .then(onFulfilled, onRejected),
1145
- /** Get the details of a reserved address. */
1146
- get: (arg: t.Item): Promise<t.ReservedAddr> =>
1147
- this.rest
1148
- .url(`/reserved_addrs/${arg.id}`)
1149
- .get()
1150
- .json()
1151
- .then(onFulfilled, onRejected),
1152
- /** List all reserved addresses on this account. */
1153
- list: async (): Promise<Array<t.ReservedAddr>> => {
1154
- const array: Array<t.ReservedAddr> = [];
1155
- for await (const item of this.ReservedAddrs._asyncList()) {
1156
- array.push(item);
1157
- }
1158
- return array;
1159
- },
1160
- _pagedList: (arg: t.Paging): Promise<t.ReservedAddrList> =>
1161
- this.rest
1162
- .url(`/reserved_addrs`)
1163
- .query(arg)
1164
- .get()
1165
- .json()
1166
- .then(onFulfilled, onRejected),
1167
- _asyncList: async function* () {
1168
- const limit = '100';
1169
- let nextPage = 'initial loop';
1170
- let page: t.Paging = { limit: limit };
1171
-
1172
- while (nextPage) {
1173
- const pagedList = await this._pagedList(page);
1174
- nextPage = pagedList.next_page_uri;
1175
- const items: t.ReservedAddr[] = pagedList.reserved_addrs;
1176
-
1177
- if (nextPage) {
1178
- page = {
1179
- before_id: items[items.length - 1].id,
1180
- limit: limit,
1181
- };
1182
- }
1183
-
1184
- for (const item of items) {
1185
- yield item;
1186
- }
1187
- }
1188
- },
1189
- /** Update the attributes of a reserved address. */
1190
- update: (arg: t.ReservedAddrUpdate): Promise<t.ReservedAddr> =>
1191
- this.rest
1192
- .url(`/reserved_addrs/${arg.id}`)
1193
- .patch(serializeMap(arg))
1194
- .json()
1195
- .then(onFulfilled, onRejected),
1196
- /** Detach the endpoint configuration attached to a reserved address. */
1197
- deleteEndpointConfig: (arg: t.Item): Promise<t.Empty> =>
1198
- this.rest
1199
- .url(`/reserved_addrs/${arg.id}/endpoint_configuration`)
1200
- .delete()
1201
- .json()
1202
- .then(onFulfilled, onRejected),
1203
- };
1204
-
1205
- ReservedDomains = {
1206
- /** Create a new reserved domain. */
1207
- create: (arg: t.ReservedDomainCreate): Promise<t.ReservedDomain> =>
1208
- this.rest
1209
- .url(`/reserved_domains`)
1210
- .post(serializeMap(arg))
1211
- .json()
1212
- .then(onFulfilled, onRejected),
1213
- /** Delete a reserved domain. */
1214
- delete: (arg: t.Item): Promise<t.Empty> =>
1215
- this.rest
1216
- .url(`/reserved_domains/${arg.id}`)
1217
- .delete()
1218
- .json()
1219
- .then(onFulfilled, onRejected),
1220
- /** Get the details of a reserved domain. */
1221
- get: (arg: t.Item): Promise<t.ReservedDomain> =>
1222
- this.rest
1223
- .url(`/reserved_domains/${arg.id}`)
1224
- .get()
1225
- .json()
1226
- .then(onFulfilled, onRejected),
1227
- /** List all reserved domains on this account. */
1228
- list: async (): Promise<Array<t.ReservedDomain>> => {
1229
- const array: Array<t.ReservedDomain> = [];
1230
- for await (const item of this.ReservedDomains._asyncList()) {
1231
- array.push(item);
1232
- }
1233
- return array;
1234
- },
1235
- _pagedList: (arg: t.Paging): Promise<t.ReservedDomainList> =>
1236
- this.rest
1237
- .url(`/reserved_domains`)
1238
- .query(arg)
1239
- .get()
1240
- .json()
1241
- .then(onFulfilled, onRejected),
1242
- _asyncList: async function* () {
1243
- const limit = '100';
1244
- let nextPage = 'initial loop';
1245
- let page: t.Paging = { limit: limit };
1246
-
1247
- while (nextPage) {
1248
- const pagedList = await this._pagedList(page);
1249
- nextPage = pagedList.next_page_uri;
1250
- const items: t.ReservedDomain[] = pagedList.reserved_domains;
1251
-
1252
- if (nextPage) {
1253
- page = {
1254
- before_id: items[items.length - 1].id,
1255
- limit: limit,
1256
- };
1257
- }
1258
-
1259
- for (const item of items) {
1260
- yield item;
1261
- }
1262
- }
1263
- },
1264
- /** Update the attributes of a reserved domain. */
1265
- update: (arg: t.ReservedDomainUpdate): Promise<t.ReservedDomain> =>
1266
- this.rest
1267
- .url(`/reserved_domains/${arg.id}`)
1268
- .patch(serializeMap(arg))
1269
- .json()
1270
- .then(onFulfilled, onRejected),
1271
- /** Detach the certificate management policy attached to a reserved domain. */
1272
- deleteCertificateManagementPolicy: (arg: t.Item): Promise<t.Empty> =>
1273
- this.rest
1274
- .url(`/reserved_domains/${arg.id}/certificate_management_policy`)
1275
- .delete()
1276
- .json()
1277
- .then(onFulfilled, onRejected),
1278
- /** Detach the certificate attached to a reserved domain. */
1279
- deleteCertificate: (arg: t.Item): Promise<t.Empty> =>
1280
- this.rest
1281
- .url(`/reserved_domains/${arg.id}/certificate`)
1282
- .delete()
1283
- .json()
1284
- .then(onFulfilled, onRejected),
1285
- /** Detach the http endpoint configuration attached to a reserved domain. */
1286
- deleteHTTPEndpointConfig: (arg: t.Item): Promise<t.Empty> =>
1287
- this.rest
1288
- .url(`/reserved_domains/${arg.id}/http_endpoint_configuration`)
1289
- .delete()
1290
- .json()
1291
- .then(onFulfilled, onRejected),
1292
- /** Detach the https endpoint configuration attached to a reserved domain. */
1293
- deleteHTTPSEndpointConfig: (arg: t.Item): Promise<t.Empty> =>
1294
- this.rest
1295
- .url(`/reserved_domains/${arg.id}/https_endpoint_configuration`)
1296
- .delete()
1297
- .json()
1298
- .then(onFulfilled, onRejected),
1299
- };
1300
-
1301
- SSHCertificateAuthorities = {
1302
- /** Create a new SSH Certificate Authority */
1303
- create: (
1304
- arg: t.SSHCertificateAuthorityCreate
1305
- ): Promise<t.SSHCertificateAuthority> =>
1306
- this.rest
1307
- .url(`/ssh_certificate_authorities`)
1308
- .post(serializeMap(arg))
1309
- .json()
1310
- .then(onFulfilled, onRejected),
1311
- /** Delete an SSH Certificate Authority */
1312
- delete: (arg: t.Item): Promise<t.Empty> =>
1313
- this.rest
1314
- .url(`/ssh_certificate_authorities/${arg.id}`)
1315
- .delete()
1316
- .json()
1317
- .then(onFulfilled, onRejected),
1318
- /** Get detailed information about an SSH Certficate Authority */
1319
- get: (arg: t.Item): Promise<t.SSHCertificateAuthority> =>
1320
- this.rest
1321
- .url(`/ssh_certificate_authorities/${arg.id}`)
1322
- .get()
1323
- .json()
1324
- .then(onFulfilled, onRejected),
1325
- /** List all SSH Certificate Authorities on this account */
1326
- list: async (): Promise<Array<t.SSHCertificateAuthority>> => {
1327
- const array: Array<t.SSHCertificateAuthority> = [];
1328
- for await (const item of this.SSHCertificateAuthorities._asyncList()) {
1329
- array.push(item);
1330
- }
1331
- return array;
1332
- },
1333
- _pagedList: (arg: t.Paging): Promise<t.SSHCertificateAuthorityList> =>
1334
- this.rest
1335
- .url(`/ssh_certificate_authorities`)
1336
- .query(arg)
1337
- .get()
1338
- .json()
1339
- .then(onFulfilled, onRejected),
1340
- _asyncList: async function* () {
1341
- const limit = '100';
1342
- let nextPage = 'initial loop';
1343
- let page: t.Paging = { limit: limit };
1344
-
1345
- while (nextPage) {
1346
- const pagedList = await this._pagedList(page);
1347
- nextPage = pagedList.next_page_uri;
1348
- const items: t.SSHCertificateAuthority[] =
1349
- pagedList.ssh_certificate_authorities;
1350
-
1351
- if (nextPage) {
1352
- page = {
1353
- before_id: items[items.length - 1].id,
1354
- limit: limit,
1355
- };
1356
- }
1357
-
1358
- for (const item of items) {
1359
- yield item;
1360
- }
1361
- }
1362
- },
1363
- /** Update an SSH Certificate Authority */
1364
- update: (
1365
- arg: t.SSHCertificateAuthorityUpdate
1366
- ): Promise<t.SSHCertificateAuthority> =>
1367
- this.rest
1368
- .url(`/ssh_certificate_authorities/${arg.id}`)
1369
- .patch(serializeMap(arg))
1370
- .json()
1371
- .then(onFulfilled, onRejected),
1372
- };
1373
-
1374
- SSHCredentials = {
1375
- /** Create a new ssh_credential from an uploaded public SSH key. This ssh credential can be used to start new tunnels via ngrok's SSH gateway. */
1376
- create: (arg: t.SSHCredentialCreate): Promise<t.SSHCredential> =>
1377
- this.rest
1378
- .url(`/ssh_credentials`)
1379
- .post(serializeMap(arg))
1380
- .json()
1381
- .then(onFulfilled, onRejected),
1382
- /** Delete an ssh_credential by ID */
1383
- delete: (arg: t.Item): Promise<t.Empty> =>
1384
- this.rest
1385
- .url(`/ssh_credentials/${arg.id}`)
1386
- .delete()
1387
- .json()
1388
- .then(onFulfilled, onRejected),
1389
- /** Get detailed information about an ssh_credential */
1390
- get: (arg: t.Item): Promise<t.SSHCredential> =>
1391
- this.rest
1392
- .url(`/ssh_credentials/${arg.id}`)
1393
- .get()
1394
- .json()
1395
- .then(onFulfilled, onRejected),
1396
- /** List all ssh credentials on this account */
1397
- list: async (): Promise<Array<t.SSHCredential>> => {
1398
- const array: Array<t.SSHCredential> = [];
1399
- for await (const item of this.SSHCredentials._asyncList()) {
1400
- array.push(item);
1401
- }
1402
- return array;
1403
- },
1404
- _pagedList: (arg: t.Paging): Promise<t.SSHCredentialList> =>
1405
- this.rest
1406
- .url(`/ssh_credentials`)
1407
- .query(arg)
1408
- .get()
1409
- .json()
1410
- .then(onFulfilled, onRejected),
1411
- _asyncList: async function* () {
1412
- const limit = '100';
1413
- let nextPage = 'initial loop';
1414
- let page: t.Paging = { limit: limit };
1415
-
1416
- while (nextPage) {
1417
- const pagedList = await this._pagedList(page);
1418
- nextPage = pagedList.next_page_uri;
1419
- const items: t.SSHCredential[] = pagedList.ssh_credentials;
1420
-
1421
- if (nextPage) {
1422
- page = {
1423
- before_id: items[items.length - 1].id,
1424
- limit: limit,
1425
- };
1426
- }
1427
-
1428
- for (const item of items) {
1429
- yield item;
1430
- }
1431
- }
1432
- },
1433
- /** Update attributes of an ssh_credential by ID */
1434
- update: (arg: t.SSHCredentialUpdate): Promise<t.SSHCredential> =>
1435
- this.rest
1436
- .url(`/ssh_credentials/${arg.id}`)
1437
- .patch(serializeMap(arg))
1438
- .json()
1439
- .then(onFulfilled, onRejected),
1440
- };
1441
-
1442
- SSHHostCertificates = {
1443
- /** Create a new SSH Host Certificate */
1444
- create: (arg: t.SSHHostCertificateCreate): Promise<t.SSHHostCertificate> =>
1445
- this.rest
1446
- .url(`/ssh_host_certificates`)
1447
- .post(serializeMap(arg))
1448
- .json()
1449
- .then(onFulfilled, onRejected),
1450
- /** Delete an SSH Host Certificate */
1451
- delete: (arg: t.Item): Promise<t.Empty> =>
1452
- this.rest
1453
- .url(`/ssh_host_certificates/${arg.id}`)
1454
- .delete()
1455
- .json()
1456
- .then(onFulfilled, onRejected),
1457
- /** Get detailed information about an SSH Host Certficate */
1458
- get: (arg: t.Item): Promise<t.SSHHostCertificate> =>
1459
- this.rest
1460
- .url(`/ssh_host_certificates/${arg.id}`)
1461
- .get()
1462
- .json()
1463
- .then(onFulfilled, onRejected),
1464
- /** List all SSH Host Certificates issued on this account */
1465
- list: async (): Promise<Array<t.SSHHostCertificate>> => {
1466
- const array: Array<t.SSHHostCertificate> = [];
1467
- for await (const item of this.SSHHostCertificates._asyncList()) {
1468
- array.push(item);
1469
- }
1470
- return array;
1471
- },
1472
- _pagedList: (arg: t.Paging): Promise<t.SSHHostCertificateList> =>
1473
- this.rest
1474
- .url(`/ssh_host_certificates`)
1475
- .query(arg)
1476
- .get()
1477
- .json()
1478
- .then(onFulfilled, onRejected),
1479
- _asyncList: async function* () {
1480
- const limit = '100';
1481
- let nextPage = 'initial loop';
1482
- let page: t.Paging = { limit: limit };
1483
-
1484
- while (nextPage) {
1485
- const pagedList = await this._pagedList(page);
1486
- nextPage = pagedList.next_page_uri;
1487
- const items: t.SSHHostCertificate[] = pagedList.ssh_host_certificates;
1488
-
1489
- if (nextPage) {
1490
- page = {
1491
- before_id: items[items.length - 1].id,
1492
- limit: limit,
1493
- };
1494
- }
1495
-
1496
- for (const item of items) {
1497
- yield item;
1498
- }
1499
- }
1500
- },
1501
- /** Update an SSH Host Certificate */
1502
- update: (arg: t.SSHHostCertificateUpdate): Promise<t.SSHHostCertificate> =>
1503
- this.rest
1504
- .url(`/ssh_host_certificates/${arg.id}`)
1505
- .patch(serializeMap(arg))
1506
- .json()
1507
- .then(onFulfilled, onRejected),
1508
- };
1509
-
1510
- SSHUserCertificates = {
1511
- /** Create a new SSH User Certificate */
1512
- create: (arg: t.SSHUserCertificateCreate): Promise<t.SSHUserCertificate> =>
1513
- this.rest
1514
- .url(`/ssh_user_certificates`)
1515
- .post(serializeMap(arg))
1516
- .json()
1517
- .then(onFulfilled, onRejected),
1518
- /** Delete an SSH User Certificate */
1519
- delete: (arg: t.Item): Promise<t.Empty> =>
1520
- this.rest
1521
- .url(`/ssh_user_certificates/${arg.id}`)
1522
- .delete()
1523
- .json()
1524
- .then(onFulfilled, onRejected),
1525
- /** Get detailed information about an SSH User Certficate */
1526
- get: (arg: t.Item): Promise<t.SSHUserCertificate> =>
1527
- this.rest
1528
- .url(`/ssh_user_certificates/${arg.id}`)
1529
- .get()
1530
- .json()
1531
- .then(onFulfilled, onRejected),
1532
- /** List all SSH User Certificates issued on this account */
1533
- list: async (): Promise<Array<t.SSHUserCertificate>> => {
1534
- const array: Array<t.SSHUserCertificate> = [];
1535
- for await (const item of this.SSHUserCertificates._asyncList()) {
1536
- array.push(item);
1537
- }
1538
- return array;
1539
- },
1540
- _pagedList: (arg: t.Paging): Promise<t.SSHUserCertificateList> =>
1541
- this.rest
1542
- .url(`/ssh_user_certificates`)
1543
- .query(arg)
1544
- .get()
1545
- .json()
1546
- .then(onFulfilled, onRejected),
1547
- _asyncList: async function* () {
1548
- const limit = '100';
1549
- let nextPage = 'initial loop';
1550
- let page: t.Paging = { limit: limit };
1551
-
1552
- while (nextPage) {
1553
- const pagedList = await this._pagedList(page);
1554
- nextPage = pagedList.next_page_uri;
1555
- const items: t.SSHUserCertificate[] = pagedList.ssh_user_certificates;
1556
-
1557
- if (nextPage) {
1558
- page = {
1559
- before_id: items[items.length - 1].id,
1560
- limit: limit,
1561
- };
1562
- }
1563
-
1564
- for (const item of items) {
1565
- yield item;
1566
- }
1567
- }
1568
- },
1569
- /** Update an SSH User Certificate */
1570
- update: (arg: t.SSHUserCertificateUpdate): Promise<t.SSHUserCertificate> =>
1571
- this.rest
1572
- .url(`/ssh_user_certificates/${arg.id}`)
1573
- .patch(serializeMap(arg))
1574
- .json()
1575
- .then(onFulfilled, onRejected),
1576
- };
1577
-
1578
- TLSCertificates = {
1579
- /** Upload a new TLS certificate */
1580
- create: (arg: t.TLSCertificateCreate): Promise<t.TLSCertificate> =>
1581
- this.rest
1582
- .url(`/tls_certificates`)
1583
- .post(serializeMap(arg))
1584
- .json()
1585
- .then(onFulfilled, onRejected),
1586
- /** Delete a TLS certificate */
1587
- delete: (arg: t.Item): Promise<t.Empty> =>
1588
- this.rest
1589
- .url(`/tls_certificates/${arg.id}`)
1590
- .delete()
1591
- .json()
1592
- .then(onFulfilled, onRejected),
1593
- /** Get detailed information about a TLS certificate */
1594
- get: (arg: t.Item): Promise<t.TLSCertificate> =>
1595
- this.rest
1596
- .url(`/tls_certificates/${arg.id}`)
1597
- .get()
1598
- .json()
1599
- .then(onFulfilled, onRejected),
1600
- /** List all TLS certificates on this account */
1601
- list: async (): Promise<Array<t.TLSCertificate>> => {
1602
- const array: Array<t.TLSCertificate> = [];
1603
- for await (const item of this.TLSCertificates._asyncList()) {
1604
- array.push(item);
1605
- }
1606
- return array;
1607
- },
1608
- _pagedList: (arg: t.Paging): Promise<t.TLSCertificateList> =>
1609
- this.rest
1610
- .url(`/tls_certificates`)
1611
- .query(arg)
1612
- .get()
1613
- .json()
1614
- .then(onFulfilled, onRejected),
1615
- _asyncList: async function* () {
1616
- const limit = '100';
1617
- let nextPage = 'initial loop';
1618
- let page: t.Paging = { limit: limit };
1619
-
1620
- while (nextPage) {
1621
- const pagedList = await this._pagedList(page);
1622
- nextPage = pagedList.next_page_uri;
1623
- const items: t.TLSCertificate[] = pagedList.tls_certificates;
1624
-
1625
- if (nextPage) {
1626
- page = {
1627
- before_id: items[items.length - 1].id,
1628
- limit: limit,
1629
- };
1630
- }
1631
-
1632
- for (const item of items) {
1633
- yield item;
1634
- }
1635
- }
1636
- },
1637
- /** Update attributes of a TLS Certificate by ID */
1638
- update: (arg: t.TLSCertificateUpdate): Promise<t.TLSCertificate> =>
1639
- this.rest
1640
- .url(`/tls_certificates/${arg.id}`)
1641
- .patch(serializeMap(arg))
1642
- .json()
1643
- .then(onFulfilled, onRejected),
1644
- };
1645
-
1646
- TunnelSessions = {
1647
- /** List all online tunnel sessions running on this account. */
1648
- list: async (): Promise<Array<t.TunnelSession>> => {
1649
- const array: Array<t.TunnelSession> = [];
1650
- for await (const item of this.TunnelSessions._asyncList()) {
1651
- array.push(item);
1652
- }
1653
- return array;
1654
- },
1655
- _pagedList: (arg: t.Paging): Promise<t.TunnelSessionList> =>
1656
- this.rest
1657
- .url(`/tunnel_sessions`)
1658
- .query(arg)
1659
- .get()
1660
- .json()
1661
- .then(onFulfilled, onRejected),
1662
- _asyncList: async function* () {
1663
- const limit = '100';
1664
- let nextPage = 'initial loop';
1665
- let page: t.Paging = { limit: limit };
1666
-
1667
- while (nextPage) {
1668
- const pagedList = await this._pagedList(page);
1669
- nextPage = pagedList.next_page_uri;
1670
- const items: t.TunnelSession[] = pagedList.tunnel_sessions;
1671
-
1672
- if (nextPage) {
1673
- page = {
1674
- before_id: items[items.length - 1].id,
1675
- limit: limit,
1676
- };
1677
- }
1678
-
1679
- for (const item of items) {
1680
- yield item;
1681
- }
1682
- }
1683
- },
1684
- /** Get the detailed status of a tunnel session by ID */
1685
- get: (arg: t.Item): Promise<t.TunnelSession> =>
1686
- this.rest
1687
- .url(`/tunnel_sessions/${arg.id}`)
1688
- .get()
1689
- .json()
1690
- .then(onFulfilled, onRejected),
1691
- /** Issues a command instructing the ngrok agent to restart. The agent restarts itself by calling exec() on platforms that support it. This operation is notably not supported on Windows. When an agent restarts, it reconnects with a new tunnel session ID. */
1692
- restart: (arg: t.Item): Promise<t.Empty> =>
1693
- this.rest
1694
- .url(`/tunnel_sessions/${arg.id}/restart`)
1695
- .post(serializeMap(arg))
1696
- .json()
1697
- .then(onFulfilled, onRejected),
1698
- /** Issues a command instructing the ngrok agent that started this tunnel session to exit. */
1699
- stop: (arg: t.Item): Promise<t.Empty> =>
1700
- this.rest
1701
- .url(`/tunnel_sessions/${arg.id}/stop`)
1702
- .post(serializeMap(arg))
1703
- .json()
1704
- .then(onFulfilled, onRejected),
1705
- /** Issues a command instructing the ngrok agent to update itself to the latest version. After this call completes successfully, the ngrok agent will be in the update process. A caller should wait some amount of time to allow the update to complete (at least 10 seconds) before making a call to the Restart endpoint to request that the agent restart itself to start using the new code. This call will never update an ngrok agent to a new major version which could cause breaking compatibility issues. If you wish to update to a new major version, that must be done manually. Still, please be aware that updating your ngrok agent could break your integration. This call will fail in any of the following circumstances: there is no update available the ngrok agent's configuration disabled update checks the agent is currently in process of updating the agent has already successfully updated but has not yet been restarted */
1706
- update: (arg: t.TunnelSessionsUpdate): Promise<t.Empty> =>
1707
- this.rest
1708
- .url(`/tunnel_sessions/${arg.id}/update`)
1709
- .post(serializeMap(arg))
1710
- .json()
1711
- .then(onFulfilled, onRejected),
1712
- };
1713
-
1714
- Tunnels = {
1715
- /** List all online tunnels currently running on the account. */
1716
- list: async (): Promise<Array<t.Tunnel>> => {
1717
- const array: Array<t.Tunnel> = [];
1718
- for await (const item of this.Tunnels._asyncList()) {
1719
- array.push(item);
1720
- }
1721
- return array;
1722
- },
1723
- _pagedList: (arg: t.Paging): Promise<t.TunnelList> =>
1724
- this.rest
1725
- .url(`/tunnels`)
1726
- .query(arg)
1727
- .get()
1728
- .json()
1729
- .then(onFulfilled, onRejected),
1730
- _asyncList: async function* () {
1731
- const limit = '100';
1732
- let nextPage = 'initial loop';
1733
- let page: t.Paging = { limit: limit };
1734
-
1735
- while (nextPage) {
1736
- const pagedList = await this._pagedList(page);
1737
- nextPage = pagedList.next_page_uri;
1738
- const items: t.Tunnel[] = pagedList.tunnels;
1739
-
1740
- if (nextPage) {
1741
- page = {
1742
- before_id: items[items.length - 1].id,
1743
- limit: limit,
1744
- };
1745
- }
1746
-
1747
- for (const item of items) {
1748
- yield item;
1749
- }
1750
- }
1751
- },
1752
- };
1753
- }
1754
-
1755
- function onFulfilled(f) {
1756
- return f;
1757
- }
1758
-
1759
- function onRejected(e: Error): t.Error {
1760
- const errMsg = JSON.parse(e.message);
1761
- errMsg.details = new Map(Object.entries(errMsg.details));
1762
- throw errMsg;
1763
- }
1764
-
1765
- function replacer(key, value) {
1766
- if (value instanceof Map) {
1767
- return Object.fromEntries(value);
1768
- } else {
1769
- return value;
1770
- }
1771
- }
1772
-
1773
- function serializeMap(obj) {
1774
- return JSON.stringify(obj, replacer);
1775
- }
1
+ export * from './client';
2
+ export * from './datatypes';