cloudflare
Version:
The official TypeScript library for the Cloudflare API
105 lines • 3.83 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../core/resource.mjs";
import { path } from "../../internal/utils/path.mjs";
export var BaseEndpointHealthchecks = /* @__PURE__ */ (() => {
class BaseEndpointHealthchecks extends APIResource {
/**
* Create Endpoint Health Check.
*
* @example
* ```ts
* const endpointHealthcheck =
* await client.diagnostics.endpointHealthchecks.create({
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* check_type: 'icmp',
* endpoint: '203.0.113.1',
* });
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post(path `/accounts/${account_id}/diagnostics/endpoint-healthchecks`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Update a Endpoint Health Check.
*
* @example
* ```ts
* const endpointHealthcheck =
* await client.diagnostics.endpointHealthchecks.update(
* 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415',
* {
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* check_type: 'icmp',
* endpoint: '203.0.113.1',
* },
* );
* ```
*/
update(id, params, options) {
const { account_id, ...body } = params;
return this._client.put(path `/accounts/${account_id}/diagnostics/endpoint-healthchecks/${id}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* List Endpoint Health Checks.
*
* @example
* ```ts
* const endpointHealthchecks =
* await client.diagnostics.endpointHealthchecks.list({
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
list(params, options) {
const { account_id } = params;
return this._client.get(path `/accounts/${account_id}/diagnostics/endpoint-healthchecks`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Delete Endpoint Health Check.
*
* @example
* ```ts
* const endpointHealthcheck =
* await client.diagnostics.endpointHealthchecks.delete(
* 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
delete(id, params, options) {
const { account_id } = params;
return this._client.delete(path `/accounts/${account_id}/diagnostics/endpoint-healthchecks/${id}`, options);
}
/**
* Get a single Endpoint Health Check.
*
* @example
* ```ts
* const endpointHealthcheck =
* await client.diagnostics.endpointHealthchecks.get(
* 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
get(id, params, options) {
const { account_id } = params;
return this._client.get(path `/accounts/${account_id}/diagnostics/endpoint-healthchecks/${id}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseEndpointHealthchecks._key = Object.freeze([
'diagnostics',
'endpointHealthchecks',
]);
return BaseEndpointHealthchecks;
})();
export class EndpointHealthchecks extends BaseEndpointHealthchecks {
}
//# sourceMappingURL=endpoint-healthchecks.mjs.map