cloudflare
Version:
The official TypeScript library for the Cloudflare API
70 lines • 2.67 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from 'cloudflare/resource';
import * as MonitorsAPI from 'cloudflare/resources/user/load-balancers/monitors';
import { SinglePage } from 'cloudflare/pagination';
export class Monitors extends APIResource {
/**
* Create a configured monitor.
*/
create(body, options) {
return this._client.post('/user/load_balancers/monitors', { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Modify a configured monitor.
*/
update(monitorId, body, options) {
return this._client.put(`/user/load_balancers/monitors/${monitorId}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* List configured monitors for a user.
*/
list(options) {
return this._client.getAPIList('/user/load_balancers/monitors', LoadBalancingMonitorsSinglePage, options);
}
/**
* Delete a configured monitor.
*/
delete(monitorId, options) {
return this._client.delete(`/user/load_balancers/monitors/${monitorId}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Apply changes to an existing monitor, overwriting the supplied properties.
*/
edit(monitorId, body, options) {
return this._client.patch(`/user/load_balancers/monitors/${monitorId}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* List a single configured monitor for a user.
*/
get(monitorId, options) {
return this._client.get(`/user/load_balancers/monitors/${monitorId}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Preview pools using the specified monitor with provided monitor details. The
* returned preview_id can be used in the preview endpoint to retrieve the results.
*/
preview(monitorId, body, options) {
return this._client.post(`/user/load_balancers/monitors/${monitorId}/preview`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Get the list of resources that reference the provided monitor.
*/
references(monitorId, options) {
return this._client.get(`/user/load_balancers/monitors/${monitorId}/references`, options)._thenUnwrap((obj) => obj.result);
}
}
export class LoadBalancingMonitorsSinglePage extends SinglePage {
}
(function (Monitors) {
Monitors.LoadBalancingMonitorsSinglePage = MonitorsAPI.LoadBalancingMonitorsSinglePage;
})(Monitors || (Monitors = {}));
//# sourceMappingURL=monitors.mjs.map