From 21f4afab74e13e3e510abdb52a3fd70c565f35a1 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Mon, 26 Feb 2024 01:19:25 +0000
Subject: [PATCH] feat: update via SDK Studio (#77)
---
.stats.yml | 2 +-
api.md | 36 +
src/index.ts | 7 +
src/resources/index.ts | 7 +
src/resources/pcaps/downloads.ts | 17 +
src/resources/pcaps/index.ts | 12 +
src/resources/pcaps/ownerships.ts | 186 +++++
src/resources/pcaps/pcaps.ts | 693 ++++++++++++++++++
src/resources/request-tracers/index.ts | 2 +-
.../request-tracers/request-tracers.ts | 1 +
src/resources/request-tracers/traces.ts | 83 +--
tests/api-resources/pcaps/downloads.test.ts | 24 +
tests/api-resources/pcaps/ownerships.test.ts | 108 +++
tests/api-resources/pcaps/pcaps.test.ts | 96 +++
14 files changed, 1205 insertions(+), 69 deletions(-)
create mode 100644 src/resources/pcaps/downloads.ts
create mode 100644 src/resources/pcaps/index.ts
create mode 100644 src/resources/pcaps/ownerships.ts
create mode 100644 src/resources/pcaps/pcaps.ts
create mode 100644 tests/api-resources/pcaps/downloads.test.ts
create mode 100644 tests/api-resources/pcaps/ownerships.test.ts
create mode 100644 tests/api-resources/pcaps/pcaps.test.ts
diff --git a/.stats.yml b/.stats.yml
index 743d127551..d54cea9acc 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1 +1 @@
-configured_endpoints: 1192
+configured_endpoints: 1200
diff --git a/api.md b/api.md
index b7dc775847..1f34d4c297 100644
--- a/api.md
+++ b/api.md
@@ -3880,6 +3880,41 @@ Methods:
- client.pages.projects.domains.edit(accountId, projectName, domainName) -> DomainEditResponse | null
- client.pages.projects.domains.get(accountId, projectName, domainName) -> DomainGetResponse | null
+# PCAPs
+
+Types:
+
+- PCAPCreateResponse
+- PCAPListResponse
+- PCAPGetResponse
+
+Methods:
+
+- client.pcaps.create(accountId, { ...params }) -> PCAPCreateResponse
+- client.pcaps.list(accountId) -> PCAPListResponse | null
+- client.pcaps.get(accountId, pcapId) -> PCAPGetResponse
+
+## Ownerships
+
+Types:
+
+- OwnershipCreateResponse
+- OwnershipGetResponse
+- OwnershipValidateResponse
+
+Methods:
+
+- client.pcaps.ownerships.create(accountId, { ...params }) -> OwnershipCreateResponse
+- client.pcaps.ownerships.delete(accountId, ownershipId) -> void
+- client.pcaps.ownerships.get(accountId) -> OwnershipGetResponse | null
+- client.pcaps.ownerships.validate(accountId, { ...params }) -> OwnershipValidateResponse
+
+## Downloads
+
+Methods:
+
+- client.pcaps.downloads.get(accountId, pcapId) -> Response
+
# Registrar
## Domains
@@ -3902,6 +3937,7 @@ Methods:
Types:
+- WyxwHh0jTrace
- TraceCreateResponse
Methods:
diff --git a/src/index.ts b/src/index.ts
index 0df21dc7c1..c7430913c7 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -221,6 +221,7 @@ export class Cloudflare extends Core.APIClient {
mnms: API.MNMs = new API.MNMs(this);
mtlsCertificates: API.MTLSCertificates = new API.MTLSCertificates(this);
pages: API.Pages = new API.Pages(this);
+ pcaps: API.PCAPs = new API.PCAPs(this);
registrar: API.Registrar = new API.Registrar(this);
requestTracers: API.RequestTracers = new API.RequestTracers(this);
roles: API.Roles = new API.Roles(this);
@@ -654,6 +655,12 @@ export namespace Cloudflare {
export import Pages = API.Pages;
+ export import PCAPs = API.PCAPs;
+ export import PCAPCreateResponse = API.PCAPCreateResponse;
+ export import PCAPListResponse = API.PCAPListResponse;
+ export import PCAPGetResponse = API.PCAPGetResponse;
+ export import PCAPCreateParams = API.PCAPCreateParams;
+
export import Registrar = API.Registrar;
export import RequestTracers = API.RequestTracers;
diff --git a/src/resources/index.ts b/src/resources/index.ts
index e81723ede5..bc25cae68e 100644
--- a/src/resources/index.ts
+++ b/src/resources/index.ts
@@ -218,6 +218,13 @@ export {
OriginTLSClientAuthCreateParams,
OriginTLSClientAuth,
} from './origin-tls-client-auth/origin-tls-client-auth';
+export {
+ PCAPCreateResponse,
+ PCAPListResponse,
+ PCAPGetResponse,
+ PCAPCreateParams,
+ PCAPs,
+} from './pcaps/pcaps';
export {
PageShieldUpdateResponse,
PageShieldListResponse,
diff --git a/src/resources/pcaps/downloads.ts b/src/resources/pcaps/downloads.ts
new file mode 100644
index 0000000000..d70ac7be93
--- /dev/null
+++ b/src/resources/pcaps/downloads.ts
@@ -0,0 +1,17 @@
+// File generated from our OpenAPI spec by Stainless.
+
+import * as Core from 'cloudflare/core';
+import { APIResource } from 'cloudflare/resource';
+import { type Response } from 'cloudflare/_shims/index';
+
+export class Downloads extends APIResource {
+ /**
+ * Download PCAP information into a file. Response is a binary PCAP file.
+ */
+ get(accountId: string, pcapId: string, options?: Core.RequestOptions): Core.APIPromise {
+ return this._client.get(`/accounts/${accountId}/pcaps/${pcapId}/download`, {
+ ...options,
+ __binaryResponse: true,
+ });
+ }
+}
diff --git a/src/resources/pcaps/index.ts b/src/resources/pcaps/index.ts
new file mode 100644
index 0000000000..35967a610f
--- /dev/null
+++ b/src/resources/pcaps/index.ts
@@ -0,0 +1,12 @@
+// File generated from our OpenAPI spec by Stainless.
+
+export { Downloads } from './downloads';
+export {
+ OwnershipCreateResponse,
+ OwnershipGetResponse,
+ OwnershipValidateResponse,
+ OwnershipCreateParams,
+ OwnershipValidateParams,
+ Ownerships,
+} from './ownerships';
+export { PCAPCreateResponse, PCAPListResponse, PCAPGetResponse, PCAPCreateParams, PCAPs } from './pcaps';
diff --git a/src/resources/pcaps/ownerships.ts b/src/resources/pcaps/ownerships.ts
new file mode 100644
index 0000000000..93fe65c029
--- /dev/null
+++ b/src/resources/pcaps/ownerships.ts
@@ -0,0 +1,186 @@
+// File generated from our OpenAPI spec by Stainless.
+
+import * as Core from 'cloudflare/core';
+import { APIResource } from 'cloudflare/resource';
+import * as OwnershipsAPI from 'cloudflare/resources/pcaps/ownerships';
+
+export class Ownerships extends APIResource {
+ /**
+ * Adds an AWS or GCP bucket to use with full packet captures.
+ */
+ create(
+ accountId: string,
+ body: OwnershipCreateParams,
+ options?: Core.RequestOptions,
+ ): Core.APIPromise {
+ return (
+ this._client.post(`/accounts/${accountId}/pcaps/ownership`, { body, ...options }) as Core.APIPromise<{
+ result: OwnershipCreateResponse;
+ }>
+ )._thenUnwrap((obj) => obj.result);
+ }
+
+ /**
+ * Deletes buckets added to the packet captures API.
+ */
+ delete(accountId: string, ownershipId: string, options?: Core.RequestOptions): Core.APIPromise {
+ return this._client.delete(`/accounts/${accountId}/pcaps/ownership/${ownershipId}`, {
+ ...options,
+ headers: { Accept: '*/*', ...options?.headers },
+ });
+ }
+
+ /**
+ * List all buckets configured for use with PCAPs API.
+ */
+ get(accountId: string, options?: Core.RequestOptions): Core.APIPromise {
+ return (
+ this._client.get(`/accounts/${accountId}/pcaps/ownership`, options) as Core.APIPromise<{
+ result: OwnershipGetResponse | null;
+ }>
+ )._thenUnwrap((obj) => obj.result);
+ }
+
+ /**
+ * Validates buckets added to the packet captures API.
+ */
+ validate(
+ accountId: string,
+ body: OwnershipValidateParams,
+ options?: Core.RequestOptions,
+ ): Core.APIPromise {
+ return (
+ this._client.post(`/accounts/${accountId}/pcaps/ownership/validate`, {
+ body,
+ ...options,
+ }) as Core.APIPromise<{ result: OwnershipValidateResponse }>
+ )._thenUnwrap((obj) => obj.result);
+ }
+}
+
+export interface OwnershipCreateResponse {
+ /**
+ * The bucket ID associated with the packet captures API.
+ */
+ id: string;
+
+ /**
+ * The full URI for the bucket. This field only applies to `full` packet captures.
+ */
+ destination_conf: string;
+
+ /**
+ * The ownership challenge filename stored in the bucket.
+ */
+ filename: string;
+
+ /**
+ * The status of the ownership challenge. Can be pending, success or failed.
+ */
+ status: 'pending' | 'success' | 'failed';
+
+ /**
+ * The RFC 3339 timestamp when the bucket was added to packet captures API.
+ */
+ submitted: string;
+
+ /**
+ * The RFC 3339 timestamp when the bucket was validated.
+ */
+ validated?: string;
+}
+
+export type OwnershipGetResponse = Array;
+
+export namespace OwnershipGetResponse {
+ export interface OwnershipGetResponseItem {
+ /**
+ * The bucket ID associated with the packet captures API.
+ */
+ id: string;
+
+ /**
+ * The full URI for the bucket. This field only applies to `full` packet captures.
+ */
+ destination_conf: string;
+
+ /**
+ * The ownership challenge filename stored in the bucket.
+ */
+ filename: string;
+
+ /**
+ * The status of the ownership challenge. Can be pending, success or failed.
+ */
+ status: 'pending' | 'success' | 'failed';
+
+ /**
+ * The RFC 3339 timestamp when the bucket was added to packet captures API.
+ */
+ submitted: string;
+
+ /**
+ * The RFC 3339 timestamp when the bucket was validated.
+ */
+ validated?: string;
+ }
+}
+
+export interface OwnershipValidateResponse {
+ /**
+ * The bucket ID associated with the packet captures API.
+ */
+ id: string;
+
+ /**
+ * The full URI for the bucket. This field only applies to `full` packet captures.
+ */
+ destination_conf: string;
+
+ /**
+ * The ownership challenge filename stored in the bucket.
+ */
+ filename: string;
+
+ /**
+ * The status of the ownership challenge. Can be pending, success or failed.
+ */
+ status: 'pending' | 'success' | 'failed';
+
+ /**
+ * The RFC 3339 timestamp when the bucket was added to packet captures API.
+ */
+ submitted: string;
+
+ /**
+ * The RFC 3339 timestamp when the bucket was validated.
+ */
+ validated?: string;
+}
+
+export interface OwnershipCreateParams {
+ /**
+ * The full URI for the bucket. This field only applies to `full` packet captures.
+ */
+ destination_conf: string;
+}
+
+export interface OwnershipValidateParams {
+ /**
+ * The full URI for the bucket. This field only applies to `full` packet captures.
+ */
+ destination_conf: string;
+
+ /**
+ * The ownership challenge filename stored in the bucket.
+ */
+ ownership_challenge: string;
+}
+
+export namespace Ownerships {
+ export import OwnershipCreateResponse = OwnershipsAPI.OwnershipCreateResponse;
+ export import OwnershipGetResponse = OwnershipsAPI.OwnershipGetResponse;
+ export import OwnershipValidateResponse = OwnershipsAPI.OwnershipValidateResponse;
+ export import OwnershipCreateParams = OwnershipsAPI.OwnershipCreateParams;
+ export import OwnershipValidateParams = OwnershipsAPI.OwnershipValidateParams;
+}
diff --git a/src/resources/pcaps/pcaps.ts b/src/resources/pcaps/pcaps.ts
new file mode 100644
index 0000000000..bf9f05ce21
--- /dev/null
+++ b/src/resources/pcaps/pcaps.ts
@@ -0,0 +1,693 @@
+// File generated from our OpenAPI spec by Stainless.
+
+import * as Core from 'cloudflare/core';
+import { APIResource } from 'cloudflare/resource';
+import * as PCAPsAPI from 'cloudflare/resources/pcaps/pcaps';
+import * as DownloadsAPI from 'cloudflare/resources/pcaps/downloads';
+import * as OwnershipsAPI from 'cloudflare/resources/pcaps/ownerships';
+
+export class PCAPs extends APIResource {
+ ownerships: OwnershipsAPI.Ownerships = new OwnershipsAPI.Ownerships(this._client);
+ downloads: DownloadsAPI.Downloads = new DownloadsAPI.Downloads(this._client);
+
+ /**
+ * Create new PCAP request for account.
+ */
+ create(
+ accountId: string,
+ body: PCAPCreateParams,
+ options?: Core.RequestOptions,
+ ): Core.APIPromise {
+ return (
+ this._client.post(`/accounts/${accountId}/pcaps`, { body, ...options }) as Core.APIPromise<{
+ result: PCAPCreateResponse;
+ }>
+ )._thenUnwrap((obj) => obj.result);
+ }
+
+ /**
+ * Lists all packet capture requests for an account.
+ */
+ list(accountId: string, options?: Core.RequestOptions): Core.APIPromise {
+ return (
+ this._client.get(`/accounts/${accountId}/pcaps`, options) as Core.APIPromise<{
+ result: PCAPListResponse | null;
+ }>
+ )._thenUnwrap((obj) => obj.result);
+ }
+
+ /**
+ * Get information for a PCAP request by id.
+ */
+ get(accountId: string, pcapId: string, options?: Core.RequestOptions): Core.APIPromise {
+ return (
+ this._client.get(`/accounts/${accountId}/pcaps/${pcapId}`, options) as Core.APIPromise<{
+ result: PCAPGetResponse;
+ }>
+ )._thenUnwrap((obj) => obj.result);
+ }
+}
+
+export type PCAPCreateResponse =
+ | PCAPCreateResponse.MagicVisibilityPCAPsResponseSimple
+ | PCAPCreateResponse.MagicVisibilityPCAPsResponseFull;
+
+export namespace PCAPCreateResponse {
+ export interface MagicVisibilityPCAPsResponseSimple {
+ /**
+ * The ID for the packet capture.
+ */
+ id?: string;
+
+ /**
+ * The packet capture filter. When this field is empty, all packets are captured.
+ */
+ filter_v1?: MagicVisibilityPCAPsResponseSimple.FilterV1;
+
+ /**
+ * The status of the packet capture request.
+ */
+ status?:
+ | 'unknown'
+ | 'success'
+ | 'pending'
+ | 'running'
+ | 'conversion_pending'
+ | 'conversion_running'
+ | 'complete'
+ | 'failed';
+
+ /**
+ * The RFC 3339 timestamp when the packet capture was created.
+ */
+ submitted?: string;
+
+ /**
+ * The system used to collect packet captures.
+ */
+ system?: 'magic-transit';
+
+ /**
+ * The packet capture duration in seconds.
+ */
+ time_limit?: number;
+
+ /**
+ * The type of packet capture. `Simple` captures sampled packets, and `full`
+ * captures entire payloads and non-sampled packets.
+ */
+ type?: 'simple' | 'full';
+ }
+
+ export namespace MagicVisibilityPCAPsResponseSimple {
+ /**
+ * The packet capture filter. When this field is empty, all packets are captured.
+ */
+ export interface FilterV1 {
+ /**
+ * The destination IP address of the packet.
+ */
+ destination_address?: string;
+
+ /**
+ * The destination port of the packet.
+ */
+ destination_port?: number;
+
+ /**
+ * The protocol number of the packet.
+ */
+ protocol?: number;
+
+ /**
+ * The source IP address of the packet.
+ */
+ source_address?: string;
+
+ /**
+ * The source port of the packet.
+ */
+ source_port?: number;
+ }
+ }
+
+ export interface MagicVisibilityPCAPsResponseFull {
+ /**
+ * The ID for the packet capture.
+ */
+ id?: string;
+
+ /**
+ * The maximum number of bytes to capture. This field only applies to `full` packet
+ * captures.
+ */
+ byte_limit?: number;
+
+ /**
+ * The name of the data center used for the packet capture. This can be a specific
+ * colo (ord02) or a multi-colo name (ORD). This field only applies to `full`
+ * packet captures.
+ */
+ colo_name?: string;
+
+ /**
+ * The full URI for the bucket. This field only applies to `full` packet captures.
+ */
+ destination_conf?: string;
+
+ /**
+ * An error message that describes why the packet capture failed. This field only
+ * applies to `full` packet captures.
+ */
+ error_message?: string;
+
+ /**
+ * The packet capture filter. When this field is empty, all packets are captured.
+ */
+ filter_v1?: MagicVisibilityPCAPsResponseFull.FilterV1;
+
+ /**
+ * The status of the packet capture request.
+ */
+ status?:
+ | 'unknown'
+ | 'success'
+ | 'pending'
+ | 'running'
+ | 'conversion_pending'
+ | 'conversion_running'
+ | 'complete'
+ | 'failed';
+
+ /**
+ * The RFC 3339 timestamp when the packet capture was created.
+ */
+ submitted?: string;
+
+ /**
+ * The system used to collect packet captures.
+ */
+ system?: 'magic-transit';
+
+ /**
+ * The packet capture duration in seconds.
+ */
+ time_limit?: number;
+
+ /**
+ * The type of packet capture. `Simple` captures sampled packets, and `full`
+ * captures entire payloads and non-sampled packets.
+ */
+ type?: 'simple' | 'full';
+ }
+
+ export namespace MagicVisibilityPCAPsResponseFull {
+ /**
+ * The packet capture filter. When this field is empty, all packets are captured.
+ */
+ export interface FilterV1 {
+ /**
+ * The destination IP address of the packet.
+ */
+ destination_address?: string;
+
+ /**
+ * The destination port of the packet.
+ */
+ destination_port?: number;
+
+ /**
+ * The protocol number of the packet.
+ */
+ protocol?: number;
+
+ /**
+ * The source IP address of the packet.
+ */
+ source_address?: string;
+
+ /**
+ * The source port of the packet.
+ */
+ source_port?: number;
+ }
+ }
+}
+
+export type PCAPListResponse = Array<
+ PCAPListResponse.MagicVisibilityPCAPsResponseSimple | PCAPListResponse.MagicVisibilityPCAPsResponseFull
+>;
+
+export namespace PCAPListResponse {
+ export interface MagicVisibilityPCAPsResponseSimple {
+ /**
+ * The ID for the packet capture.
+ */
+ id?: string;
+
+ /**
+ * The packet capture filter. When this field is empty, all packets are captured.
+ */
+ filter_v1?: MagicVisibilityPCAPsResponseSimple.FilterV1;
+
+ /**
+ * The status of the packet capture request.
+ */
+ status?:
+ | 'unknown'
+ | 'success'
+ | 'pending'
+ | 'running'
+ | 'conversion_pending'
+ | 'conversion_running'
+ | 'complete'
+ | 'failed';
+
+ /**
+ * The RFC 3339 timestamp when the packet capture was created.
+ */
+ submitted?: string;
+
+ /**
+ * The system used to collect packet captures.
+ */
+ system?: 'magic-transit';
+
+ /**
+ * The packet capture duration in seconds.
+ */
+ time_limit?: number;
+
+ /**
+ * The type of packet capture. `Simple` captures sampled packets, and `full`
+ * captures entire payloads and non-sampled packets.
+ */
+ type?: 'simple' | 'full';
+ }
+
+ export namespace MagicVisibilityPCAPsResponseSimple {
+ /**
+ * The packet capture filter. When this field is empty, all packets are captured.
+ */
+ export interface FilterV1 {
+ /**
+ * The destination IP address of the packet.
+ */
+ destination_address?: string;
+
+ /**
+ * The destination port of the packet.
+ */
+ destination_port?: number;
+
+ /**
+ * The protocol number of the packet.
+ */
+ protocol?: number;
+
+ /**
+ * The source IP address of the packet.
+ */
+ source_address?: string;
+
+ /**
+ * The source port of the packet.
+ */
+ source_port?: number;
+ }
+ }
+
+ export interface MagicVisibilityPCAPsResponseFull {
+ /**
+ * The ID for the packet capture.
+ */
+ id?: string;
+
+ /**
+ * The maximum number of bytes to capture. This field only applies to `full` packet
+ * captures.
+ */
+ byte_limit?: number;
+
+ /**
+ * The name of the data center used for the packet capture. This can be a specific
+ * colo (ord02) or a multi-colo name (ORD). This field only applies to `full`
+ * packet captures.
+ */
+ colo_name?: string;
+
+ /**
+ * The full URI for the bucket. This field only applies to `full` packet captures.
+ */
+ destination_conf?: string;
+
+ /**
+ * An error message that describes why the packet capture failed. This field only
+ * applies to `full` packet captures.
+ */
+ error_message?: string;
+
+ /**
+ * The packet capture filter. When this field is empty, all packets are captured.
+ */
+ filter_v1?: MagicVisibilityPCAPsResponseFull.FilterV1;
+
+ /**
+ * The status of the packet capture request.
+ */
+ status?:
+ | 'unknown'
+ | 'success'
+ | 'pending'
+ | 'running'
+ | 'conversion_pending'
+ | 'conversion_running'
+ | 'complete'
+ | 'failed';
+
+ /**
+ * The RFC 3339 timestamp when the packet capture was created.
+ */
+ submitted?: string;
+
+ /**
+ * The system used to collect packet captures.
+ */
+ system?: 'magic-transit';
+
+ /**
+ * The packet capture duration in seconds.
+ */
+ time_limit?: number;
+
+ /**
+ * The type of packet capture. `Simple` captures sampled packets, and `full`
+ * captures entire payloads and non-sampled packets.
+ */
+ type?: 'simple' | 'full';
+ }
+
+ export namespace MagicVisibilityPCAPsResponseFull {
+ /**
+ * The packet capture filter. When this field is empty, all packets are captured.
+ */
+ export interface FilterV1 {
+ /**
+ * The destination IP address of the packet.
+ */
+ destination_address?: string;
+
+ /**
+ * The destination port of the packet.
+ */
+ destination_port?: number;
+
+ /**
+ * The protocol number of the packet.
+ */
+ protocol?: number;
+
+ /**
+ * The source IP address of the packet.
+ */
+ source_address?: string;
+
+ /**
+ * The source port of the packet.
+ */
+ source_port?: number;
+ }
+ }
+}
+
+export type PCAPGetResponse =
+ | PCAPGetResponse.MagicVisibilityPCAPsResponseSimple
+ | PCAPGetResponse.MagicVisibilityPCAPsResponseFull;
+
+export namespace PCAPGetResponse {
+ export interface MagicVisibilityPCAPsResponseSimple {
+ /**
+ * The ID for the packet capture.
+ */
+ id?: string;
+
+ /**
+ * The packet capture filter. When this field is empty, all packets are captured.
+ */
+ filter_v1?: MagicVisibilityPCAPsResponseSimple.FilterV1;
+
+ /**
+ * The status of the packet capture request.
+ */
+ status?:
+ | 'unknown'
+ | 'success'
+ | 'pending'
+ | 'running'
+ | 'conversion_pending'
+ | 'conversion_running'
+ | 'complete'
+ | 'failed';
+
+ /**
+ * The RFC 3339 timestamp when the packet capture was created.
+ */
+ submitted?: string;
+
+ /**
+ * The system used to collect packet captures.
+ */
+ system?: 'magic-transit';
+
+ /**
+ * The packet capture duration in seconds.
+ */
+ time_limit?: number;
+
+ /**
+ * The type of packet capture. `Simple` captures sampled packets, and `full`
+ * captures entire payloads and non-sampled packets.
+ */
+ type?: 'simple' | 'full';
+ }
+
+ export namespace MagicVisibilityPCAPsResponseSimple {
+ /**
+ * The packet capture filter. When this field is empty, all packets are captured.
+ */
+ export interface FilterV1 {
+ /**
+ * The destination IP address of the packet.
+ */
+ destination_address?: string;
+
+ /**
+ * The destination port of the packet.
+ */
+ destination_port?: number;
+
+ /**
+ * The protocol number of the packet.
+ */
+ protocol?: number;
+
+ /**
+ * The source IP address of the packet.
+ */
+ source_address?: string;
+
+ /**
+ * The source port of the packet.
+ */
+ source_port?: number;
+ }
+ }
+
+ export interface MagicVisibilityPCAPsResponseFull {
+ /**
+ * The ID for the packet capture.
+ */
+ id?: string;
+
+ /**
+ * The maximum number of bytes to capture. This field only applies to `full` packet
+ * captures.
+ */
+ byte_limit?: number;
+
+ /**
+ * The name of the data center used for the packet capture. This can be a specific
+ * colo (ord02) or a multi-colo name (ORD). This field only applies to `full`
+ * packet captures.
+ */
+ colo_name?: string;
+
+ /**
+ * The full URI for the bucket. This field only applies to `full` packet captures.
+ */
+ destination_conf?: string;
+
+ /**
+ * An error message that describes why the packet capture failed. This field only
+ * applies to `full` packet captures.
+ */
+ error_message?: string;
+
+ /**
+ * The packet capture filter. When this field is empty, all packets are captured.
+ */
+ filter_v1?: MagicVisibilityPCAPsResponseFull.FilterV1;
+
+ /**
+ * The status of the packet capture request.
+ */
+ status?:
+ | 'unknown'
+ | 'success'
+ | 'pending'
+ | 'running'
+ | 'conversion_pending'
+ | 'conversion_running'
+ | 'complete'
+ | 'failed';
+
+ /**
+ * The RFC 3339 timestamp when the packet capture was created.
+ */
+ submitted?: string;
+
+ /**
+ * The system used to collect packet captures.
+ */
+ system?: 'magic-transit';
+
+ /**
+ * The packet capture duration in seconds.
+ */
+ time_limit?: number;
+
+ /**
+ * The type of packet capture. `Simple` captures sampled packets, and `full`
+ * captures entire payloads and non-sampled packets.
+ */
+ type?: 'simple' | 'full';
+ }
+
+ export namespace MagicVisibilityPCAPsResponseFull {
+ /**
+ * The packet capture filter. When this field is empty, all packets are captured.
+ */
+ export interface FilterV1 {
+ /**
+ * The destination IP address of the packet.
+ */
+ destination_address?: string;
+
+ /**
+ * The destination port of the packet.
+ */
+ destination_port?: number;
+
+ /**
+ * The protocol number of the packet.
+ */
+ protocol?: number;
+
+ /**
+ * The source IP address of the packet.
+ */
+ source_address?: string;
+
+ /**
+ * The source port of the packet.
+ */
+ source_port?: number;
+ }
+ }
+}
+
+export interface PCAPCreateParams {
+ /**
+ * The system used to collect packet captures.
+ */
+ system: 'magic-transit';
+
+ /**
+ * The packet capture duration in seconds.
+ */
+ time_limit: number;
+
+ /**
+ * The type of packet capture. `Simple` captures sampled packets, and `full`
+ * captures entire payloads and non-sampled packets.
+ */
+ type: 'simple' | 'full';
+
+ /**
+ * The maximum number of bytes to capture. This field only applies to `full` packet
+ * captures.
+ */
+ byte_limit?: number;
+
+ /**
+ * The name of the data center used for the packet capture. This can be a specific
+ * colo (ord02) or a multi-colo name (ORD). This field only applies to `full`
+ * packet captures.
+ */
+ colo_name?: string;
+
+ /**
+ * The full URI for the bucket. This field only applies to `full` packet captures.
+ */
+ destination_conf?: string;
+
+ filter_v1?: PCAPCreateParams.FilterV1;
+
+ /**
+ * The limit of packets contained in a packet capture.
+ */
+ packet_limit?: number;
+}
+
+export namespace PCAPCreateParams {
+ export interface FilterV1 {
+ /**
+ * The destination IP address of the packet.
+ */
+ destination_address?: string;
+
+ /**
+ * The destination port of the packet.
+ */
+ destination_port?: number;
+
+ /**
+ * The protocol number of the packet.
+ */
+ protocol?: number;
+
+ /**
+ * The source IP address of the packet.
+ */
+ source_address?: string;
+
+ /**
+ * The source port of the packet.
+ */
+ source_port?: number;
+ }
+}
+
+export namespace PCAPs {
+ export import PCAPCreateResponse = PCAPsAPI.PCAPCreateResponse;
+ export import PCAPListResponse = PCAPsAPI.PCAPListResponse;
+ export import PCAPGetResponse = PCAPsAPI.PCAPGetResponse;
+ export import PCAPCreateParams = PCAPsAPI.PCAPCreateParams;
+ export import Ownerships = OwnershipsAPI.Ownerships;
+ export import OwnershipCreateResponse = OwnershipsAPI.OwnershipCreateResponse;
+ export import OwnershipGetResponse = OwnershipsAPI.OwnershipGetResponse;
+ export import OwnershipValidateResponse = OwnershipsAPI.OwnershipValidateResponse;
+ export import OwnershipCreateParams = OwnershipsAPI.OwnershipCreateParams;
+ export import OwnershipValidateParams = OwnershipsAPI.OwnershipValidateParams;
+ export import Downloads = DownloadsAPI.Downloads;
+}
diff --git a/src/resources/request-tracers/index.ts b/src/resources/request-tracers/index.ts
index abc216df83..5ad3f50bea 100644
--- a/src/resources/request-tracers/index.ts
+++ b/src/resources/request-tracers/index.ts
@@ -1,4 +1,4 @@
// File generated from our OpenAPI spec by Stainless.
export { RequestTracers } from './request-tracers';
-export { TraceCreateResponse, TraceCreateParams, Traces } from './traces';
+export { WyxwHh0jTrace, TraceCreateResponse, TraceCreateParams, Traces } from './traces';
diff --git a/src/resources/request-tracers/request-tracers.ts b/src/resources/request-tracers/request-tracers.ts
index 2c2204a2c1..c0e87887ab 100644
--- a/src/resources/request-tracers/request-tracers.ts
+++ b/src/resources/request-tracers/request-tracers.ts
@@ -9,6 +9,7 @@ export class RequestTracers extends APIResource {
export namespace RequestTracers {
export import Traces = TracesAPI.Traces;
+ export import WyxwHh0jTrace = TracesAPI.WyxwHh0jTrace;
export import TraceCreateResponse = TracesAPI.TraceCreateResponse;
export import TraceCreateParams = TracesAPI.TraceCreateParams;
}
diff --git a/src/resources/request-tracers/traces.ts b/src/resources/request-tracers/traces.ts
index 06e250fd31..381af1bbb2 100644
--- a/src/resources/request-tracers/traces.ts
+++ b/src/resources/request-tracers/traces.ts
@@ -22,23 +22,13 @@ export class Traces extends APIResource {
}
}
-/**
- * Trace result with an origin status code
- */
-export interface TraceCreateResponse {
- /**
- * HTTP Status code of zone response
- */
- status_code?: number;
-
- trace?: Array;
-}
+export type WyxwHh0jTrace = Array;
-export namespace TraceCreateResponse {
+export namespace WyxwHh0jTrace {
/**
* List of steps acting on request/response
*/
- export interface Trace {
+ export interface WyxwHh0jTraceItem {
/**
* If step type is rule, then action performed by this rule
*/
@@ -79,67 +69,25 @@ export namespace TraceCreateResponse {
*/
step_name?: string;
- trace?: Array;
+ trace?: TracesAPI.WyxwHh0jTrace;
/**
* Tracing step type
*/
type?: string;
}
+}
- export namespace Trace {
- /**
- * List of steps acting on request/response
- */
- export interface Trace {
- /**
- * If step type is rule, then action performed by this rule
- */
- action?: string;
-
- /**
- * If step type is rule, then action parameters of this rule as JSON
- */
- action_parameters?: unknown;
-
- /**
- * If step type is rule or ruleset, the description of this entity
- */
- description?: string;
-
- /**
- * If step type is rule, then expression used to match for this rule
- */
- expression?: string;
-
- /**
- * If step type is ruleset, then kind of this ruleset
- */
- kind?: string;
-
- /**
- * Whether tracing step affected tracing request/response
- */
- matched?: boolean;
-
- /**
- * If step type is ruleset, then name of this ruleset
- */
- name?: string;
-
- /**
- * Tracing step identifying name
- */
- step_name?: string;
-
- trace?: unknown;
-
- /**
- * Tracing step type
- */
- type?: string;
- }
- }
+/**
+ * Trace result with an origin status code
+ */
+export interface TraceCreateResponse {
+ /**
+ * HTTP Status code of zone response
+ */
+ status_code?: number;
+
+ trace?: WyxwHh0jTrace;
}
export interface TraceCreateParams {
@@ -253,6 +201,7 @@ export namespace TraceCreateParams {
}
export namespace Traces {
+ export import WyxwHh0jTrace = TracesAPI.WyxwHh0jTrace;
export import TraceCreateResponse = TracesAPI.TraceCreateResponse;
export import TraceCreateParams = TracesAPI.TraceCreateParams;
}
diff --git a/tests/api-resources/pcaps/downloads.test.ts b/tests/api-resources/pcaps/downloads.test.ts
new file mode 100644
index 0000000000..5907e07345
--- /dev/null
+++ b/tests/api-resources/pcaps/downloads.test.ts
@@ -0,0 +1,24 @@
+// File generated from our OpenAPI spec by Stainless.
+
+import Cloudflare from 'cloudflare';
+
+const cloudflare = new Cloudflare({
+ apiKey: '144c9defac04969c7bfad8efaa8ea194',
+ apiEmail: 'user@example.com',
+ apiToken: 'Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY',
+ userServiceKey:
+ 'v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719',
+ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
+});
+
+describe('resource downloads', () => {
+ // skipped: tests are disabled for the time being
+ test.skip('get: request options instead of params are passed correctly', async () => {
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
+ await expect(
+ cloudflare.pcaps.downloads.get('023e105f4ecef8ad9ca31a8372d0c353', '023e105f4ecef8ad9ca31a8372d0c353', {
+ path: '/_stainless_unknown_path',
+ }),
+ ).rejects.toThrow(Cloudflare.NotFoundError);
+ });
+});
diff --git a/tests/api-resources/pcaps/ownerships.test.ts b/tests/api-resources/pcaps/ownerships.test.ts
new file mode 100644
index 0000000000..98175d458c
--- /dev/null
+++ b/tests/api-resources/pcaps/ownerships.test.ts
@@ -0,0 +1,108 @@
+// File generated from our OpenAPI spec by Stainless.
+
+import Cloudflare from 'cloudflare';
+import { Response } from 'node-fetch';
+
+const cloudflare = new Cloudflare({
+ apiKey: '144c9defac04969c7bfad8efaa8ea194',
+ apiEmail: 'user@example.com',
+ apiToken: 'Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY',
+ userServiceKey:
+ 'v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719',
+ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
+});
+
+describe('resource ownerships', () => {
+ // skipped: tests are disabled for the time being
+ test.skip('create: only required params', async () => {
+ const responsePromise = cloudflare.pcaps.ownerships.create('023e105f4ecef8ad9ca31a8372d0c353', {
+ destination_conf: 's3://pcaps-bucket?region=us-east-1',
+ });
+ const rawResponse = await responsePromise.asResponse();
+ expect(rawResponse).toBeInstanceOf(Response);
+ const response = await responsePromise;
+ expect(response).not.toBeInstanceOf(Response);
+ const dataAndResponse = await responsePromise.withResponse();
+ expect(dataAndResponse.data).toBe(response);
+ expect(dataAndResponse.response).toBe(rawResponse);
+ });
+
+ // skipped: tests are disabled for the time being
+ test.skip('create: required and optional params', async () => {
+ const response = await cloudflare.pcaps.ownerships.create('023e105f4ecef8ad9ca31a8372d0c353', {
+ destination_conf: 's3://pcaps-bucket?region=us-east-1',
+ });
+ });
+
+ // skipped: tests are disabled for the time being
+ test.skip('delete', async () => {
+ const responsePromise = cloudflare.pcaps.ownerships.delete(
+ '023e105f4ecef8ad9ca31a8372d0c353',
+ '023e105f4ecef8ad9ca31a8372d0c353',
+ );
+ const rawResponse = await responsePromise.asResponse();
+ expect(rawResponse).toBeInstanceOf(Response);
+ const response = await responsePromise;
+ expect(response).not.toBeInstanceOf(Response);
+ const dataAndResponse = await responsePromise.withResponse();
+ expect(dataAndResponse.data).toBe(response);
+ expect(dataAndResponse.response).toBe(rawResponse);
+ });
+
+ // skipped: tests are disabled for the time being
+ test.skip('delete: request options instead of params are passed correctly', async () => {
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
+ await expect(
+ cloudflare.pcaps.ownerships.delete(
+ '023e105f4ecef8ad9ca31a8372d0c353',
+ '023e105f4ecef8ad9ca31a8372d0c353',
+ { path: '/_stainless_unknown_path' },
+ ),
+ ).rejects.toThrow(Cloudflare.NotFoundError);
+ });
+
+ // skipped: tests are disabled for the time being
+ test.skip('get', async () => {
+ const responsePromise = cloudflare.pcaps.ownerships.get('023e105f4ecef8ad9ca31a8372d0c353');
+ const rawResponse = await responsePromise.asResponse();
+ expect(rawResponse).toBeInstanceOf(Response);
+ const response = await responsePromise;
+ expect(response).not.toBeInstanceOf(Response);
+ const dataAndResponse = await responsePromise.withResponse();
+ expect(dataAndResponse.data).toBe(response);
+ expect(dataAndResponse.response).toBe(rawResponse);
+ });
+
+ // skipped: tests are disabled for the time being
+ test.skip('get: request options instead of params are passed correctly', async () => {
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
+ await expect(
+ cloudflare.pcaps.ownerships.get('023e105f4ecef8ad9ca31a8372d0c353', {
+ path: '/_stainless_unknown_path',
+ }),
+ ).rejects.toThrow(Cloudflare.NotFoundError);
+ });
+
+ // skipped: tests are disabled for the time being
+ test.skip('validate: only required params', async () => {
+ const responsePromise = cloudflare.pcaps.ownerships.validate('023e105f4ecef8ad9ca31a8372d0c353', {
+ destination_conf: 's3://pcaps-bucket?region=us-east-1',
+ ownership_challenge: 'ownership-challenge-9883874ecac311ec8475433579a6bf5f.txt',
+ });
+ const rawResponse = await responsePromise.asResponse();
+ expect(rawResponse).toBeInstanceOf(Response);
+ const response = await responsePromise;
+ expect(response).not.toBeInstanceOf(Response);
+ const dataAndResponse = await responsePromise.withResponse();
+ expect(dataAndResponse.data).toBe(response);
+ expect(dataAndResponse.response).toBe(rawResponse);
+ });
+
+ // skipped: tests are disabled for the time being
+ test.skip('validate: required and optional params', async () => {
+ const response = await cloudflare.pcaps.ownerships.validate('023e105f4ecef8ad9ca31a8372d0c353', {
+ destination_conf: 's3://pcaps-bucket?region=us-east-1',
+ ownership_challenge: 'ownership-challenge-9883874ecac311ec8475433579a6bf5f.txt',
+ });
+ });
+});
diff --git a/tests/api-resources/pcaps/pcaps.test.ts b/tests/api-resources/pcaps/pcaps.test.ts
new file mode 100644
index 0000000000..fd7445f0ed
--- /dev/null
+++ b/tests/api-resources/pcaps/pcaps.test.ts
@@ -0,0 +1,96 @@
+// File generated from our OpenAPI spec by Stainless.
+
+import Cloudflare from 'cloudflare';
+import { Response } from 'node-fetch';
+
+const cloudflare = new Cloudflare({
+ apiKey: '144c9defac04969c7bfad8efaa8ea194',
+ apiEmail: 'user@example.com',
+ apiToken: 'Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY',
+ userServiceKey:
+ 'v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719',
+ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
+});
+
+describe('resource pcaps', () => {
+ // skipped: tests are disabled for the time being
+ test.skip('create: only required params', async () => {
+ const responsePromise = cloudflare.pcaps.create('023e105f4ecef8ad9ca31a8372d0c353', {
+ system: 'magic-transit',
+ time_limit: 300,
+ type: 'simple',
+ });
+ const rawResponse = await responsePromise.asResponse();
+ expect(rawResponse).toBeInstanceOf(Response);
+ const response = await responsePromise;
+ expect(response).not.toBeInstanceOf(Response);
+ const dataAndResponse = await responsePromise.withResponse();
+ expect(dataAndResponse.data).toBe(response);
+ expect(dataAndResponse.response).toBe(rawResponse);
+ });
+
+ // skipped: tests are disabled for the time being
+ test.skip('create: required and optional params', async () => {
+ const response = await cloudflare.pcaps.create('023e105f4ecef8ad9ca31a8372d0c353', {
+ system: 'magic-transit',
+ time_limit: 300,
+ type: 'simple',
+ byte_limit: 500000,
+ colo_name: 'ord02',
+ destination_conf: 's3://pcaps-bucket?region=us-east-1',
+ filter_v1: {
+ destination_address: '1.2.3.4',
+ destination_port: 80,
+ protocol: 6,
+ source_address: '1.2.3.4',
+ source_port: 123,
+ },
+ packet_limit: 10000,
+ });
+ });
+
+ // skipped: tests are disabled for the time being
+ test.skip('list', async () => {
+ const responsePromise = cloudflare.pcaps.list('023e105f4ecef8ad9ca31a8372d0c353');
+ const rawResponse = await responsePromise.asResponse();
+ expect(rawResponse).toBeInstanceOf(Response);
+ const response = await responsePromise;
+ expect(response).not.toBeInstanceOf(Response);
+ const dataAndResponse = await responsePromise.withResponse();
+ expect(dataAndResponse.data).toBe(response);
+ expect(dataAndResponse.response).toBe(rawResponse);
+ });
+
+ // skipped: tests are disabled for the time being
+ test.skip('list: request options instead of params are passed correctly', async () => {
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
+ await expect(
+ cloudflare.pcaps.list('023e105f4ecef8ad9ca31a8372d0c353', { path: '/_stainless_unknown_path' }),
+ ).rejects.toThrow(Cloudflare.NotFoundError);
+ });
+
+ // skipped: tests are disabled for the time being
+ test.skip('get', async () => {
+ const responsePromise = cloudflare.pcaps.get(
+ '023e105f4ecef8ad9ca31a8372d0c353',
+ '023e105f4ecef8ad9ca31a8372d0c353',
+ );
+ const rawResponse = await responsePromise.asResponse();
+ expect(rawResponse).toBeInstanceOf(Response);
+ const response = await responsePromise;
+ expect(response).not.toBeInstanceOf(Response);
+ const dataAndResponse = await responsePromise.withResponse();
+ expect(dataAndResponse.data).toBe(response);
+ expect(dataAndResponse.response).toBe(rawResponse);
+ });
+
+ // skipped: tests are disabled for the time being
+ test.skip('get: request options instead of params are passed correctly', async () => {
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
+ await expect(
+ cloudflare.pcaps.get('023e105f4ecef8ad9ca31a8372d0c353', '023e105f4ecef8ad9ca31a8372d0c353', {
+ path: '/_stainless_unknown_path',
+ }),
+ ).rejects.toThrow(Cloudflare.NotFoundError);
+ });
+});