cloudflare
Version:
The official TypeScript library for the Cloudflare API
69 lines • 2.62 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from 'cloudflare/resource';
import * as HealthAPI from 'cloudflare/resources/load-balancers/pools/health';
import * as ReferencesAPI from 'cloudflare/resources/load-balancers/pools/references';
import { LoadBalancingPoolsSinglePage } from 'cloudflare/resources/user/load-balancers/pools';
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`, LoadBalancingPoolsSinglePage, { 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);
}
}
(function (Pools) {
Pools.Health = HealthAPI.Health;
Pools.References = ReferencesAPI.References;
})(Pools || (Pools = {}));
export { LoadBalancingPoolsSinglePage };
//# sourceMappingURL=pools.mjs.map