1import type * as storagetransfer from "@distilled.cloud/gcp/storagetransfer_v1";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { RuntimeContext } from "../../RuntimeContext.ts";
5import type { TransferJob } from "./TransferJob.ts";
6
7/**
8 * Runtime binding for Storage Transfer `googleServiceAccounts.get`.
9 *
10 * Returns the Google-managed service account Storage Transfer uses to
11 * read source buckets and write sink buckets. Grant this identity
12 * `roles/storage.objectViewer` (source) and `roles/storage.objectAdmin`
13 * (sink). Bind this operation to a {@link TransferJob} in a
14 * Function/Action init phase. Provide {@link GetGoogleServiceAccountHttp}.
15 *
16 * Grants the host `roles/storagetransfer.viewer` on the project because
17 * Storage Transfer has no resource-level IAM.
18 *
19 * ### Looking up the Transfer Service Account
20 * **Example:** Read the project service account
21 * ```typescript
22 * const getAccount = yield* GCP.StorageTransfer.GetGoogleServiceAccount(
23 * nightly,
24 * );
25 * const account = yield* getAccount();
26 * ```
27 *
28 * @binding
29 * @category StorageTransfer
30 */
31export interface GetGoogleServiceAccount extends Binding.Service<
32 GetGoogleServiceAccount,
33 "GCP.StorageTransfer.GetGoogleServiceAccount",
34 (
35 job: TransferJob,
36 ) => Effect.Effect<
37 () => Effect.Effect<
38 storagetransfer.GoogleServiceAccount,
39 storagetransfer.GetGoogleServiceAccountsError,
40 RuntimeContext
41 >
42 >
43> {}
44
45export const GetGoogleServiceAccount = Binding.Service<GetGoogleServiceAccount>(
46 "GCP.StorageTransfer.GetGoogleServiceAccount",
47);