|
| 1 | +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
| 2 | + |
| 3 | +import { APIResource } from '../../core/resource'; |
| 4 | +import { APIPromise } from '../../core/api-promise'; |
| 5 | +import { RequestOptions } from '../../internal/request-options'; |
| 6 | +import { path } from '../../internal/utils/path'; |
| 7 | + |
| 8 | +/** |
| 9 | + * Create and manage projects for resource isolation within an organization. |
| 10 | + */ |
| 11 | +export class Limits extends APIResource { |
| 12 | + /** |
| 13 | + * Get the resource limit overrides for a project. Null values mean no |
| 14 | + * project-level cap (org limit applies). |
| 15 | + * |
| 16 | + * @example |
| 17 | + * ```ts |
| 18 | + * const projectLimits = await client.projects.limits.retrieve( |
| 19 | + * 'id', |
| 20 | + * ); |
| 21 | + * ``` |
| 22 | + */ |
| 23 | + retrieve(id: string, options?: RequestOptions): APIPromise<ProjectLimits> { |
| 24 | + return this._client.get(path`/projects/${id}/limits`, options); |
| 25 | + } |
| 26 | + |
| 27 | + /** |
| 28 | + * Update resource limit overrides for a project. Only fields present in the |
| 29 | + * request are modified. Set a field to 0 to remove that limit cap; omit a field to |
| 30 | + * leave it unchanged. |
| 31 | + * |
| 32 | + * @example |
| 33 | + * ```ts |
| 34 | + * const projectLimits = await client.projects.limits.update( |
| 35 | + * 'id', |
| 36 | + * ); |
| 37 | + * ``` |
| 38 | + */ |
| 39 | + update(id: string, body: LimitUpdateParams, options?: RequestOptions): APIPromise<ProjectLimits> { |
| 40 | + return this._client.patch(path`/projects/${id}/limits`, { body, ...options }); |
| 41 | + } |
| 42 | +} |
| 43 | + |
| 44 | +export interface ProjectLimits { |
| 45 | + /** |
| 46 | + * Maximum concurrent app invocations for this project. Null means no project-level |
| 47 | + * cap. |
| 48 | + */ |
| 49 | + max_concurrent_invocations?: number | null; |
| 50 | + |
| 51 | + /** |
| 52 | + * Maximum concurrent browser sessions for this project. Null means no |
| 53 | + * project-level cap. |
| 54 | + */ |
| 55 | + max_concurrent_sessions?: number | null; |
| 56 | + |
| 57 | + /** |
| 58 | + * Maximum persistent browser sessions for this project. Null means no |
| 59 | + * project-level cap. |
| 60 | + */ |
| 61 | + max_persistent_sessions?: number | null; |
| 62 | + |
| 63 | + /** |
| 64 | + * Maximum pooled sessions capacity for this project. Null means no project-level |
| 65 | + * cap. |
| 66 | + */ |
| 67 | + max_pooled_sessions?: number | null; |
| 68 | +} |
| 69 | + |
| 70 | +export interface UpdateProjectLimitsRequest { |
| 71 | + /** |
| 72 | + * Maximum concurrent app invocations for this project. Set to 0 to remove the cap; |
| 73 | + * omit to leave unchanged. |
| 74 | + */ |
| 75 | + max_concurrent_invocations?: number | null; |
| 76 | + |
| 77 | + /** |
| 78 | + * Maximum concurrent browser sessions for this project. Set to 0 to remove the |
| 79 | + * cap; omit to leave unchanged. |
| 80 | + */ |
| 81 | + max_concurrent_sessions?: number | null; |
| 82 | + |
| 83 | + /** |
| 84 | + * Maximum persistent browser sessions for this project. Set to 0 to remove the |
| 85 | + * cap; omit to leave unchanged. |
| 86 | + */ |
| 87 | + max_persistent_sessions?: number | null; |
| 88 | + |
| 89 | + /** |
| 90 | + * Maximum pooled sessions capacity for this project. Set to 0 to remove the cap; |
| 91 | + * omit to leave unchanged. |
| 92 | + */ |
| 93 | + max_pooled_sessions?: number | null; |
| 94 | +} |
| 95 | + |
| 96 | +export interface LimitUpdateParams { |
| 97 | + /** |
| 98 | + * Maximum concurrent app invocations for this project. Set to 0 to remove the cap; |
| 99 | + * omit to leave unchanged. |
| 100 | + */ |
| 101 | + max_concurrent_invocations?: number | null; |
| 102 | + |
| 103 | + /** |
| 104 | + * Maximum concurrent browser sessions for this project. Set to 0 to remove the |
| 105 | + * cap; omit to leave unchanged. |
| 106 | + */ |
| 107 | + max_concurrent_sessions?: number | null; |
| 108 | + |
| 109 | + /** |
| 110 | + * Maximum persistent browser sessions for this project. Set to 0 to remove the |
| 111 | + * cap; omit to leave unchanged. |
| 112 | + */ |
| 113 | + max_persistent_sessions?: number | null; |
| 114 | + |
| 115 | + /** |
| 116 | + * Maximum pooled sessions capacity for this project. Set to 0 to remove the cap; |
| 117 | + * omit to leave unchanged. |
| 118 | + */ |
| 119 | + max_pooled_sessions?: number | null; |
| 120 | +} |
| 121 | + |
| 122 | +export declare namespace Limits { |
| 123 | + export { |
| 124 | + type ProjectLimits as ProjectLimits, |
| 125 | + type UpdateProjectLimitsRequest as UpdateProjectLimitsRequest, |
| 126 | + type LimitUpdateParams as LimitUpdateParams, |
| 127 | + }; |
| 128 | +} |
0 commit comments