cloudflare
Version:
The official TypeScript library for the Cloudflare API
228 lines • 10.3 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../core/resource.mjs";
import * as AggregateAPI from "./aggregate.mjs";
import { Aggregate, BaseAggregate } from "./aggregate.mjs";
import * as AttackersAPI from "./attackers.mjs";
import { Attackers, BaseAttackers } from "./attackers.mjs";
import * as CountriesAPI from "./countries.mjs";
import { BaseCountries, Countries } from "./countries.mjs";
import * as CronsAPI from "./crons.mjs";
import { BaseCrons, Crons } from "./crons.mjs";
import * as EventTagsAPI from "./event-tags.mjs";
import { BaseEventTags, EventTags, } from "./event-tags.mjs";
import * as GraphAPI from "./graph.mjs";
import { BaseGraph, Graph } from "./graph.mjs";
import * as GraphqlAPI from "./graphql.mjs";
import { BaseGraphql, Graphql } from "./graphql.mjs";
import * as InsightsAPI from "./insights.mjs";
import { BaseInsights, Insights } from "./insights.mjs";
import * as QueriesAPI from "./queries.mjs";
import { BaseQueries, Queries, } from "./queries.mjs";
import * as RawAPI from "./raw.mjs";
import { BaseRaw, Raw as RawAPIRaw, } from "./raw.mjs";
import * as RelateAPI from "./relate.mjs";
import { BaseRelate, Relate } from "./relate.mjs";
import * as RelationshipsAPI from "./relationships.mjs";
import { BaseRelationships, Relationships, } from "./relationships.mjs";
import * as CategoriesAPI from "./categories/categories.mjs";
import { BaseCategories, Categories, } from "./categories/categories.mjs";
import * as DatasetsAPI from "./datasets/datasets.mjs";
import { BaseDatasets, Datasets, } from "./datasets/datasets.mjs";
import * as IndicatorsAPI from "./indicators/indicators.mjs";
import { BaseIndicators, Indicators, } from "./indicators/indicators.mjs";
import * as TagsAPI from "./tags/tags.mjs";
import { BaseTags, Tags, } from "./tags/tags.mjs";
import * as TargetIndustriesAPI from "./target-industries/target-industries.mjs";
import { BaseTargetIndustries, TargetIndustries, } from "./target-industries/target-industries.mjs";
import { path } from "../../../internal/utils/path.mjs";
export var BaseThreatEvents = /* @__PURE__ */ (() => {
class BaseThreatEvents extends 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(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(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(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(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(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(path `/accounts/${account_id}/cloudforce-one/events/${eventID}`, options);
}
}
BaseThreatEvents._key = Object.freeze([
'cloudforceOne',
'threatEvents',
]);
return BaseThreatEvents;
})();
export 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;
ThreatEvents.BaseAggregate = BaseAggregate;
ThreatEvents.Graphql = Graphql;
ThreatEvents.BaseGraphql = BaseGraphql;
ThreatEvents.Graph = Graph;
ThreatEvents.BaseGraph = BaseGraph;
ThreatEvents.Queries = Queries;
ThreatEvents.BaseQueries = BaseQueries;
ThreatEvents.Relationships = Relationships;
ThreatEvents.BaseRelationships = BaseRelationships;
ThreatEvents.Indicators = Indicators;
ThreatEvents.BaseIndicators = BaseIndicators;
ThreatEvents.Attackers = Attackers;
ThreatEvents.BaseAttackers = BaseAttackers;
ThreatEvents.Categories = Categories;
ThreatEvents.BaseCategories = BaseCategories;
ThreatEvents.Countries = Countries;
ThreatEvents.BaseCountries = BaseCountries;
ThreatEvents.Crons = Crons;
ThreatEvents.BaseCrons = BaseCrons;
ThreatEvents.Datasets = Datasets;
ThreatEvents.BaseDatasets = BaseDatasets;
ThreatEvents.Raw = RawAPIRaw;
ThreatEvents.BaseRaw = BaseRaw;
ThreatEvents.Relate = Relate;
ThreatEvents.BaseRelate = BaseRelate;
ThreatEvents.Tags = Tags;
ThreatEvents.BaseTags = BaseTags;
ThreatEvents.EventTags = EventTags;
ThreatEvents.BaseEventTags = BaseEventTags;
ThreatEvents.TargetIndustries = TargetIndustries;
ThreatEvents.BaseTargetIndustries = BaseTargetIndustries;
ThreatEvents.Insights = Insights;
ThreatEvents.BaseInsights = BaseInsights;
return ThreatEvents;
})();
//# sourceMappingURL=threat-events.mjs.map