cloudflare
Version:
The official TypeScript library for the Cloudflare API
54 lines • 2.33 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../../core/resource.mjs";
import { SinglePage } from "../../../../core/pagination.mjs";
import { path } from "../../../../internal/utils/path.mjs";
export var BaseConnections = /* @__PURE__ */ (() => {
class BaseConnections extends APIResource {
/**
* Removes a connection (aka Cloudflare Tunnel Connector) from a Cloudflare Tunnel
* independently of its current state. If no connector id (client_id) is provided
* all connectors will be removed. We recommend running this command after rotating
* tokens.
*
* @example
* ```ts
* const connection =
* await client.zeroTrust.tunnels.cloudflared.connections.delete(
* 'f70ff985-a4ef-4643-bbbc-4a0ed4fc8415',
* { account_id: '699d98642c564d2e855e9661899b7252' },
* );
* ```
*/
delete(tunnelID, params, options) {
const { account_id, client_id } = params;
return this._client.delete(path `/accounts/${account_id}/cfd_tunnel/${tunnelID}/connections`, {
query: { client_id },
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Lists the connections for a Cloudflare Tunnel, including connector IDs,
* cloudflared versions, and Cloudflare locations.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const client of client.zeroTrust.tunnels.cloudflared.connections.get(
* 'f70ff985-a4ef-4643-bbbc-4a0ed4fc8415',
* { account_id: '699d98642c564d2e855e9661899b7252' },
* )) {
* // ...
* }
* ```
*/
get(tunnelID, params, options) {
const { account_id } = params;
return this._client.getAPIList(path `/accounts/${account_id}/cfd_tunnel/${tunnelID}/connections`, (SinglePage), options);
}
}
BaseConnections._key = Object.freeze(['zeroTrust', 'tunnels', 'cloudflared', 'connections']);
return BaseConnections;
})();
export class Connections extends BaseConnections {
}
//# sourceMappingURL=connections.mjs.map