cloudflare
Version:
The official TypeScript library for the Cloudflare API
119 lines • 4.69 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../core/resource.mjs";
import * as PayloadsAPI from "./payloads.mjs";
import { BasePayloads, Payloads, } from "./payloads.mjs";
import * as SettingsAPI from "./settings.mjs";
import { BaseSettings, Settings } from "./settings.mjs";
import { path } from "../../internal/utils/path.mjs";
export var BaseContentScanning = /* @__PURE__ */ (() => {
class BaseContentScanning extends 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(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(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(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(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(path `/zones/${zone_id}/content-upload-scan/settings`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseContentScanning._key = Object.freeze(['contentScanning']);
return BaseContentScanning;
})();
export 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;
ContentScanning.BasePayloads = BasePayloads;
ContentScanning.Settings = Settings;
ContentScanning.BaseSettings = BaseSettings;
return ContentScanning;
})();
//# sourceMappingURL=content-scanning.mjs.map