UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

96 lines • 3.75 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ASNs = exports.BaseASNs = void 0; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../../core/resource.js"); const path_1 = require("../../../internal/utils/path.js"); var BaseASNs = /* @__PURE__ */ (() => { class BaseASNs extends resource_1.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((0, path_1.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((0, path_1.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((0, path_1.path) `/radar/entities/asns/${asn}/rel`, { query, ...options })._thenUnwrap((obj) => obj.result); } } BaseASNs._key = Object.freeze([ 'radar', 'entities', 'asns', ]); return BaseASNs; })(); exports.BaseASNs = BaseASNs; class ASNs extends BaseASNs { } exports.ASNs = ASNs; //# sourceMappingURL=asns.js.map