UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

123 lines • 4.61 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../../core/resource.mjs"; import * as ReferencesAPI from "./references.mjs"; import { BaseReferences, References } from "./references.mjs"; import { SinglePage } from "../../../../core/pagination.mjs"; import { path } from "../../../../internal/utils/path.mjs"; export var BaseIntegrations = /* @__PURE__ */ (() => { class BaseIntegrations extends 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(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(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(path `/accounts/${account_id}/zt_risk_scoring/integrations`, (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(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(path `/accounts/${account_id}/zt_risk_scoring/integrations/${integrationID}`, options)._thenUnwrap((obj) => obj.result); } } BaseIntegrations._key = Object.freeze([ 'zeroTrust', 'riskScoring', 'integrations', ]); return BaseIntegrations; })(); export var Integrations = /* @__PURE__ */ (() => { class Integrations extends BaseIntegrations { constructor() { super(...arguments); this.references = new ReferencesAPI.References(this._client); } } Integrations.References = References; Integrations.BaseReferences = BaseReferences; return Integrations; })(); //# sourceMappingURL=integrations.mjs.map