| 1 | import type * as cloudfunctions from "@distilled.cloud/gcp/cloudfunctions_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 { Function as CloudFunction } from "./Function.ts"; |
| 6 | |
| 7 | export interface GetFunctionRequest extends Omit< |
| 8 | cloudfunctions.GetProjectsLocationsFunctionsRequest, |
| 9 | "name" |
| 10 | > {} |
| 11 | |
| 12 | /** |
| 13 | * Runtime binding for Cloud Functions `functions.get`. |
| 14 | * |
| 15 | * Bind this operation to a {@link Function} in a Function/Action init phase. |
| 16 | * Provide {@link GetFunctionHttp}. Grants `roles/cloudfunctions.viewer` on |
| 17 | * the project under an IAM Condition naming only the bound function (2nd gen |
| 18 | * functions accept only invoker roles on their own IAM policy). |
| 19 | * |
| 20 | * ### Reading a Function |
| 21 | * **Example:** Get the bound function |
| 22 | * ```typescript |
| 23 | * const getFunction = yield* GCP.CloudFunctions.GetFunction(hello); |
| 24 | * const live = yield* getFunction(); |
| 25 | * ``` |
| 26 | * |
| 27 | * @binding |
| 28 | * @category CloudFunctions |
| 29 | */ |
| 30 | export interface GetFunction extends Binding.Service< |
| 31 | GetFunction, |
| 32 | "GCP.CloudFunctions.GetFunction", |
| 33 | ( |
| 34 | fn: CloudFunction, |
| 35 | ) => Effect.Effect< |
| 36 | ( |
| 37 | request?: GetFunctionRequest, |
| 38 | ) => Effect.Effect< |
| 39 | cloudfunctions.Cloudfunctions_Function, |
| 40 | cloudfunctions.GetProjectsLocationsFunctionsError, |
| 41 | RuntimeContext |
| 42 | > |
| 43 | > |
| 44 | > {} |
| 45 | |
| 46 | export const GetFunction = Binding.Service<GetFunction>( |
| 47 | "GCP.CloudFunctions.GetFunction", |
| 48 | ); |