cloudflare
Version:
The official TypeScript library for the Cloudflare API
125 lines • 5.09 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContentScanning = exports.BaseContentScanning = 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 PayloadsAPI = tslib_1.__importStar(require("./payloads.js"));
const payloads_1 = require("./payloads.js");
const SettingsAPI = tslib_1.__importStar(require("./settings.js"));
const settings_1 = require("./settings.js");
const path_1 = require("../../internal/utils/path.js");
var BaseContentScanning = /* @__PURE__ */ (() => {
class BaseContentScanning extends resource_1.APIResource {
/**
* Update the Content Scanning status by setting the status value to `enabled` or
* `disabled`. This is equivalent to calling the dedicated enable and disable
* endpoints.
*
* @example
* ```ts
* const contentScanning = await client.contentScanning.create(
* {
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* value: 'enabled',
* },
* );
* ```
*/
create(params, options) {
const { zone_id, ...body } = params;
return this._client.put((0, path_1.path) `/zones/${zone_id}/content-upload-scan/settings`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Update the Content Scanning status by setting the status value to `enabled` or
* `disabled`. This is equivalent to calling the dedicated enable and disable
* endpoints.
*
* @example
* ```ts
* const contentScanning = await client.contentScanning.update(
* {
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* value: 'enabled',
* },
* );
* ```
*/
update(params, options) {
const { zone_id, ...body } = params;
return this._client.put((0, path_1.path) `/zones/${zone_id}/content-upload-scan/settings`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Disable Content Scanning for a zone. The `cf.waf.content_scan.*` fields are no
* longer populated, so rules that reference them stop matching.
*
* @example
* ```ts
* const response = await client.contentScanning.disable({
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
disable(params, options) {
const { zone_id } = params;
return this._client.post((0, path_1.path) `/zones/${zone_id}/content-upload-scan/disable`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Enable Content Scanning for a zone, so that Cloudflare inspects content objects
* uploaded to the zone and checks them for malware. Scan results populate the
* `cf.waf.content_scan.*` fields, which you can reference in custom rules and rate
* limiting rules.
*
* @example
* ```ts
* const response = await client.contentScanning.enable({
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
enable(params, options) {
const { zone_id } = params;
return this._client.post((0, path_1.path) `/zones/${zone_id}/content-upload-scan/enable`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Get the current Content Scanning status for the zone, together with the date the
* status was last modified.
*
* @example
* ```ts
* const contentScanning = await client.contentScanning.get({
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
get(params, options) {
const { zone_id } = params;
return this._client.get((0, path_1.path) `/zones/${zone_id}/content-upload-scan/settings`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseContentScanning._key = Object.freeze(['contentScanning']);
return BaseContentScanning;
})();
exports.BaseContentScanning = BaseContentScanning;
var ContentScanning = /* @__PURE__ */ (() => {
class ContentScanning extends BaseContentScanning {
constructor() {
super(...arguments);
this.payloads = new PayloadsAPI.Payloads(this._client);
this.settings = new SettingsAPI.Settings(this._client);
}
}
ContentScanning.Payloads = payloads_1.Payloads;
ContentScanning.BasePayloads = payloads_1.BasePayloads;
ContentScanning.Settings = settings_1.Settings;
ContentScanning.BaseSettings = settings_1.BaseSettings;
return ContentScanning;
})();
exports.ContentScanning = ContentScanning;
//# sourceMappingURL=content-scanning.js.map