cloudflare
Version:
The official TypeScript library for the Cloudflare API
132 lines • 5.34 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../../core/resource.mjs";
import * as ConfigurationsAPI from "./configurations.mjs";
import { BaseConfigurations, Configurations, } from "./configurations.mjs";
import * as ConnectionsAPI from "./connections.mjs";
import { BaseConnections, Connections, } from "./connections.mjs";
import * as ConnectorsAPI from "./connectors.mjs";
import { BaseConnectors, Connectors } from "./connectors.mjs";
import * as FailoverAPI from "./failover.mjs";
import { BaseFailover, Failover } from "./failover.mjs";
import * as TokenAPI from "./token.mjs";
import { BaseToken, Token } from "./token.mjs";
import { V4PagePaginationArray, } from "../../../../core/pagination.mjs";
import { path } from "../../../../internal/utils/path.mjs";
export var BaseWARPConnector = /* @__PURE__ */ (() => {
class BaseWARPConnector extends APIResource {
/**
* Creates a new Warp Connector Tunnel in an account.
*
* @example
* ```ts
* const warpConnector =
* await client.zeroTrust.tunnels.warpConnector.create({
* account_id: '699d98642c564d2e855e9661899b7252',
* name: 'blog',
* });
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post(path `/accounts/${account_id}/warp_connector`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Lists and filters Warp Connector Tunnels in an account.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const warpConnectorListResponse of client.zeroTrust.tunnels.warpConnector.list(
* { account_id: '699d98642c564d2e855e9661899b7252' },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { account_id, ...query } = params;
return this._client.getAPIList(path `/accounts/${account_id}/warp_connector`, (V4PagePaginationArray), { query, ...options });
}
/**
* Deletes a Warp Connector Tunnel from an account.
*
* @example
* ```ts
* const warpConnector =
* await client.zeroTrust.tunnels.warpConnector.delete(
* 'f70ff985-a4ef-4643-bbbc-4a0ed4fc8415',
* { account_id: '699d98642c564d2e855e9661899b7252' },
* );
* ```
*/
delete(tunnelID, params, options) {
const { account_id } = params;
return this._client.delete(path `/accounts/${account_id}/warp_connector/${tunnelID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Updates an existing Warp Connector Tunnel.
*
* @example
* ```ts
* const response =
* await client.zeroTrust.tunnels.warpConnector.edit(
* 'f70ff985-a4ef-4643-bbbc-4a0ed4fc8415',
* { account_id: '699d98642c564d2e855e9661899b7252' },
* );
* ```
*/
edit(tunnelID, params, options) {
const { account_id, ...body } = params;
return this._client.patch(path `/accounts/${account_id}/warp_connector/${tunnelID}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Fetches a single Warp Connector Tunnel.
*
* @example
* ```ts
* const warpConnector =
* await client.zeroTrust.tunnels.warpConnector.get(
* 'f70ff985-a4ef-4643-bbbc-4a0ed4fc8415',
* { account_id: '699d98642c564d2e855e9661899b7252' },
* );
* ```
*/
get(tunnelID, params, options) {
const { account_id } = params;
return this._client.get(path `/accounts/${account_id}/warp_connector/${tunnelID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseWARPConnector._key = Object.freeze([
'zeroTrust',
'tunnels',
'warpConnector',
]);
return BaseWARPConnector;
})();
export var WARPConnector = /* @__PURE__ */ (() => {
class WARPConnector extends BaseWARPConnector {
constructor() {
super(...arguments);
this.token = new TokenAPI.Token(this._client);
this.connections = new ConnectionsAPI.Connections(this._client);
this.connectors = new ConnectorsAPI.Connectors(this._client);
this.failover = new FailoverAPI.Failover(this._client);
this.configurations = new ConfigurationsAPI.Configurations(this._client);
}
}
WARPConnector.Token = Token;
WARPConnector.BaseToken = BaseToken;
WARPConnector.Connections = Connections;
WARPConnector.BaseConnections = BaseConnections;
WARPConnector.Connectors = Connectors;
WARPConnector.BaseConnectors = BaseConnectors;
WARPConnector.Failover = Failover;
WARPConnector.BaseFailover = BaseFailover;
WARPConnector.Configurations = Configurations;
WARPConnector.BaseConfigurations = BaseConfigurations;
return WARPConnector;
})();
//# sourceMappingURL=warp-connector.mjs.map