cloudflare
Version:
The official TypeScript library for the Cloudflare API
125 lines • 4.47 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEXTests = exports.BaseDEXTests = 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 BaseDEXTests = /* @__PURE__ */ (() => {
class BaseDEXTests extends resource_1.APIResource {
/**
* Create a DEX test.
*
* @example
* ```ts
* const schemaHTTP =
* await client.zeroTrust.devices.dexTests.create({
* account_id: '01a7362d577a6c3019a474fd6f485823',
* data: {
* host: 'https://dash.cloudflare.com',
* kind: 'http',
* },
* enabled: true,
* interval: '30m',
* name: 'HTTP dash health check',
* });
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/dex/devices/dex_tests`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Update a DEX test.
*
* @example
* ```ts
* const schemaHTTP =
* await client.zeroTrust.devices.dexTests.update(
* 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415',
* {
* account_id: '01a7362d577a6c3019a474fd6f485823',
* data: {
* host: 'https://dash.cloudflare.com',
* kind: 'http',
* },
* enabled: true,
* interval: '30m',
* name: 'HTTP dash health check',
* },
* );
* ```
*/
update(dexTestID, params, options) {
const { account_id, ...body } = params;
return this._client.put((0, path_1.path) `/accounts/${account_id}/dex/devices/dex_tests/${dexTestID}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Fetch all DEX tests.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const schemaHTTP of client.zeroTrust.devices.dexTests.list(
* { account_id: '01a7362d577a6c3019a474fd6f485823' },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { account_id, ...query } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/dex/devices/dex_tests`, (pagination_1.V4PagePaginationArray), { query, ...options });
}
/**
* Delete a Device DEX test. Returns the remaining device dex tests for the
* account.
*
* @example
* ```ts
* const dexTest =
* await client.zeroTrust.devices.dexTests.delete(
* 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415',
* { account_id: '01a7362d577a6c3019a474fd6f485823' },
* );
* ```
*/
delete(dexTestID, params, options) {
const { account_id } = params;
return this._client.delete((0, path_1.path) `/accounts/${account_id}/dex/devices/dex_tests/${dexTestID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Fetch a single DEX test.
*
* @example
* ```ts
* const schemaHTTP =
* await client.zeroTrust.devices.dexTests.get(
* '372e67954025e0ba6aaa6d586b9e0b59',
* { account_id: '01a7362d577a6c3019a474fd6f485823' },
* );
* ```
*/
get(dexTestID, params, options) {
const { account_id } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/dex/devices/dex_tests/${dexTestID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseDEXTests._key = Object.freeze([
'zeroTrust',
'devices',
'dexTests',
]);
return BaseDEXTests;
})();
exports.BaseDEXTests = BaseDEXTests;
class DEXTests extends BaseDEXTests {
}
exports.DEXTests = DEXTests;
//# sourceMappingURL=dex-tests.js.map