/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 3e31b49d56c1 */ import { betaServiceAccountsCreate } from "../funcs/betaServiceAccountsCreate.js"; import { betaServiceAccountsDelete } from "../funcs/betaServiceAccountsDelete.js"; import { betaServiceAccountsGet } from "../funcs/betaServiceAccountsGet.js"; import { betaServiceAccountsList } from "../funcs/betaServiceAccountsList.js"; import { betaServiceAccountsListAssignableRoles } from "../funcs/betaServiceAccountsListAssignableRoles.js"; import { betaServiceAccountsListRoles } from "../funcs/betaServiceAccountsListRoles.js"; import { betaServiceAccountsSetRoles } from "../funcs/betaServiceAccountsSetRoles.js"; import { betaServiceAccountsUpdate } from "../funcs/betaServiceAccountsUpdate.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as components from "../models/components/index.js"; import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; import { PageIterator, unwrapResultIterator } from "../types/operations.js"; export class ServiceAccounts extends ClientSDK { /** * Create Service Account * * @remarks * Create a service account in a workspace. Requires the `create_service_account` permission. */ async create( request: components.CreateServiceAccountRequest, options?: RequestOptions, ): Promise { return unwrapAsync(betaServiceAccountsCreate( this, request, options, )); } /** * List Service Accounts * * @remarks * List the service accounts in a workspace, or across the organization. * * Scoped to a workspace, this requires the `see_all_workspace_service_accounts` * permission on it. Omitting the workspace lists the whole organization and requires * the organization-level `see_all_org_service_accounts` permission instead. */ async list( request: operations.ListServiceAccountsV1ServiceAccountsGetRequest, options?: RequestOptions, ): Promise< PageIterator< operations.ListServiceAccountsV1ServiceAccountsGetResponse, { offset: number } > > { return unwrapResultIterator(betaServiceAccountsList( this, request, options, )); } /** * List Assignable Service Account Roles * * @remarks * List the workspace roles that can be assigned to a service account. * * Requires the `see_all_workspace_service_accounts` permission. */ async listAssignableRoles( request: operations.ListAssignableServiceAccountRolesV1ServiceAccountsAssignableRolesGetRequest, options?: RequestOptions, ): Promise { return unwrapAsync(betaServiceAccountsListAssignableRoles( this, request, options, )); } /** * Get Service Account * * @remarks * Retrieve a service account. * * Requires the `see_all_workspace_service_accounts` permission. */ async get( request: operations.GetServiceAccountV1ServiceAccountsServiceAccountIdGetRequest, options?: RequestOptions, ): Promise { return unwrapAsync(betaServiceAccountsGet( this, request, options, )); } /** * Update Service Account * * @remarks * Update a service account. * * Requires the `manage_any_workspace_service_account` permission. */ async update( request: operations.UpdateServiceAccountV1ServiceAccountsServiceAccountIdPatchRequest, options?: RequestOptions, ): Promise { return unwrapAsync(betaServiceAccountsUpdate( this, request, options, )); } /** * Delete Service Account * * @remarks * Delete a service account. * * Requires the `manage_any_workspace_service_account` permission. */ async delete( request: operations.DeleteServiceAccountV1ServiceAccountsServiceAccountIdDeleteRequest, options?: RequestOptions, ): Promise { return unwrapAsync(betaServiceAccountsDelete( this, request, options, )); } /** * Set Service Account Roles * * @remarks * Replace the workspace roles assigned to a service account. * * Requires the `manage_any_workspace_service_account` permission. */ async setRoles( request: operations.SetServiceAccountRolesV1ServiceAccountsServiceAccountIdRolesPutRequest, options?: RequestOptions, ): Promise { return unwrapAsync(betaServiceAccountsSetRoles( this, request, options, )); } /** * List Service Account Roles * * @remarks * List the workspace roles assigned to a service account. * * Requires the `see_all_workspace_service_accounts` permission. */ async listRoles( request: operations.ListServiceAccountRolesV1ServiceAccountsServiceAccountIdRolesGetRequest, options?: RequestOptions, ): Promise { return unwrapAsync(betaServiceAccountsListRoles( this, request, options, )); } }