@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 56 lines 1.93 KB
Raw
1 import type * as cloudcontrol from "@distilled.cloud/aws/cloudcontrol";
2 import * as Binding from "alchemy/Binding";
3 import type * as Effect from "effect/Effect";
4 import type { CloudControlBindingOptions } from "./BindingOptions.ts";
5
6 /**
7 * Runtime binding for `cloudformation:CreateResource`.
8 *
9 * Provisions any Cloud Control-supported resource from inside a Function —
10 * the building block for dynamic, per-tenant provisioning services. The call
11 * is asynchronous: poll the returned `RequestToken` with
12 * {@link GetResourceRequestStatus} until the operation settles. Because Cloud
13 * Control invokes the resource type's create handler with the caller's
14 * credentials, pass the handler's underlying permissions via
15 * {@link CloudControlBindingOptions.handlerPolicyStatements}.
16 * ### Provisioning Resources
17 * **Example:** Create an SSM Parameter at runtime
18 * ```typescript
19 * // init — account-level; grant the create handler's permissions too
20 * const createResource = yield* CloudControl.CreateResource({
21 * handlerPolicyStatements: [
22 * {
23 * Effect: "Allow",
24 * Action: ["ssm:PutParameter", "ssm:GetParameters", "ssm:AddTagsToResource"],
25 * Resource: ["*"],
26 * },
27 * ],
28 * });
29 *
30 * // runtime
31 * const created = yield* createResource({
32 * TypeName: "AWS::SSM::Parameter",
33 * DesiredState: JSON.stringify({
34 * Name: "/tenants/acme/greeting",
35 * Type: "String",
36 * Value: "hello",
37 * }),
38 * });
39 * // poll created.ProgressEvent.RequestToken until SUCCESS
40 * ```
41 *
42 * @binding
43 */
44 export interface CreateResource extends Binding.Service<
45 CreateResource,
46 "AWS.CloudControl.CreateResource",
47 (
48 options?: CloudControlBindingOptions,
49 ) => Effect.Effect<
50 (
51 request: cloudcontrol.CreateResourceInput,
52 ) => Effect.Effect<cloudcontrol.CreateResourceOutput, cloudcontrol.CreateResourceError>
53 >
54 > {}
55
56 export const CreateResource = Binding.Service<CreateResource>("AWS.CloudControl.CreateResource");