UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

110 lines • 4.16 kB
// 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 BaseSSO = /* @__PURE__ */ (() => { class BaseSSO extends APIResource { /** * Creates a new SSO connector for logging into Cloudflare through an identity * provider. * * @example * ```ts * const sso = await client.iam.sso.create({ * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * email_domain: 'example.com', * }); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/sso_connectors`, { body, ...options })._thenUnwrap((obj) => obj.result); } /** * Updates the state or configuration of an SSO connector. * * @example * ```ts * const sso = await client.iam.sso.update( * '023e105f4ecef8ad9ca31a8372d0c353', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ update(ssoConnectorID, params, options) { const { account_id, ...body } = params; return this._client.patch(path `/accounts/${account_id}/sso_connectors/${ssoConnectorID}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Lists all SSO connectors configured for the account. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const ssoListResponse of client.iam.sso.list({ * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * })) { * // ... * } * ``` */ list(params, options) { const { account_id } = params; return this._client.getAPIList(path `/accounts/${account_id}/sso_connectors`, (SinglePage), options); } /** * Deletes an SSO connector from the account. * * @example * ```ts * const sso = await client.iam.sso.delete( * '023e105f4ecef8ad9ca31a8372d0c353', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ delete(ssoConnectorID, params, options) { const { account_id } = params; return this._client.delete(path `/accounts/${account_id}/sso_connectors/${ssoConnectorID}`, options)._thenUnwrap((obj) => obj.result); } /** * Validates the user has added the DNS TXT record required for validating * ownership of the domain they are trying to set up a connector for. * * @example * ```ts * const response = await client.iam.sso.beginVerification( * '023e105f4ecef8ad9ca31a8372d0c353', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ beginVerification(ssoConnectorID, params, options) { const { account_id } = params; return this._client.post(path `/accounts/${account_id}/sso_connectors/${ssoConnectorID}/begin_verification`, options); } /** * Retrieves details for a specific SSO connector. * * @example * ```ts * const sso = await client.iam.sso.get( * '023e105f4ecef8ad9ca31a8372d0c353', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ get(ssoConnectorID, params, options) { const { account_id } = params; return this._client.get(path `/accounts/${account_id}/sso_connectors/${ssoConnectorID}`, options)._thenUnwrap((obj) => obj.result); } } BaseSSO._key = Object.freeze(['iam', 'sso']); return BaseSSO; })(); export class SSO extends BaseSSO { } //# sourceMappingURL=sso.mjs.map