UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

74 lines 2.82 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from 'cloudflare/resource'; import { isRequestOptions } from 'cloudflare/core'; import * as PoolsAPI from 'cloudflare/resources/user/load-balancers/pools'; import { SinglePage } from 'cloudflare/pagination'; export class Pools extends APIResource { /** * Create a new pool. */ create(body, options) { return this._client.post('/user/load_balancers/pools', { body, ...options })._thenUnwrap((obj) => obj.result); } /** * Modify a configured pool. */ update(poolId, body, options) { return this._client.put(`/user/load_balancers/pools/${poolId}`, { body, ...options })._thenUnwrap((obj) => obj.result); } list(query = {}, options) { if (isRequestOptions(query)) { return this.list({}, query); } return this._client.getAPIList('/user/load_balancers/pools', LoadBalancingPoolsSinglePage, { query, ...options, }); } /** * Delete a configured pool. */ delete(poolId, options) { return this._client.delete(`/user/load_balancers/pools/${poolId}`, options)._thenUnwrap((obj) => obj.result); } /** * Apply changes to an existing pool, overwriting the supplied properties. */ edit(poolId, body, options) { return this._client.patch(`/user/load_balancers/pools/${poolId}`, { body, ...options })._thenUnwrap((obj) => obj.result); } /** * Fetch a single configured pool. */ get(poolId, options) { return this._client.get(`/user/load_balancers/pools/${poolId}`, options)._thenUnwrap((obj) => obj.result); } /** * Fetch the latest pool health status for a single pool. */ health(poolId, options) { return this._client.get(`/user/load_balancers/pools/${poolId}/health`, options)._thenUnwrap((obj) => obj.result); } /** * Preview pool health using provided monitor details. The returned preview_id can * be used in the preview endpoint to retrieve the results. */ preview(poolId, body, options) { return this._client.post(`/user/load_balancers/pools/${poolId}/preview`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Get the list of resources that reference the provided pool. */ references(poolId, options) { return this._client.get(`/user/load_balancers/pools/${poolId}/references`, options)._thenUnwrap((obj) => obj.result); } } export class LoadBalancingPoolsSinglePage extends SinglePage { } (function (Pools) { Pools.LoadBalancingPoolsSinglePage = PoolsAPI.LoadBalancingPoolsSinglePage; })(Pools || (Pools = {})); //# sourceMappingURL=pools.mjs.map