| 1 | import type * as ds from "@distilled.cloud/aws/directory-service"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | |
| 5 | /** |
| 6 | * Runtime binding for the `GetDirectoryLimits` operation (IAM action |
| 7 | * `ds:GetDirectoryLimits`). |
| 8 | * |
| 9 | * Reads the account's directory limits for the current region — how many |
| 10 | * cloud directories exist versus the allowed maximum — so an ops function |
| 11 | * can alert before directory creation starts failing. The action does not |
| 12 | * support resource-level permissions, so the grant is account-wide. Provide |
| 13 | * the implementation with |
| 14 | * `Effect.provide(AWS.DirectoryService.GetDirectoryLimitsHttp)`. |
| 15 | * ### Reading Account Limits |
| 16 | * **Example:** Alert When the Directory Limit Is Near |
| 17 | * ```typescript |
| 18 | * // init — request the account-level capability |
| 19 | * const getDirectoryLimits = yield* AWS.DirectoryService.GetDirectoryLimits(); |
| 20 | * |
| 21 | * // runtime |
| 22 | * const { DirectoryLimits } = yield* getDirectoryLimits(); |
| 23 | * if (DirectoryLimits?.CloudOnlyDirectoriesLimitReached) { |
| 24 | * yield* Effect.logWarning("directory limit reached"); |
| 25 | * } |
| 26 | * ``` |
| 27 | * |
| 28 | * @binding |
| 29 | */ |
| 30 | export interface GetDirectoryLimits extends Binding.Service< |
| 31 | GetDirectoryLimits, |
| 32 | "AWS.DirectoryService.GetDirectoryLimits", |
| 33 | () => Effect.Effect< |
| 34 | () => Effect.Effect<ds.GetDirectoryLimitsResult, ds.GetDirectoryLimitsError> |
| 35 | > |
| 36 | > {} |
| 37 | export const GetDirectoryLimits = Binding.Service<GetDirectoryLimits>( |
| 38 | "AWS.DirectoryService.GetDirectoryLimits", |
| 39 | ); |