diff --git a/src/resources/radar/bgp/routes.ts b/src/resources/radar/bgp/routes.ts index af5f8e3343..da442eab67 100644 --- a/src/resources/radar/bgp/routes.ts +++ b/src/resources/radar/bgp/routes.ts @@ -26,7 +26,7 @@ export class Routes extends APIResource { } /** - * Lookup prefix-to-origin mapping on global routing tables. + * Lookup prefix-to-ASN mapping on global routing tables. */ pfx2as(query?: RoutePfx2asParams, options?: Core.RequestOptions): Core.APIPromise; pfx2as(options?: Core.RequestOptions): Core.APIPromise; @@ -267,13 +267,19 @@ export interface RoutePfx2asParams { */ format?: 'JSON' | 'CSV'; + /** + * Return only results with the longest prefix match for the given prefix. For + * example, specify a /32 prefix to lookup the origin ASN for an IPv4 address. + */ + longestPrefixMatch?: boolean; + /** * Lookup prefixes originated by the given ASN */ origin?: number; /** - * Lookup origins of the given prefix + * Lookup origin ASNs of the given prefix */ prefix?: string; diff --git a/tests/api-resources/radar/bgp/routes.test.ts b/tests/api-resources/radar/bgp/routes.test.ts index c1bf37cc0f..6af728828a 100644 --- a/tests/api-resources/radar/bgp/routes.test.ts +++ b/tests/api-resources/radar/bgp/routes.test.ts @@ -66,7 +66,7 @@ describe('resource routes', () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect( cloudflare.radar.bgp.routes.pfx2as( - { format: 'JSON', origin: 0, prefix: '1.1.1.0/24', rpkiStatus: 'INVALID' }, + { format: 'JSON', longestPrefixMatch: true, origin: 0, prefix: '1.1.1.0/24', rpkiStatus: 'INVALID' }, { path: '/_stainless_unknown_path' }, ), ).rejects.toThrow(Cloudflare.NotFoundError);