| 1 | import type * as cloudbuild from "@distilled.cloud/gcp/cloudbuild_v2"; |
| 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 { Repository } from "./Repository.ts"; |
| 6 | |
| 7 | export interface AccessReadWriteTokenRequest extends Omit< |
| 8 | cloudbuild.AccessReadWriteTokenProjectsLocationsConnectionsRepositoriesRequest, |
| 9 | "repository" |
| 10 | > {} |
| 11 | |
| 12 | /** |
| 13 | * Runtime binding for Cloud Build v2 `repositories.accessReadWriteToken`. |
| 14 | * |
| 15 | * Bind this operation to a {@link Repository} in a Function/Action init |
| 16 | * phase. Provide {@link AccessReadWriteTokenHttp}. Returns a short-lived |
| 17 | * token that can clone and push to the remote Git repository. |
| 18 | * |
| 19 | * ### Fetching a Read/Write Token |
| 20 | * **Example:** Push with a read/write token |
| 21 | * ```typescript |
| 22 | * const accessReadWriteToken = yield* GCP.CloudBuild.AccessReadWriteToken(source); |
| 23 | * const { token, expirationTime } = yield* accessReadWriteToken(); |
| 24 | * ``` |
| 25 | * |
| 26 | * @binding |
| 27 | * @category CloudBuild |
| 28 | */ |
| 29 | export interface AccessReadWriteToken extends Binding.Service< |
| 30 | AccessReadWriteToken, |
| 31 | "GCP.CloudBuild.AccessReadWriteToken", |
| 32 | ( |
| 33 | repository: Repository, |
| 34 | ) => Effect.Effect< |
| 35 | ( |
| 36 | request?: AccessReadWriteTokenRequest, |
| 37 | ) => Effect.Effect< |
| 38 | cloudbuild.FetchReadWriteTokenResponse, |
| 39 | cloudbuild.AccessReadWriteTokenProjectsLocationsConnectionsRepositoriesError, |
| 40 | RuntimeContext |
| 41 | > |
| 42 | > |
| 43 | > {} |
| 44 | |
| 45 | export const AccessReadWriteToken = Binding.Service<AccessReadWriteToken>( |
| 46 | "GCP.CloudBuild.AccessReadWriteToken", |
| 47 | ); |