| 1 | import type * as grafana from "@distilled.cloud/aws/grafana"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Workspace } from "./Workspace.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for the `ListPermissions` operation (IAM action |
| 8 | * `grafana:ListPermissions`), scoped to one {@link Workspace}. |
| 9 | * |
| 10 | * Lists the IAM Identity Center users and groups granted the `ADMIN`, |
| 11 | * `EDITOR`, or `VIEWER` role in the workspace, optionally filtered by user |
| 12 | * or group id. Provide the implementation with |
| 13 | * `Effect.provide(AWS.Grafana.ListPermissionsHttp)`. |
| 14 | * ### Managing Permissions |
| 15 | * **Example:** List Workspace Role Assignments |
| 16 | * ```typescript |
| 17 | * const listPermissions = yield* Grafana.ListPermissions(workspace); |
| 18 | * |
| 19 | * const { permissions } = yield* listPermissions(); |
| 20 | * for (const entry of permissions) { |
| 21 | * yield* Effect.logInfo(`${entry.user.id} → ${entry.role}`); |
| 22 | * } |
| 23 | * ``` |
| 24 | * |
| 25 | * @binding |
| 26 | */ |
| 27 | export interface ListPermissions extends Binding.Service< |
| 28 | ListPermissions, |
| 29 | "AWS.Grafana.ListPermissions", |
| 30 | ( |
| 31 | workspace: Workspace, |
| 32 | ) => Effect.Effect< |
| 33 | ( |
| 34 | request?: Omit<grafana.ListPermissionsRequest, "workspaceId">, |
| 35 | ) => Effect.Effect< |
| 36 | grafana.ListPermissionsResponse, |
| 37 | grafana.ListPermissionsError |
| 38 | > |
| 39 | > |
| 40 | > {} |
| 41 | export const ListPermissions = Binding.Service<ListPermissions>( |
| 42 | "AWS.Grafana.ListPermissions", |
| 43 | ); |