UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

88 lines • 3.62 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../core/resource.mjs"; import { path } from "../../../internal/utils/path.mjs"; export var BaseIdPFederationGrants = /* @__PURE__ */ (() => { class BaseIdPFederationGrants extends APIResource { /** * Creates an IdP federation grant for the specified identity provider, making it * available for federation to other accounts in the same Cloudflare organization. * * The account must belong to a Cloudflare organization. One-time pin and * Cloudflare-managed identity providers cannot be federated. An account can * federate at most five identity providers at a time. * * @example * ```ts * const IdPFederationGrant = * await client.zeroTrust.access.IdPFederationGrants.create({ * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * idp_id: 'a79de439-0e7f-4ebb-8a02-222222222222', * }); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/access/idp_federation_grants`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Lists the IdP federation grants owned by the account. * * @example * ```ts * const IdPFederationGrants = * await client.zeroTrust.access.IdPFederationGrants.list({ * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * }); * ``` */ list(params, options) { const { account_id } = params; return this._client.get(path `/accounts/${account_id}/access/idp_federation_grants`, options)._thenUnwrap((obj) => obj.result); } /** * Deletes an IdP federation grant. The identity provider remains in the account, * but it is no longer available for federation to other accounts. * * @example * ```ts * const IdPFederationGrant = * await client.zeroTrust.access.IdPFederationGrants.delete( * '023e105f4ecef8ad9ca31a8372d0c353', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ delete(grantID, params, options) { const { account_id } = params; return this._client.delete(path `/accounts/${account_id}/access/idp_federation_grants/${grantID}`, options)._thenUnwrap((obj) => obj.result); } /** * Retrieves a single IdP federation grant by its UID. * * @example * ```ts * const IdPFederationGrant = * await client.zeroTrust.access.IdPFederationGrants.get( * '023e105f4ecef8ad9ca31a8372d0c353', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ get(grantID, params, options) { const { account_id } = params; return this._client.get(path `/accounts/${account_id}/access/idp_federation_grants/${grantID}`, options)._thenUnwrap((obj) => obj.result); } } BaseIdPFederationGrants._key = Object.freeze([ 'zeroTrust', 'access', 'IdPFederationGrants', ]); return BaseIdPFederationGrants; })(); export class IdPFederationGrants extends BaseIdPFederationGrants { } //# sourceMappingURL=idp-federation-grants.mjs.map