UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

93 lines • 3.58 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 { SinglePage } from "../../../core/pagination.mjs"; import { path } from "../../../internal/utils/path.mjs"; export var BaseRegistries = /* @__PURE__ */ (() => { class BaseRegistries extends 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(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(path `/accounts/${account_id}/containers/registries`, (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(path `/accounts/${account_id}/containers/registries/${domain}`, options)._thenUnwrap((obj) => obj.result); } } BaseRegistries._key = Object.freeze([ 'containers', 'registries', ]); return BaseRegistries; })(); export var Registries = /* @__PURE__ */ (() => { class Registries extends BaseRegistries { constructor() { super(...arguments); this.credentials = new CredentialsAPI.Credentials(this._client); } } Registries.Credentials = Credentials; Registries.BaseCredentials = BaseCredentials; return Registries; })(); //# sourceMappingURL=registries.mjs.map