cloudflare
Version:
The official TypeScript library for the Cloudflare API
70 lines • 3.04 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.LeakedCredentialChecks = exports.BaseLeakedCredentialChecks = void 0;
const tslib_1 = require("../../internal/tslib.js");
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../core/resource.js");
const DetectionsAPI = tslib_1.__importStar(require("./detections.js"));
const detections_1 = require("./detections.js");
const path_1 = require("../../internal/utils/path.js");
var BaseLeakedCredentialChecks = /* @__PURE__ */ (() => {
class BaseLeakedCredentialChecks extends resource_1.APIResource {
/**
* Update the Leaked Credential Checks status for the zone, enabling or disabling
* the detection. While enabled, the detection populates the
* `cf.waf.credential_check.*` fields, which you can reference in custom rules and
* rate limiting rules to challenge or block requests carrying compromised
* credentials.
*
* @example
* ```ts
* const leakedCredentialCheck =
* await client.leakedCredentialChecks.create({
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
create(params, options) {
const { zone_id, ...body } = params;
return this._client.post((0, path_1.path) `/zones/${zone_id}/leaked-credential-checks`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Get the current Leaked Credential Checks status for the zone. While enabled,
* Cloudflare scans incoming requests for usernames and passwords that were exposed
* in known data breaches.
*
* @example
* ```ts
* const leakedCredentialCheck =
* await client.leakedCredentialChecks.get({
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
get(params, options) {
const { zone_id } = params;
return this._client.get((0, path_1.path) `/zones/${zone_id}/leaked-credential-checks`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseLeakedCredentialChecks._key = Object.freeze([
'leakedCredentialChecks',
]);
return BaseLeakedCredentialChecks;
})();
exports.BaseLeakedCredentialChecks = BaseLeakedCredentialChecks;
var LeakedCredentialChecks = /* @__PURE__ */ (() => {
class LeakedCredentialChecks extends BaseLeakedCredentialChecks {
constructor() {
super(...arguments);
this.detections = new DetectionsAPI.Detections(this._client);
}
}
LeakedCredentialChecks.Detections = detections_1.Detections;
LeakedCredentialChecks.BaseDetections = detections_1.BaseDetections;
return LeakedCredentialChecks;
})();
exports.LeakedCredentialChecks = LeakedCredentialChecks;
//# sourceMappingURL=leaked-credential-checks.js.map