// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from 'cloudflaredev/resource';
import * as PreviewsAPI from 'cloudflaredev/resources/load-balancers/previews';
import * as RegionsAPI from 'cloudflaredev/resources/load-balancers/regions';
import * as SearchesAPI from 'cloudflaredev/resources/load-balancers/searches';
import * as MonitorsAPI from 'cloudflaredev/resources/load-balancers/monitors/monitors';
import * as PoolsAPI from 'cloudflaredev/resources/load-balancers/pools/pools';
import { SinglePage } from 'cloudflaredev/pagination';
export class LoadBalancers extends APIResource {
    constructor() {
        super(...arguments);
        this.monitors = new MonitorsAPI.Monitors(this._client);
        this.pools = new PoolsAPI.Pools(this._client);
        this.previews = new PreviewsAPI.Previews(this._client);
        this.regions = new RegionsAPI.Regions(this._client);
        this.searches = new SearchesAPI.Searches(this._client);
    }
    /**
     * Create a new load balancer.
     */
    create(params, options) {
        const { zone_id, ...body } = params;
        return this._client.post(`/zones/${zone_id}/load_balancers`, { body, ...options })._thenUnwrap((obj) => obj.result);
    }
    /**
     * Update a configured load balancer.
     */
    update(loadBalancerId, params, options) {
        const { zone_id, ...body } = params;
        return this._client.put(`/zones/${zone_id}/load_balancers/${loadBalancerId}`, {
            body,
            ...options,
        })._thenUnwrap((obj) => obj.result);
    }
    /**
     * List configured load balancers.
     */
    list(params, options) {
        const { zone_id } = params;
        return this._client.getAPIList(`/zones/${zone_id}/load_balancers`, LoadBalancersSinglePage, options);
    }
    /**
     * Delete a configured load balancer.
     */
    delete(loadBalancerId, params, options) {
        const { zone_id } = params;
        return this._client.delete(`/zones/${zone_id}/load_balancers/${loadBalancerId}`, options)._thenUnwrap((obj) => obj.result);
    }
    /**
     * Apply changes to an existing load balancer, overwriting the supplied properties.
     */
    edit(loadBalancerId, params, options) {
        const { zone_id, ...body } = params;
        return this._client.patch(`/zones/${zone_id}/load_balancers/${loadBalancerId}`, {
            body,
            ...options,
        })._thenUnwrap((obj) => obj.result);
    }
    /**
     * Fetch a single configured load balancer.
     */
    get(loadBalancerId, params, options) {
        const { zone_id } = params;
        return this._client.get(`/zones/${zone_id}/load_balancers/${loadBalancerId}`, options)._thenUnwrap((obj) => obj.result);
    }
}
export class LoadBalancersSinglePage extends SinglePage {
}
(function (LoadBalancers) {
    LoadBalancers.Monitors = MonitorsAPI.Monitors;
    LoadBalancers.MonitorsSinglePage = MonitorsAPI.MonitorsSinglePage;
    LoadBalancers.Pools = PoolsAPI.Pools;
    LoadBalancers.PoolsSinglePage = PoolsAPI.PoolsSinglePage;
    LoadBalancers.Previews = PreviewsAPI.Previews;
    LoadBalancers.Regions = RegionsAPI.Regions;
    LoadBalancers.Searches = SearchesAPI.Searches;
})(LoadBalancers || (LoadBalancers = {}));
//# sourceMappingURL=load-balancers.mjs.map