UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

108 lines • 3.92 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Destinations = exports.BaseDestinations = void 0; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../../core/resource.js"); const pagination_1 = require("../../../core/pagination.js"); const path_1 = require("../../../internal/utils/path.js"); var BaseDestinations = /* @__PURE__ */ (() => { class BaseDestinations extends resource_1.APIResource { /** * Create a new Workers Observability Telemetry Destination. * * @example * ```ts * const destination = * await client.workers.observability.destinations.create({ * account_id: 'account_id', * configuration: { * headers: { foo: 'string' }, * logpushDataset: 'opentelemetry-traces', * type: 'logpush', * url: 'url', * }, * enabled: true, * name: 'name', * }); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post((0, path_1.path) `/accounts/${account_id}/workers/observability/destinations`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Update an existing Workers Observability Telemetry Destination. * * @example * ```ts * const destination = * await client.workers.observability.destinations.update( * 'slug', * { * account_id: 'account_id', * configuration: { * headers: { foo: 'string' }, * type: 'logpush', * url: 'url', * }, * enabled: true, * }, * ); * ``` */ update(slug, params, options) { const { account_id, ...body } = params; return this._client.patch((0, path_1.path) `/accounts/${account_id}/workers/observability/destinations/${slug}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * List your Workers Observability Telemetry Destinations. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const destinationListResponse of client.workers.observability.destinations.list( * { account_id: 'account_id' }, * )) { * // ... * } * ``` */ list(params, options) { const { account_id, ...query } = params; return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/workers/observability/destinations`, (pagination_1.SinglePage), { query, ...options }); } /** * Delete a Workers Observability Telemetry Destination. * * @example * ```ts * const destination = * await client.workers.observability.destinations.delete( * 'slug', * { account_id: 'account_id' }, * ); * ``` */ delete(slug, params, options) { const { account_id } = params; return this._client.delete((0, path_1.path) `/accounts/${account_id}/workers/observability/destinations/${slug}`, options)._thenUnwrap((obj) => obj.result); } } BaseDestinations._key = Object.freeze([ 'workers', 'observability', 'destinations', ]); return BaseDestinations; })(); exports.BaseDestinations = BaseDestinations; class Destinations extends BaseDestinations { } exports.Destinations = Destinations; //# sourceMappingURL=destinations.js.map