// File generated from our OpenAPI spec by Stainless.
import { APIResource } from 'cloudflare/resource';
import { isRequestOptions } from 'cloudflare/core';
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.get('/user/load_balancers/pools', { query, ...options })._thenUnwrap((obj) => obj.result);
    }
    /**
     * 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);
    }
}
(function (Pools) {
})(Pools || (Pools = {}));
//# sourceMappingURL=pools.mjs.map