cloudflare
Version:
The official TypeScript library for the Cloudflare API
94 lines • 3.4 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Config = exports.BaseConfig = void 0;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../../core/resource.js");
const pagination_1 = require("../../../core/pagination.js");
const path_1 = require("../../../internal/utils/path.js");
var BaseConfig = /* @__PURE__ */ (() => {
class BaseConfig extends resource_1.APIResource {
/**
* Creates a new scan configuration for Cloudforce One's network scanning service.
*
* @example
* ```ts
* const config =
* await client.cloudforceOne.scans.config.create({
* account_id: 'account_id',
* ips: ['1.1.1.1', '2606:4700:4700::1111'],
* });
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/cloudforce-one/scans/config`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Lists scan configurations for Cloudforce One's network scanning service.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const configListResponse of client.cloudforceOne.scans.config.list(
* { account_id: 'account_id' },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { account_id } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/cloudforce-one/scans/config`, (pagination_1.SinglePage), options);
}
/**
* Deletes a scan configuration from Cloudforce One's network scanning service.
*
* @example
* ```ts
* const config =
* await client.cloudforceOne.scans.config.delete(
* 'config_id',
* { account_id: 'account_id' },
* );
* ```
*/
delete(configID, params, options) {
const { account_id } = params;
return this._client.delete((0, path_1.path) `/accounts/${account_id}/cloudforce-one/scans/config/${configID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Updates an existing scan configuration in Cloudforce One's network scanning
* service.
*
* @example
* ```ts
* const response =
* await client.cloudforceOne.scans.config.edit(
* 'config_id',
* { account_id: 'account_id' },
* );
* ```
*/
edit(configID, params, options) {
const { account_id, ...body } = params;
return this._client.patch((0, path_1.path) `/accounts/${account_id}/cloudforce-one/scans/config/${configID}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
}
BaseConfig._key = Object.freeze([
'cloudforceOne',
'scans',
'config',
]);
return BaseConfig;
})();
exports.BaseConfig = BaseConfig;
class Config extends BaseConfig {
}
exports.Config = Config;
//# sourceMappingURL=config.js.map