UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

115 lines • 4.4 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SSO = exports.BaseSSO = 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 BaseSSO = /* @__PURE__ */ (() => { class BaseSSO extends resource_1.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((0, path_1.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((0, path_1.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((0, path_1.path) `/accounts/${account_id}/sso_connectors`, (pagination_1.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((0, path_1.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((0, path_1.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((0, path_1.path) `/accounts/${account_id}/sso_connectors/${ssoConnectorID}`, options)._thenUnwrap((obj) => obj.result); } } BaseSSO._key = Object.freeze(['iam', 'sso']); return BaseSSO; })(); exports.BaseSSO = BaseSSO; class SSO extends BaseSSO { } exports.SSO = SSO; //# sourceMappingURL=sso.js.map