// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from 'cloudflaredev/resource';
import * as PoolsAPI from 'cloudflaredev/resources/load-balancers/pools/pools';
import * as HealthAPI from 'cloudflaredev/resources/load-balancers/pools/health';
import * as ReferencesAPI from 'cloudflaredev/resources/load-balancers/pools/references';
import { SinglePage } from 'cloudflaredev/pagination';
export class Pools extends APIResource {
    constructor() {
        super(...arguments);
        this.health = new HealthAPI.Health(this._client);
        this.references = new ReferencesAPI.References(this._client);
    }
    /**
     * Create a new pool.
     */
    create(params, options) {
        const { account_id, ...body } = params;
        return this._client.post(`/accounts/${account_id}/load_balancers/pools`, {
            body,
            ...options,
        })._thenUnwrap((obj) => obj.result);
    }
    /**
     * Modify a configured pool.
     */
    update(poolId, params, options) {
        const { account_id, ...body } = params;
        return this._client.put(`/accounts/${account_id}/load_balancers/pools/${poolId}`, {
            body,
            ...options,
        })._thenUnwrap((obj) => obj.result);
    }
    /**
     * List configured pools.
     */
    list(params, options) {
        const { account_id, ...query } = params;
        return this._client.getAPIList(`/accounts/${account_id}/load_balancers/pools`, PoolsSinglePage, {
            query,
            ...options,
        });
    }
    /**
     * Delete a configured pool.
     */
    delete(poolId, params, options) {
        const { account_id } = params;
        return this._client.delete(`/accounts/${account_id}/load_balancers/pools/${poolId}`, options)._thenUnwrap((obj) => obj.result);
    }
    /**
     * Apply changes to an existing pool, overwriting the supplied properties.
     */
    edit(poolId, params, options) {
        const { account_id, ...body } = params;
        return this._client.patch(`/accounts/${account_id}/load_balancers/pools/${poolId}`, {
            body,
            ...options,
        })._thenUnwrap((obj) => obj.result);
    }
    /**
     * Fetch a single configured pool.
     */
    get(poolId, params, options) {
        const { account_id } = params;
        return this._client.get(`/accounts/${account_id}/load_balancers/pools/${poolId}`, options)._thenUnwrap((obj) => obj.result);
    }
}
export class PoolsSinglePage extends SinglePage {
}
(function (Pools) {
    Pools.PoolsSinglePage = PoolsAPI.PoolsSinglePage;
    Pools.Health = HealthAPI.Health;
    Pools.References = ReferencesAPI.References;
})(Pools || (Pools = {}));
//# sourceMappingURL=pools.mjs.map