| 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 `ListWorkspaceServiceAccountTokens` operation |
| 8 | * (IAM action `grafana:ListWorkspaceServiceAccountTokens`), scoped to one |
| 9 | * {@link Workspace}. |
| 10 | * |
| 11 | * Lists the API tokens of a Grafana service account (metadata only — the |
| 12 | * secret key is only returned at mint time). Provide the implementation with |
| 13 | * `Effect.provide(AWS.Grafana.ListWorkspaceServiceAccountTokensHttp)`. |
| 14 | * ### Managing Service Accounts |
| 15 | * **Example:** Find Expired Tokens to Revoke |
| 16 | * ```typescript |
| 17 | * const listTokens = |
| 18 | * yield* Grafana.ListWorkspaceServiceAccountTokens(workspace); |
| 19 | * |
| 20 | * const { serviceAccountTokens } = yield* listTokens({ |
| 21 | * serviceAccountId: account.id, |
| 22 | * }); |
| 23 | * const expired = serviceAccountTokens.filter( |
| 24 | * (token) => token.expiresAt.getTime() < Date.now(), |
| 25 | * ); |
| 26 | * ``` |
| 27 | * |
| 28 | * @binding |
| 29 | */ |
| 30 | export interface ListWorkspaceServiceAccountTokens extends Binding.Service< |
| 31 | ListWorkspaceServiceAccountTokens, |
| 32 | "AWS.Grafana.ListWorkspaceServiceAccountTokens", |
| 33 | ( |
| 34 | workspace: Workspace, |
| 35 | ) => Effect.Effect< |
| 36 | ( |
| 37 | request: Omit< |
| 38 | grafana.ListWorkspaceServiceAccountTokensRequest, |
| 39 | "workspaceId" |
| 40 | >, |
| 41 | ) => Effect.Effect< |
| 42 | grafana.ListWorkspaceServiceAccountTokensResponse, |
| 43 | grafana.ListWorkspaceServiceAccountTokensError |
| 44 | > |
| 45 | > |
| 46 | > {} |
| 47 | export const ListWorkspaceServiceAccountTokens = |
| 48 | Binding.Service<ListWorkspaceServiceAccountTokens>( |
| 49 | "AWS.Grafana.ListWorkspaceServiceAccountTokens", |
| 50 | ); |