cloudflare
Version:
The official TypeScript library for the Cloudflare API
129 lines • 4.99 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Integrations = exports.BaseIntegrations = void 0;
const tslib_1 = require("../../../../internal/tslib.js");
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../../../core/resource.js");
const ReferencesAPI = tslib_1.__importStar(require("./references.js"));
const references_1 = require("./references.js");
const pagination_1 = require("../../../../core/pagination.js");
const path_1 = require("../../../../internal/utils/path.js");
var BaseIntegrations = /* @__PURE__ */ (() => {
class BaseIntegrations extends resource_1.APIResource {
/**
* Creates a new Zero Trust risk score integration, connecting external risk
* signals to Cloudflare's risk scoring system.
*
* @example
* ```ts
* const integration =
* await client.zeroTrust.riskScoring.integrations.create({
* account_id: 'account_id',
* integration_type: 'Okta',
* tenant_url: 'https://example.com',
* });
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/zt_risk_scoring/integrations`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Overwrite the reference_id, tenant_url, and active values with the ones
* provided.
*
* @example
* ```ts
* const integration =
* await client.zeroTrust.riskScoring.integrations.update(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* {
* account_id: 'account_id',
* active: true,
* tenant_url: 'https://example.com',
* },
* );
* ```
*/
update(integrationID, params, options) {
const { account_id, ...body } = params;
return this._client.put((0, path_1.path) `/accounts/${account_id}/zt_risk_scoring/integrations/${integrationID}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Lists all configured Zero Trust risk score integrations for the account.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const integrationListResponse of client.zeroTrust.riskScoring.integrations.list(
* { account_id: 'account_id' },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { account_id } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/zt_risk_scoring/integrations`, (pagination_1.SinglePage), options);
}
/**
* Removes a Zero Trust risk score integration, disconnecting the external risk
* signal source.
*
* @example
* ```ts
* const integration =
* await client.zeroTrust.riskScoring.integrations.delete(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* { account_id: 'account_id' },
* );
* ```
*/
delete(integrationID, params, options) {
const { account_id } = params;
return this._client.delete((0, path_1.path) `/accounts/${account_id}/zt_risk_scoring/integrations/${integrationID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Gets a Zero Trust risk score integration by ID.
*
* @example
* ```ts
* const integration =
* await client.zeroTrust.riskScoring.integrations.get(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* { account_id: 'account_id' },
* );
* ```
*/
get(integrationID, params, options) {
const { account_id } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/zt_risk_scoring/integrations/${integrationID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseIntegrations._key = Object.freeze([
'zeroTrust',
'riskScoring',
'integrations',
]);
return BaseIntegrations;
})();
exports.BaseIntegrations = BaseIntegrations;
var Integrations = /* @__PURE__ */ (() => {
class Integrations extends BaseIntegrations {
constructor() {
super(...arguments);
this.references = new ReferencesAPI.References(this._client);
}
}
Integrations.References = references_1.References;
Integrations.BaseReferences = references_1.BaseReferences;
return Integrations;
})();
exports.Integrations = Integrations;
//# sourceMappingURL=integrations.js.map