cloudflare
Version:
The official TypeScript library for the Cloudflare API
89 lines • 3.16 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../core/resource.mjs";
import { SinglePage } from "../../../core/pagination.mjs";
import { path } from "../../../internal/utils/path.mjs";
export var BaseConfig = /* @__PURE__ */ (() => {
class BaseConfig extends 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(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(path `/accounts/${account_id}/cloudforce-one/scans/config`, (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(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(path `/accounts/${account_id}/cloudforce-one/scans/config/${configID}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
}
BaseConfig._key = Object.freeze([
'cloudforceOne',
'scans',
'config',
]);
return BaseConfig;
})();
export class Config extends BaseConfig {
}
//# sourceMappingURL=config.mjs.map