cloudflare
Version:
The official TypeScript library for the Cloudflare API
176 lines • 7.2 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Pipelines = exports.BasePipelines = void 0;
const tslib_1 = require("../../internal/tslib.js");
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../core/resource.js");
const SinksAPI = tslib_1.__importStar(require("./sinks.js"));
const sinks_1 = require("./sinks.js");
const StreamsAPI = tslib_1.__importStar(require("./streams.js"));
const streams_1 = require("./streams.js");
const pagination_1 = require("../../core/pagination.js");
const headers_1 = require("../../internal/headers.js");
const path_1 = require("../../internal/utils/path.js");
var BasePipelines = /* @__PURE__ */ (() => {
class BasePipelines extends resource_1.APIResource {
/**
* [DEPRECATED] Create a new pipeline. Use the new /pipelines/v1/pipelines endpoint
* instead.
*
* @deprecated Use create_v1 instead. This endpoint will be removed in the future.
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/pipelines`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* [DEPRECATED] Update an existing pipeline. Use the new /pipelines/v1/pipelines
* endpoint instead.
*
* @deprecated The v1 API does not support updates. This endpoint will be removed in the future.
*/
update(pipelineName, params, options) {
const { account_id, ...body } = params;
return this._client.put((0, path_1.path) `/accounts/${account_id}/pipelines/${pipelineName}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* [DEPRECATED] List, filter, and paginate pipelines in an account. Use the new
* /pipelines/v1/pipelines endpoint instead.
*
* @deprecated Use list_v1 instead. This endpoint will be removed in the future.
*/
list(params, options) {
const { account_id, ...query } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/pipelines`, { query, ...options });
}
/**
* [DEPRECATED] Delete a pipeline. Use the new /pipelines/v1/pipelines endpoint
* instead.
*
* @deprecated Use delete_v1 instead. This endpoint will be removed in the future.
*/
delete(pipelineName, params, options) {
const { account_id } = params;
return this._client.delete((0, path_1.path) `/accounts/${account_id}/pipelines/${pipelineName}`, {
...options,
headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
});
}
/**
* Create a new Pipeline.
*
* @example
* ```ts
* const response = await client.pipelines.createV1({
* account_id: '0123105f4ecef8ad9ca31a8372d0c353',
* name: 'my_pipeline',
* sql: 'insert into sink select * from source;',
* });
* ```
*/
createV1(params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/pipelines/v1/pipelines`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Delete Pipeline in Account.
*
* @example
* ```ts
* const response = await client.pipelines.deleteV1(
* '043e105f4ecef8ad9ca31a8372d0c353',
* { account_id: '0123105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
deleteV1(pipelineID, params, options) {
const { account_id } = params;
return this._client.delete((0, path_1.path) `/accounts/${account_id}/pipelines/v1/pipelines/${pipelineID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* [DEPRECATED] Get configuration of a pipeline. Use the new
* /pipelines/v1/pipelines endpoint instead.
*
* @deprecated Use get_v1 instead. This endpoint will be removed in the future.
*/
get(pipelineName, params, options) {
const { account_id } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/pipelines/${pipelineName}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Get Pipeline details.
*
* @example
* ```ts
* const response = await client.pipelines.getV1(
* '043e105f4ecef8ad9ca31a8372d0c353',
* { account_id: '0123105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
getV1(pipelineID, params, options) {
const { account_id } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/pipelines/v1/pipelines/${pipelineID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* List/Filter Pipelines in Account.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const pipelineListV1Response of client.pipelines.listV1(
* { account_id: '0123105f4ecef8ad9ca31a8372d0c353' },
* )) {
* // ...
* }
* ```
*/
listV1(params, options) {
const { account_id, ...query } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/pipelines/v1/pipelines`, (pagination_1.V4PagePaginationArray), { query, ...options });
}
/**
* Validates that the Pipelines SQL is correct.
*
* @example
* ```ts
* const response = await client.pipelines.validateSql({
* account_id: '0123105f4ecef8ad9ca31a8372d0c353',
* sql: 'insert into sink select * from source;',
* });
* ```
*/
validateSql(params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/pipelines/v1/validate_sql`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
}
BasePipelines._key = Object.freeze(['pipelines']);
return BasePipelines;
})();
exports.BasePipelines = BasePipelines;
var Pipelines = /* @__PURE__ */ (() => {
class Pipelines extends BasePipelines {
constructor() {
super(...arguments);
this.sinks = new SinksAPI.Sinks(this._client);
this.streams = new StreamsAPI.Streams(this._client);
}
}
Pipelines.Sinks = sinks_1.Sinks;
Pipelines.BaseSinks = sinks_1.BaseSinks;
Pipelines.Streams = streams_1.Streams;
Pipelines.BaseStreams = streams_1.BaseStreams;
return Pipelines;
})();
exports.Pipelines = Pipelines;
//# sourceMappingURL=pipelines.js.map