UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

91 lines • 3.54 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../core/resource.mjs"; import { path } from "../../../internal/utils/path.mjs"; export var BaseASNs = /* @__PURE__ */ (() => { class BaseASNs extends APIResource { /** * Retrieves a list of autonomous systems. * * @example * ```ts * const asns = await client.radar.entities.asns.list(); * ``` */ list(query = {}, options) { return this._client.get('/radar/entities/asns', { query, ...options })._thenUnwrap((obj) => obj.result); } /** * Retrieves Internet Routing Registry AS-SETs that an AS is a member of. * * @example * ```ts * const response = await client.radar.entities.asns.asSet(3); * ``` */ asSet(asn, query = {}, options) { return this._client.get(path `/radar/entities/asns/${asn}/as_set`, { query, ...options })._thenUnwrap((obj) => obj.result); } /** * Retrieves a ranked list of Autonomous Systems based on their presence in the * Cloudflare Botnet Threat Feed. Rankings can be sorted by offense count or number * of bad IPs. Optionally compare to a previous date to see rank changes. * * @example * ```ts * const response = * await client.radar.entities.asns.botnetThreatFeed(); * ``` */ botnetThreatFeed(query = {}, options) { return this._client.get('/radar/entities/asns/botnet_threat_feed', { query, ...options })._thenUnwrap((obj) => obj.result); } /** * Retrieves the requested autonomous system information. (A confidence level below * `5` indicates a low level of confidence in the traffic data - normally this * happens because Cloudflare has a small amount of traffic from/to this AS). * Population estimates come from APNIC (refer to https://labs.apnic.net/?p=526). * * @example * ```ts * const asn = await client.radar.entities.asns.get(174); * ``` */ get(asn, query = {}, options) { return this._client.get(path `/radar/entities/asns/${asn}`, { query, ...options })._thenUnwrap((obj) => obj.result); } /** * Retrieves the requested autonomous system information based on IP address. * Population estimates come from APNIC (refer to https://labs.apnic.net/?p=526). * * @example * ```ts * const response = await client.radar.entities.asns.ip({ * ip: '8.8.8.8', * }); * ``` */ ip(query, options) { return this._client.get('/radar/entities/asns/ip', { query, ...options })._thenUnwrap((obj) => obj.result); } /** * Retrieves AS-level relationship for given networks. * * @example * ```ts * const response = await client.radar.entities.asns.rel(3); * ``` */ rel(asn, query = {}, options) { return this._client.get(path `/radar/entities/asns/${asn}/rel`, { query, ...options })._thenUnwrap((obj) => obj.result); } } BaseASNs._key = Object.freeze([ 'radar', 'entities', 'asns', ]); return BaseASNs; })(); export class ASNs extends BaseASNs { } //# sourceMappingURL=asns.mjs.map