UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

99 lines • 3.92 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Registries = exports.BaseRegistries = 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 CredentialsAPI = tslib_1.__importStar(require("./credentials.js")); const credentials_1 = require("./credentials.js"); const pagination_1 = require("../../../core/pagination.js"); const path_1 = require("../../../internal/utils/path.js"); var BaseRegistries = /* @__PURE__ */ (() => { class BaseRegistries extends resource_1.APIResource { /** * Registers credentials for a supported private external image registry so * Containers can pull images from it. This endpoint does not create a registry or * upload an image. Public Docker Hub images and images in the Cloudflare managed * registry do not require this configuration. * * Refer to * [Image management](https://developers.cloudflare.com/containers/platform-details/image-management/) * for supported registries and instructions for storing registry credentials. * * @example * ```ts * const registry = await client.containers.registries.create({ * account_id: 'account-123', * auth: { * private_credential: { * secret_name: 'API_KEY', * store_id: '14758f1afd44c09b7992073ccf00b43d', * }, * public_credential: 'example-user', * }, * domain: 'docker.io', * kind: 'ECR', * }); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post((0, path_1.path) `/accounts/${account_id}/containers/registries`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Get the list of configured registries in the account. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const registryListResponse of client.containers.registries.list( * { account_id: 'account-123' }, * )) { * // ... * } * ``` */ list(params, options) { const { account_id } = params; return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/containers/registries`, (pagination_1.SinglePage), options); } /** * Delete a registry from the account, this will prevent Containers from pulling * images from the registry. * * @example * ```ts * const registry = await client.containers.registries.delete( * 'domain', * { account_id: 'account-123' }, * ); * ``` */ delete(domain, params, options) { const { account_id } = params; return this._client.delete((0, path_1.path) `/accounts/${account_id}/containers/registries/${domain}`, options)._thenUnwrap((obj) => obj.result); } } BaseRegistries._key = Object.freeze([ 'containers', 'registries', ]); return BaseRegistries; })(); exports.BaseRegistries = BaseRegistries; var Registries = /* @__PURE__ */ (() => { class Registries extends BaseRegistries { constructor() { super(...arguments); this.credentials = new CredentialsAPI.Credentials(this._client); } } Registries.Credentials = credentials_1.Credentials; Registries.BaseCredentials = credentials_1.BaseCredentials; return Registries; })(); exports.Registries = Registries; //# sourceMappingURL=registries.js.map