cloudflare
Version:
The official TypeScript library for the Cloudflare API
102 lines • 4.13 kB
JavaScript
;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LoadBalancingPoolsSinglePage = exports.Pools = void 0;
const resource_1 = require("cloudflare/resource");
const core_1 = require("cloudflare/core");
const PoolsAPI = __importStar(require("cloudflare/resources/user/load-balancers/pools"));
const pagination_1 = require("cloudflare/pagination");
class Pools extends resource_1.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 ((0, core_1.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);
}
}
exports.Pools = Pools;
class LoadBalancingPoolsSinglePage extends pagination_1.SinglePage {
}
exports.LoadBalancingPoolsSinglePage = LoadBalancingPoolsSinglePage;
(function (Pools) {
Pools.LoadBalancingPoolsSinglePage = PoolsAPI.LoadBalancingPoolsSinglePage;
})(Pools = exports.Pools || (exports.Pools = {}));
//# sourceMappingURL=pools.js.map