UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

143 lines • 5.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Datasets = exports.BaseDatasets = 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 EventsAPI = tslib_1.__importStar(require("./events.js")); const events_1 = require("./events.js"); const HealthAPI = tslib_1.__importStar(require("./health.js")); const health_1 = require("./health.js"); const path_1 = require("../../../../internal/utils/path.js"); var BaseDatasets = /* @__PURE__ */ (() => { class BaseDatasets extends resource_1.APIResource { /** * Creates a new threat event dataset in Cloudforce One for organizing related * threat events. * * @example * ```ts * const dataset = * await client.cloudforceOne.threatEvents.datasets.create({ * account_id: 'account_id', * isPublic: true, * name: 'x', * }); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post((0, path_1.path) `/accounts/${account_id}/cloudforce-one/events/dataset/create`, { body, ...options, }); } /** * Lists all threat event datasets configured in Cloudforce One. * * @example * ```ts * const datasets = * await client.cloudforceOne.threatEvents.datasets.list({ * account_id: 'account_id', * }); * ``` */ list(params, options) { const { account_id, ...query } = params; return this._client.get((0, path_1.path) `/accounts/${account_id}/cloudforce-one/events/dataset`, { query, ...options, }); } /** * Soft-deletes a dataset given a datasetId. * * @example * ```ts * const dataset = * await client.cloudforceOne.threatEvents.datasets.delete( * 'dataset_id', * { account_id: 'account_id' }, * ); * ``` */ delete(datasetID, params, options) { const { account_id } = params; return this._client.delete((0, path_1.path) `/accounts/${account_id}/cloudforce-one/events/dataset/${datasetID}`, options); } /** * Partially updates a threat event dataset in Cloudforce One, modifying specific * fields without replacing the entire dataset configuration. * * @example * ```ts * const response = * await client.cloudforceOne.threatEvents.datasets.edit( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { * account_id: 'account_id', * isPublic: true, * name: 'x', * }, * ); * ``` */ edit(datasetID, params, options) { const { account_id, ...body } = params; return this._client.patch((0, path_1.path) `/accounts/${account_id}/cloudforce-one/events/dataset/${datasetID}`, { body, ...options, }); } /** * Retrieves details for a specific threat event dataset. * * @example * ```ts * const dataset = * await client.cloudforceOne.threatEvents.datasets.get( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { account_id: 'account_id' }, * ); * ``` */ get(datasetID, params, options) { const { account_id } = params; return this._client.get((0, path_1.path) `/accounts/${account_id}/cloudforce-one/events/dataset/${datasetID}`, options); } /** * Deprecated; use GET /events/datasets/{dataset_id}/events/{event_id}/raw. * Available through 2026-11-28. * * @deprecated Use GET /events/datasets/{dataset_id}/events/{event_id}/raw before 2026-11-28. */ raw(eventID, params, options) { const { account_id, dataset_id } = params; return this._client.get((0, path_1.path) `/accounts/${account_id}/cloudforce-one/events/raw/${dataset_id}/${eventID}`, options); } } BaseDatasets._key = Object.freeze([ 'cloudforceOne', 'threatEvents', 'datasets', ]); return BaseDatasets; })(); exports.BaseDatasets = BaseDatasets; var Datasets = /* @__PURE__ */ (() => { class Datasets extends BaseDatasets { constructor() { super(...arguments); this.health = new HealthAPI.Health(this._client); this.events = new EventsAPI.Events(this._client); } } Datasets.Health = health_1.Health; Datasets.BaseHealth = health_1.BaseHealth; Datasets.Events = events_1.Events; Datasets.BaseEvents = events_1.BaseEvents; return Datasets; })(); exports.Datasets = Datasets; //# sourceMappingURL=datasets.js.map