UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

234 lines • 11.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ThreatEvents = exports.BaseThreatEvents = 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 AggregateAPI = tslib_1.__importStar(require("./aggregate.js")); const aggregate_1 = require("./aggregate.js"); const AttackersAPI = tslib_1.__importStar(require("./attackers.js")); const attackers_1 = require("./attackers.js"); const CountriesAPI = tslib_1.__importStar(require("./countries.js")); const countries_1 = require("./countries.js"); const CronsAPI = tslib_1.__importStar(require("./crons.js")); const crons_1 = require("./crons.js"); const EventTagsAPI = tslib_1.__importStar(require("./event-tags.js")); const event_tags_1 = require("./event-tags.js"); const GraphAPI = tslib_1.__importStar(require("./graph.js")); const graph_1 = require("./graph.js"); const GraphqlAPI = tslib_1.__importStar(require("./graphql.js")); const graphql_1 = require("./graphql.js"); const InsightsAPI = tslib_1.__importStar(require("./insights.js")); const insights_1 = require("./insights.js"); const QueriesAPI = tslib_1.__importStar(require("./queries.js")); const queries_1 = require("./queries.js"); const RawAPI = tslib_1.__importStar(require("./raw.js")); const raw_1 = require("./raw.js"); const RelateAPI = tslib_1.__importStar(require("./relate.js")); const relate_1 = require("./relate.js"); const RelationshipsAPI = tslib_1.__importStar(require("./relationships.js")); const relationships_1 = require("./relationships.js"); const CategoriesAPI = tslib_1.__importStar(require("./categories/categories.js")); const categories_1 = require("./categories/categories.js"); const DatasetsAPI = tslib_1.__importStar(require("./datasets/datasets.js")); const datasets_1 = require("./datasets/datasets.js"); const IndicatorsAPI = tslib_1.__importStar(require("./indicators/indicators.js")); const indicators_1 = require("./indicators/indicators.js"); const TagsAPI = tslib_1.__importStar(require("./tags/tags.js")); const tags_1 = require("./tags/tags.js"); const TargetIndustriesAPI = tslib_1.__importStar(require("./target-industries/target-industries.js")); const target_industries_1 = require("./target-industries/target-industries.js"); const path_1 = require("../../../internal/utils/path.js"); var BaseThreatEvents = /* @__PURE__ */ (() => { class BaseThreatEvents extends resource_1.APIResource { /** * To create a dataset, see the * [`Create Dataset`](https://developers.cloudflare.com/api/resources/cloudforce_one/subresources/threat_events/subresources/datasets/methods/create/) * endpoint. When `datasetId` parameter is unspecified, it will be created in a * default dataset named `Cloudforce One Threat Events`. * * @example * ```ts * const threatEvent = * await client.cloudforceOne.threatEvents.create({ * account_id: 'account_id', * category: 'Domain Resolution', * date: '2022-04-01T00:00:00Z', * event: 'An attacker registered the domain domain.com', * raw: { data: { foo: 'bar' } }, * tlp: 'amber', * }); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post((0, path_1.path) `/accounts/${account_id}/cloudforce-one/events/create`, { body, ...options, }); } /** * Use `datasetId=all` or `datasetId=*` for the legacy all-datasets scope, * `datasetId=analytics` for datasets with `isAnalytics=true`, or * `datasetId=operational` for datasets with `isAnalytics=false` (limited to 50). * Scope values must be used alone. When `datasetId` is unspecified, events are * listed from the default Cloudforce One Threat Events dataset. To list existing * datasets, use the * [`List Datasets`](https://developers.cloudflare.com/api/resources/cloudforce_one/subresources/threat_events/subresources/datasets/methods/list/) * endpoint. * * @example * ```ts * const threatEvents = * await client.cloudforceOne.threatEvents.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`, { query, ...options }); } /** * The `datasetId` parameter must be defined. To list existing datasets (and their * IDs) in your account, use the * [`List Datasets`](https://developers.cloudflare.com/api/resources/cloudforce_one/subresources/threat_events/subresources/datasets/methods/list/) * endpoint. * * @example * ```ts * const response = * await client.cloudforceOne.threatEvents.bulkCreate({ * account_id: 'account_id', * data: [ * { * category: 'Domain Resolution', * date: '2022-04-01T00:00:00Z', * event: * 'An attacker registered the domain domain.com', * raw: { data: { foo: 'bar' } }, * tlp: 'amber', * }, * ], * datasetId: 'durableObjectName', * }); * ``` */ bulkCreate(params, options) { const { account_id, ...body } = params; return this._client.post((0, path_1.path) `/accounts/${account_id}/cloudforce-one/events/create/bulk`, { body, ...options, }); } /** * This method is deprecated. Please use `event_create_bulk` instead * * @deprecated This endpoint is deprecated and will be removed in a future version. */ bulkCreateRelationships(params, options) { const { account_id, ...body } = params; return this._client.post((0, path_1.path) `/accounts/${account_id}/cloudforce-one/events/create/bulk/relationships`, { body, ...options, }); } /** * Partially updates a threat event in Cloudforce One, modifying specific fields * without replacing the entire event. * * @example * ```ts * const response = * await client.cloudforceOne.threatEvents.edit('event_id', { * account_id: 'account_id', * datasetId: '9b769969-a211-466c-8ac3-cb91266a066a', * }); * ``` */ edit(eventID, params, options) { const { account_id, ...body } = params; return this._client.patch((0, path_1.path) `/accounts/${account_id}/cloudforce-one/events/${eventID}`, { body, ...options, }); } /** * This Method is deprecated. Please use * /events/dataset/:dataset_id/events/:event_id instead. * * @deprecated Use datasets.events.get instead (GET /accounts/{account_id}/cloudforce-one/events/dataset/{dataset_id}/events/{event_id}). */ get(eventID, params, options) { const { account_id } = params; return this._client.get((0, path_1.path) `/accounts/${account_id}/cloudforce-one/events/${eventID}`, options); } } BaseThreatEvents._key = Object.freeze([ 'cloudforceOne', 'threatEvents', ]); return BaseThreatEvents; })(); exports.BaseThreatEvents = BaseThreatEvents; var ThreatEvents = /* @__PURE__ */ (() => { class ThreatEvents extends BaseThreatEvents { constructor() { super(...arguments); this.aggregate = new AggregateAPI.Aggregate(this._client); this.graphql = new GraphqlAPI.Graphql(this._client); this.graph = new GraphAPI.Graph(this._client); this.queries = new QueriesAPI.Queries(this._client); this.relationships = new RelationshipsAPI.Relationships(this._client); this.indicators = new IndicatorsAPI.Indicators(this._client); this.attackers = new AttackersAPI.Attackers(this._client); this.categories = new CategoriesAPI.Categories(this._client); this.countries = new CountriesAPI.Countries(this._client); this.crons = new CronsAPI.Crons(this._client); this.datasets = new DatasetsAPI.Datasets(this._client); this.raw = new RawAPI.Raw(this._client); this.relate = new RelateAPI.Relate(this._client); this.tags = new TagsAPI.Tags(this._client); this.eventTags = new EventTagsAPI.EventTags(this._client); this.targetIndustries = new TargetIndustriesAPI.TargetIndustries(this._client); this.insights = new InsightsAPI.Insights(this._client); } } ThreatEvents.Aggregate = aggregate_1.Aggregate; ThreatEvents.BaseAggregate = aggregate_1.BaseAggregate; ThreatEvents.Graphql = graphql_1.Graphql; ThreatEvents.BaseGraphql = graphql_1.BaseGraphql; ThreatEvents.Graph = graph_1.Graph; ThreatEvents.BaseGraph = graph_1.BaseGraph; ThreatEvents.Queries = queries_1.Queries; ThreatEvents.BaseQueries = queries_1.BaseQueries; ThreatEvents.Relationships = relationships_1.Relationships; ThreatEvents.BaseRelationships = relationships_1.BaseRelationships; ThreatEvents.Indicators = indicators_1.Indicators; ThreatEvents.BaseIndicators = indicators_1.BaseIndicators; ThreatEvents.Attackers = attackers_1.Attackers; ThreatEvents.BaseAttackers = attackers_1.BaseAttackers; ThreatEvents.Categories = categories_1.Categories; ThreatEvents.BaseCategories = categories_1.BaseCategories; ThreatEvents.Countries = countries_1.Countries; ThreatEvents.BaseCountries = countries_1.BaseCountries; ThreatEvents.Crons = crons_1.Crons; ThreatEvents.BaseCrons = crons_1.BaseCrons; ThreatEvents.Datasets = datasets_1.Datasets; ThreatEvents.BaseDatasets = datasets_1.BaseDatasets; ThreatEvents.Raw = raw_1.Raw; ThreatEvents.BaseRaw = raw_1.BaseRaw; ThreatEvents.Relate = relate_1.Relate; ThreatEvents.BaseRelate = relate_1.BaseRelate; ThreatEvents.Tags = tags_1.Tags; ThreatEvents.BaseTags = tags_1.BaseTags; ThreatEvents.EventTags = event_tags_1.EventTags; ThreatEvents.BaseEventTags = event_tags_1.BaseEventTags; ThreatEvents.TargetIndustries = target_industries_1.TargetIndustries; ThreatEvents.BaseTargetIndustries = target_industries_1.BaseTargetIndustries; ThreatEvents.Insights = insights_1.Insights; ThreatEvents.BaseInsights = insights_1.BaseInsights; return ThreatEvents; })(); exports.ThreatEvents = ThreatEvents; //# sourceMappingURL=threat-events.js.map