| 1 | import type * as storagetransfer from "@distilled.cloud/gcp/storagetransfer_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 { TransferJob } from "./TransferJob.ts"; |
| 6 | |
| 7 | export interface RunTransferJobRequest extends Omit< |
| 8 | storagetransfer.RunTransferJobsRequest, |
| 9 | "jobName" |
| 10 | > {} |
| 11 | |
| 12 | /** |
| 13 | * Runtime binding for Storage Transfer `transferJobs.run`. |
| 14 | * |
| 15 | * Starts a transfer operation immediately, even when the job has no |
| 16 | * schedule. Bind this operation to a {@link TransferJob} in a |
| 17 | * Function/Action init phase. Provide {@link RunTransferJobHttp}. |
| 18 | * |
| 19 | * Grants `roles/storagetransfer.user` on the project because Storage |
| 20 | * Transfer has no resource-level IAM. |
| 21 | * |
| 22 | * ### Running Transfer Jobs |
| 23 | * **Example:** Run the bound job now |
| 24 | * ```typescript |
| 25 | * const runJob = yield* GCP.StorageTransfer.RunTransferJob(nightly); |
| 26 | * const operation = yield* runJob(); |
| 27 | * ``` |
| 28 | * |
| 29 | * @binding |
| 30 | * @category StorageTransfer |
| 31 | */ |
| 32 | export interface RunTransferJob extends Binding.Service< |
| 33 | RunTransferJob, |
| 34 | "GCP.StorageTransfer.RunTransferJob", |
| 35 | ( |
| 36 | job: TransferJob, |
| 37 | ) => Effect.Effect< |
| 38 | ( |
| 39 | request?: RunTransferJobRequest, |
| 40 | ) => Effect.Effect< |
| 41 | storagetransfer.Operation, |
| 42 | storagetransfer.RunTransferJobsError, |
| 43 | RuntimeContext |
| 44 | > |
| 45 | > |
| 46 | > {} |
| 47 | |
| 48 | export const RunTransferJob = Binding.Service<RunTransferJob>( |
| 49 | "GCP.StorageTransfer.RunTransferJob", |
| 50 | ); |