cloudflare
Version:
The official TypeScript library for the Cloudflare API
85 lines • 3.33 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PagerdutyResource = exports.BasePagerdutyResource = void 0;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../../core/resource.js");
const pagination_1 = require("../../../core/pagination.js");
const path_1 = require("../../../internal/utils/path.js");
var BasePagerdutyResource = /* @__PURE__ */ (() => {
class BasePagerdutyResource extends resource_1.APIResource {
/**
* Creates a new token for integrating with PagerDuty.
*
* @example
* ```ts
* const pagerduty =
* await client.alerting.destinations.pagerduty.create({
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
create(params, options) {
const { account_id } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/alerting/v3/destinations/pagerduty/connect`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Deletes all the PagerDuty Services connected to the account.
*
* @example
* ```ts
* const pagerduty =
* await client.alerting.destinations.pagerduty.delete({
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
delete(params, options) {
const { account_id } = params;
return this._client.delete((0, path_1.path) `/accounts/${account_id}/alerting/v3/destinations/pagerduty`, options);
}
/**
* Get a list of all configured PagerDuty services.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const pagerduty of client.alerting.destinations.pagerduty.get(
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* )) {
* // ...
* }
* ```
*/
get(params, options) {
const { account_id } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/alerting/v3/destinations/pagerduty`, (pagination_1.SinglePage), options);
}
/**
* Links PagerDuty with the account using the integration token.
*
* @example
* ```ts
* const response =
* await client.alerting.destinations.pagerduty.link(
* '8c71e667571b4f61b94d9e4b12158038',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
link(tokenID, params, options) {
const { account_id } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/alerting/v3/destinations/pagerduty/connect/${tokenID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BasePagerdutyResource._key = Object.freeze([
'alerting',
'destinations',
'pagerduty',
]);
return BasePagerdutyResource;
})();
exports.BasePagerdutyResource = BasePagerdutyResource;
class PagerdutyResource extends BasePagerdutyResource {
}
exports.PagerdutyResource = PagerdutyResource;
//# sourceMappingURL=pagerduty.js.map