cloudflare
Version:
The official TypeScript library for the Cloudflare API
59 lines • 2.58 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Connections = exports.BaseConnections = void 0;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../../../core/resource.js");
const pagination_1 = require("../../../../core/pagination.js");
const path_1 = require("../../../../internal/utils/path.js");
var BaseConnections = /* @__PURE__ */ (() => {
class BaseConnections extends resource_1.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((0, path_1.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((0, path_1.path) `/accounts/${account_id}/cfd_tunnel/${tunnelID}/connections`, (pagination_1.SinglePage), options);
}
}
BaseConnections._key = Object.freeze(['zeroTrust', 'tunnels', 'cloudflared', 'connections']);
return BaseConnections;
})();
exports.BaseConnections = BaseConnections;
class Connections extends BaseConnections {
}
exports.Connections = Connections;
//# sourceMappingURL=connections.js.map