cloudflare
Version:
The official TypeScript library for the Cloudflare API
106 lines • 3.86 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../core/resource.mjs";
import * as FullAPI from "./full.mjs";
import { BaseFull, Full } from "./full.mjs";
import { path } from "../../../internal/utils/path.mjs";
export var BaseConfigs = /* @__PURE__ */ (() => {
class BaseConfigs extends 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(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(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(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(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(path `/accounts/${account_id}/mnm/config`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseConfigs._key = Object.freeze([
'magicNetworkMonitoring',
'configs',
]);
return BaseConfigs;
})();
export var Configs = /* @__PURE__ */ (() => {
class Configs extends BaseConfigs {
constructor() {
super(...arguments);
this.full = new FullAPI.Full(this._client);
}
}
Configs.Full = Full;
Configs.BaseFull = BaseFull;
return Configs;
})();
//# sourceMappingURL=configs.mjs.map