UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

121 lines • 5.33 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../core/resource.mjs"; import * as CredentialsAPI from "./credentials.mjs"; import { BaseCredentials, Credentials, } from "./credentials.mjs"; import * as MaintenanceConfigsAPI from "./maintenance-configs.mjs"; import { BaseMaintenanceConfigs, MaintenanceConfigs, } from "./maintenance-configs.mjs"; import * as NamespacesAPI from "./namespaces/namespaces.mjs"; import { BaseNamespaces, Namespaces, } from "./namespaces/namespaces.mjs"; import { buildHeaders } from "../../internal/headers.mjs"; import { path } from "../../internal/utils/path.mjs"; export var BaseBasinCatalog = /* @__PURE__ */ (() => { class BaseBasinCatalog extends APIResource { /** * Returns a list of R2 buckets that have been enabled as Apache Iceberg catalogs * for the specified account. Each catalog represents an R2 bucket configured to * store Iceberg metadata and data files. * * @example * ```ts * const basinCatalogs = await client.basinCatalog.list({ * account_id: '0123456789abcdef0123456789abcdef', * }); * ``` */ list(params, options) { const { account_id } = params; return this._client.get(path `/accounts/${account_id}/basin-catalog`, options)._thenUnwrap((obj) => obj.result); } /** * Removes the catalog from the control plane without deleting R2 bucket objects. * Set force=true to remove catalog namespaces, tables, views, and maintenance * metadata. Force deletion is limited to a configured catalog object count. * * @example * ```ts * await client.basinCatalog.delete('my-data-bucket', { * account_id: '0123456789abcdef0123456789abcdef', * }); * ``` */ delete(bucketName, params, options) { const { account_id, force } = params; return this._client.post(path `/accounts/${account_id}/basin-catalog/${bucketName}/delete`, { query: { force }, ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } /** * Disable an R2 bucket as a catalog. This operation deactivates the catalog but * preserves existing metadata and data files. The catalog can be re-enabled later. * * @example * ```ts * await client.basinCatalog.disable('my-data-bucket', { * account_id: '0123456789abcdef0123456789abcdef', * }); * ``` */ disable(bucketName, params, options) { const { account_id } = params; return this._client.post(path `/accounts/${account_id}/basin-catalog/${bucketName}/disable`, { ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } /** * Enable an R2 bucket as an Apache Iceberg catalog. This operation creates the * necessary catalog infrastructure and activates the bucket for storing Iceberg * metadata and data files. * * @example * ```ts * const response = await client.basinCatalog.enable( * 'my-data-bucket', * { account_id: '0123456789abcdef0123456789abcdef' }, * ); * ``` */ enable(bucketName, params, options) { const { account_id } = params; return this._client.post(path `/accounts/${account_id}/basin-catalog/${bucketName}/enable`, options)._thenUnwrap((obj) => obj.result); } /** * Retrieve detailed information about a specific Basin Catalog by bucket name. * Returns catalog status, maintenance configuration, and credential status. * * @example * ```ts * const basinCatalog = await client.basinCatalog.get( * 'my-data-bucket', * { account_id: '0123456789abcdef0123456789abcdef' }, * ); * ``` */ get(bucketName, params, options) { const { account_id } = params; return this._client.get(path `/accounts/${account_id}/basin-catalog/${bucketName}`, options)._thenUnwrap((obj) => obj.result); } } BaseBasinCatalog._key = Object.freeze(['basinCatalog']); return BaseBasinCatalog; })(); export var BasinCatalog = /* @__PURE__ */ (() => { class BasinCatalog extends BaseBasinCatalog { constructor() { super(...arguments); this.maintenanceConfigs = new MaintenanceConfigsAPI.MaintenanceConfigs(this._client); this.credentials = new CredentialsAPI.Credentials(this._client); this.namespaces = new NamespacesAPI.Namespaces(this._client); } } BasinCatalog.MaintenanceConfigs = MaintenanceConfigs; BasinCatalog.BaseMaintenanceConfigs = BaseMaintenanceConfigs; BasinCatalog.Credentials = Credentials; BasinCatalog.BaseCredentials = BaseCredentials; BasinCatalog.Namespaces = Namespaces; BasinCatalog.BaseNamespaces = BaseNamespaces; return BasinCatalog; })(); //# sourceMappingURL=basin-catalog.mjs.map