| 1 | import type * as workstations from "@distilled.cloud/gcp/workstations_v1"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { RuntimeContext } from "../../RuntimeContext.ts"; |
| 5 | import type { WorkstationClustersWorkstationConfigsWorkstation } from "./WorkstationClustersWorkstationConfigsWorkstation.ts"; |
| 6 | |
| 7 | export interface GenerateAccessTokenRequest extends Omit< |
| 8 | workstations.GenerateAccessTokenProjectsLocationsWorkstationClustersWorkstationConfigsWorkstationsRequest, |
| 9 | "workstation" |
| 10 | > {} |
| 11 | |
| 12 | /** |
| 13 | * Runtime binding for Cloud Workstations `workstations.generateAccessToken`. |
| 14 | * |
| 15 | * Bind this operation to a |
| 16 | * {@link WorkstationClustersWorkstationConfigsWorkstation} in a |
| 17 | * Function/Action init phase. Provide {@link GenerateAccessTokenHttp}. |
| 18 | * Grants `roles/workstations.user` on the workstation only. |
| 19 | * |
| 20 | * ### Authenticating to a Workstation |
| 21 | * **Example:** Mint a short-lived access token |
| 22 | * ```typescript |
| 23 | * const generate = yield* GCP.Workstations.GenerateAccessToken(dev); |
| 24 | * const { accessToken, expireTime } = yield* generate({ |
| 25 | * body: { ttl: "3600s" }, |
| 26 | * }); |
| 27 | * ``` |
| 28 | * |
| 29 | * @binding |
| 30 | * @category Workstations |
| 31 | */ |
| 32 | export interface GenerateAccessToken extends Binding.Service< |
| 33 | GenerateAccessToken, |
| 34 | "GCP.Workstations.GenerateAccessToken", |
| 35 | ( |
| 36 | workstation: WorkstationClustersWorkstationConfigsWorkstation, |
| 37 | ) => Effect.Effect< |
| 38 | ( |
| 39 | request?: GenerateAccessTokenRequest, |
| 40 | ) => Effect.Effect< |
| 41 | workstations.GenerateAccessTokenResponse, |
| 42 | workstations.GenerateAccessTokenProjectsLocationsWorkstationClustersWorkstationConfigsWorkstationsError, |
| 43 | RuntimeContext |
| 44 | > |
| 45 | > |
| 46 | > {} |
| 47 | |
| 48 | export const GenerateAccessToken = Binding.Service<GenerateAccessToken>( |
| 49 | "GCP.Workstations.GenerateAccessToken", |
| 50 | ); |