cloudflare
Version:
The official TypeScript library for the Cloudflare API
112 lines • 4.19 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Configs = exports.BaseConfigs = void 0;
const tslib_1 = require("../../../internal/tslib.js");
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../../core/resource.js");
const FullAPI = tslib_1.__importStar(require("./full.js"));
const full_1 = require("./full.js");
const path_1 = require("../../../internal/utils/path.js");
var BaseConfigs = /* @__PURE__ */ (() => {
class BaseConfigs extends resource_1.APIResource {
/**
* Create a new network monitoring configuration.
*
* @example
* ```ts
* const configuration =
* await client.magicNetworkMonitoring.configs.create({
* account_id: '6f91088a406011ed95aed352566e8d4c',
* default_sampling: 1,
* name: "cloudflare user's account",
* });
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/mnm/config`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Update an existing network monitoring configuration, requires the entire
* configuration to be updated at once.
*
* @example
* ```ts
* const configuration =
* await client.magicNetworkMonitoring.configs.update({
* account_id: '6f91088a406011ed95aed352566e8d4c',
* default_sampling: 1,
* name: "cloudflare user's account",
* });
* ```
*/
update(params, options) {
const { account_id, ...body } = params;
return this._client.put((0, path_1.path) `/accounts/${account_id}/mnm/config`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Delete an existing network monitoring configuration.
*
* @example
* ```ts
* const configuration =
* await client.magicNetworkMonitoring.configs.delete({
* account_id: '6f91088a406011ed95aed352566e8d4c',
* });
* ```
*/
delete(params, options) {
const { account_id } = params;
return this._client.delete((0, path_1.path) `/accounts/${account_id}/mnm/config`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Update fields in an existing network monitoring configuration.
*
* @example
* ```ts
* const configuration =
* await client.magicNetworkMonitoring.configs.edit({
* account_id: '6f91088a406011ed95aed352566e8d4c',
* });
* ```
*/
edit(params, options) {
const { account_id, ...body } = params;
return this._client.patch((0, path_1.path) `/accounts/${account_id}/mnm/config`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Lists default sampling, router IPs and warp devices for account.
*
* @example
* ```ts
* const configuration =
* await client.magicNetworkMonitoring.configs.get({
* account_id: '6f91088a406011ed95aed352566e8d4c',
* });
* ```
*/
get(params, options) {
const { account_id } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/mnm/config`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseConfigs._key = Object.freeze([
'magicNetworkMonitoring',
'configs',
]);
return BaseConfigs;
})();
exports.BaseConfigs = BaseConfigs;
var Configs = /* @__PURE__ */ (() => {
class Configs extends BaseConfigs {
constructor() {
super(...arguments);
this.full = new FullAPI.Full(this._client);
}
}
Configs.Full = full_1.Full;
Configs.BaseFull = full_1.BaseFull;
return Configs;
})();
exports.Configs = Configs;
//# sourceMappingURL=configs.js.map