UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

56 lines • 2.31 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../core/resource.mjs"; import { V4PagePaginationArray } from "../../core/pagination.mjs"; import { buildHeaders } from "../../internal/headers.mjs"; import { path } from "../../internal/utils/path.mjs"; export var BaseResources = /* @__PURE__ */ (() => { class BaseResources extends APIResource { /** * List resources in the Resource Catalog (Closed Beta). */ list(params, options) { const { account_id, ...query } = params; return this._client.getAPIList(path `/accounts/${account_id}/magic/cloud/resources`, (V4PagePaginationArray), { query, ...options }); } /** * Export resources in the Resource Catalog as a JSON file (Closed Beta). */ export(params, options) { const { account_id, ...query } = params; return this._client.get(path `/accounts/${account_id}/magic/cloud/resources/export`, { query, ...options, headers: buildHeaders([{ Accept: 'application/octet-stream' }, options?.headers]), __binaryResponse: true, }); } /** * Read an resource from the Resource Catalog (Closed Beta). */ get(resourceID, params, options) { const { account_id, ...query } = params; return this._client.get(path `/accounts/${account_id}/magic/cloud/resources/${resourceID}`, { query, ...options, })._thenUnwrap((obj) => obj.result); } /** * Preview Rego query result against the latest resource catalog (Closed Beta). */ policyPreview(params, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/magic/cloud/resources/policy-preview`, { body, ...options, })._thenUnwrap((obj) => obj.result); } } BaseResources._key = Object.freeze([ 'magicCloudNetworking', 'resources', ]); return BaseResources; })(); export class Resources extends BaseResources { } //# sourceMappingURL=resources.mjs.map