UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

50 lines • 2.09 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../core/resource.mjs"; import { CloudflareError } from "../../../core/error.mjs"; import { path } from "../../../internal/utils/path.mjs"; export var BaseClassification = /* @__PURE__ */ (() => { class BaseClassification extends APIResource { /** * Updates the user classification for a Security Center insight. Valid values are * 'false_positive' or 'accept_risk'. To reset, set classification to null. Cannot * change directly between classification values - must reset to null first. * * @example * ```ts * const classification = * await client.securityCenter.insights.classification.update( * 'issue_id', * { account_id: 'account_id' }, * ); * ``` */ update(issueID, params, options) { const { account_id, zone_id, ...body } = params; if (!account_id && !zone_id) { throw new CloudflareError('You must provide either account_id or zone_id.'); } if (account_id && zone_id) { throw new CloudflareError('You cannot provide both account_id and zone_id.'); } const { accountOrZone, accountOrZoneId } = account_id ? { accountOrZone: 'accounts', accountOrZoneId: account_id, } : { accountOrZone: 'zones', accountOrZoneId: zone_id, }; return this._client.patch(path `/${accountOrZone}/${accountOrZoneId}/security-center/insights/${issueID}/classification`, { body, ...options }); } } BaseClassification._key = Object.freeze([ 'securityCenter', 'insights', 'classification', ]); return BaseClassification; })(); export class Classification extends BaseClassification { } //# sourceMappingURL=classification.mjs.map