UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

71 lines 3.18 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from 'cloudflare/resource'; import * as TunnelsAPI from 'cloudflare/resources/zero-trust/tunnels/tunnels'; import * as ConfigurationsAPI from 'cloudflare/resources/zero-trust/tunnels/configurations'; import * as ConnectionsAPI from 'cloudflare/resources/zero-trust/tunnels/connections'; import * as ConnectorsAPI from 'cloudflare/resources/zero-trust/tunnels/connectors'; import * as ManagementAPI from 'cloudflare/resources/zero-trust/tunnels/management'; import * as TokenAPI from 'cloudflare/resources/zero-trust/tunnels/token'; import { V4PagePaginationArray } from 'cloudflare/pagination'; export class Tunnels extends APIResource { constructor() { super(...arguments); this.configurations = new ConfigurationsAPI.Configurations(this._client); this.connections = new ConnectionsAPI.Connections(this._client); this.token = new TokenAPI.Token(this._client); this.connectors = new ConnectorsAPI.Connectors(this._client); this.management = new ManagementAPI.Management(this._client); } /** * Creates a new Argo Tunnel in an account. */ create(params, options) { const { account_id, ...body } = params; return this._client.post(`/accounts/${account_id}/tunnels`, { body, ...options })._thenUnwrap((obj) => obj.result); } /** * Lists and filters all types of Tunnels in an account. */ list(params, options) { const { account_id, ...query } = params; return this._client.getAPIList(`/accounts/${account_id}/tunnels`, TunnelListResponsesV4PagePaginationArray, { query, ...options }); } /** * Deletes an Argo Tunnel from an account. */ delete(tunnelId, params, options) { const { account_id, body } = params; return this._client.delete(`/accounts/${account_id}/tunnels/${tunnelId}`, { body: body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Updates an existing Cloudflare Tunnel. */ edit(tunnelId, params, options) { const { account_id, ...body } = params; return this._client.patch(`/accounts/${account_id}/cfd_tunnel/${tunnelId}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Fetches a single Argo Tunnel. */ get(tunnelId, params, options) { const { account_id } = params; return this._client.get(`/accounts/${account_id}/tunnels/${tunnelId}`, options)._thenUnwrap((obj) => obj.result); } } export class TunnelListResponsesV4PagePaginationArray extends V4PagePaginationArray { } (function (Tunnels) { Tunnels.TunnelListResponsesV4PagePaginationArray = TunnelsAPI.TunnelListResponsesV4PagePaginationArray; Tunnels.Configurations = ConfigurationsAPI.Configurations; Tunnels.Connections = ConnectionsAPI.Connections; Tunnels.Token = TokenAPI.Token; Tunnels.Connectors = ConnectorsAPI.Connectors; Tunnels.Management = ManagementAPI.Management; })(Tunnels || (Tunnels = {})); //# sourceMappingURL=tunnels.mjs.map