cloudflare
Version:
The official TypeScript library for the Cloudflare API
55 lines • 2.33 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Classification = exports.BaseClassification = void 0;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../../core/resource.js");
const error_1 = require("../../../core/error.js");
const path_1 = require("../../../internal/utils/path.js");
var BaseClassification = /* @__PURE__ */ (() => {
class BaseClassification extends resource_1.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 error_1.CloudflareError('You must provide either account_id or zone_id.');
}
if (account_id && zone_id) {
throw new error_1.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((0, path_1.path) `/${accountOrZone}/${accountOrZoneId}/security-center/insights/${issueID}/classification`, { body, ...options });
}
}
BaseClassification._key = Object.freeze([
'securityCenter',
'insights',
'classification',
]);
return BaseClassification;
})();
exports.BaseClassification = BaseClassification;
class Classification extends BaseClassification {
}
exports.Classification = Classification;
//# sourceMappingURL=classification.js.map