alchemy 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ai/ark.d.ts +11 -0
- package/lib/ai/ark.js +86 -0
- package/lib/ai/client.d.ts +51 -0
- package/lib/ai/client.js +29 -0
- package/lib/ai/document.d.ts +97 -0
- package/lib/ai/document.js +82 -0
- package/lib/ai/index.d.ts +2 -0
- package/lib/ai/index.js +2 -0
- package/lib/ai/object.d.ts +101 -0
- package/lib/ai/object.js +70 -0
- package/lib/alchemy.d.ts +84 -2
- package/lib/alchemy.js +114 -10
- package/lib/apply.d.ts +1 -1
- package/lib/apply.js +13 -10
- package/lib/aws/bucket.d.ts +87 -1
- package/lib/aws/bucket.js +48 -1
- package/lib/aws/function.d.ts +186 -1
- package/lib/aws/function.js +62 -8
- package/lib/aws/oidc/github-oidc-provider.d.ts +81 -0
- package/lib/aws/oidc/github-oidc-provider.js +68 -0
- package/lib/aws/oidc/oidc-provider.d.ts +14 -6
- package/lib/aws/oidc/oidc-provider.js +26 -5
- package/lib/aws/policy-attachment.d.ts +44 -1
- package/lib/aws/policy-attachment.js +31 -0
- package/lib/aws/policy.d.ts +160 -1
- package/lib/aws/policy.js +78 -0
- package/lib/aws/queue.d.ts +83 -1
- package/lib/aws/queue.js +39 -0
- package/lib/aws/role.d.ts +162 -1
- package/lib/aws/role.js +114 -0
- package/lib/aws/ses.d.ts +57 -2
- package/lib/aws/ses.js +42 -1
- package/lib/aws/table.d.ts +96 -1
- package/lib/aws/table.js +36 -0
- package/lib/cloudflare/asset-manifest.js +0 -1
- package/lib/cloudflare/bound.js +0 -1
- package/lib/cloudflare/bucket.d.ts +37 -1
- package/lib/cloudflare/bucket.js +36 -0
- package/lib/cloudflare/durable-object-namespace.d.ts +25 -0
- package/lib/cloudflare/durable-object-namespace.js +22 -0
- package/lib/cloudflare/kv-namespace.d.ts +37 -1
- package/lib/cloudflare/kv-namespace.js +36 -0
- package/lib/cloudflare/static-site.d.ts +53 -1
- package/lib/cloudflare/static-site.js +53 -1
- package/lib/cloudflare/worker-metadata.js +0 -1
- package/lib/cloudflare/worker.d.ts +64 -1
- package/lib/cloudflare/worker.js +63 -0
- package/lib/cloudflare/wrangler.json.d.ts +1 -1
- package/lib/cloudflare/zone-settings.js +0 -1
- package/lib/cloudflare/zone.d.ts +56 -1
- package/lib/cloudflare/zone.js +55 -0
- package/lib/context.d.ts +9 -4
- package/lib/context.js +4 -2
- package/lib/destroy.js +9 -8
- package/lib/esbuild/bundle.d.ts +43 -4
- package/lib/esbuild/bundle.js +16 -0
- package/lib/fs/file-collection.d.ts +16 -0
- package/lib/fs/file-collection.js +6 -0
- package/lib/fs/file-ref.d.ts +14 -0
- package/lib/fs/file-ref.js +6 -0
- package/lib/fs/file.d.ts +78 -5
- package/lib/fs/file.js +39 -3
- package/lib/fs/folder.d.ts +37 -5
- package/lib/fs/folder.js +28 -3
- package/lib/fs/index.d.ts +6 -0
- package/lib/fs/index.js +6 -0
- package/lib/fs/json-file.d.ts +16 -0
- package/lib/fs/json-file.js +7 -0
- package/lib/fs/text-file.d.ts +12 -0
- package/lib/fs/text-file.js +7 -0
- package/lib/fs/typescript-file.d.ts +19 -0
- package/lib/fs/typescript-file.js +14 -0
- package/lib/fs/yaml-file.d.ts +19 -0
- package/lib/fs/yaml-file.js +8 -0
- package/lib/github/secret.d.ts +63 -2
- package/lib/github/secret.js +61 -1
- package/lib/internal/docs.d.ts +5 -0
- package/lib/internal/docs.js +324 -0
- package/lib/resource.d.ts +2 -2
- package/lib/resource.js +4 -0
- package/lib/scope.d.ts +1 -1
- package/lib/scope.js +6 -6
- package/lib/secret.d.ts +67 -0
- package/lib/secret.js +67 -0
- package/lib/shadcn/component.d.ts +1 -1
- package/lib/state.d.ts +1 -1
- package/lib/state.js +8 -1
- package/lib/stripe/price.d.ts +51 -1
- package/lib/stripe/price.js +50 -0
- package/lib/stripe/product.d.ts +39 -1
- package/lib/stripe/product.js +38 -0
- package/lib/stripe/webhook.d.ts +46 -1
- package/lib/stripe/webhook.js +45 -0
- package/lib/test/bun.d.ts +64 -0
- package/lib/test/bun.js +35 -3
- package/lib/util/serde.d.ts +3 -1
- package/lib/util/serde.js +20 -4
- package/lib/vite/vite.d.ts +1 -1
- package/lib/vitepress/dependencies.d.ts +12 -0
- package/lib/vitepress/dependencies.js +35 -0
- package/lib/vitepress/home-page.d.ts +133 -0
- package/lib/vitepress/home-page.js +11 -0
- package/lib/vitepress/index.d.ts +2 -0
- package/lib/vitepress/index.js +2 -0
- package/lib/vitepress/vitepress.d.ts +71 -0
- package/lib/vitepress/vitepress.js +266 -0
- package/package.json +22 -10
- package/src/ai/ark.ts +118 -0
- package/src/ai/client.ts +78 -0
- package/src/ai/document.ts +160 -0
- package/src/ai/index.ts +2 -0
- package/src/ai/object.ts +149 -0
- package/src/alchemy.ts +192 -17
- package/src/apply.ts +25 -13
- package/src/aws/bucket.ts +111 -7
- package/src/aws/function.ts +231 -10
- package/src/aws/oidc/github-oidc-provider.ts +83 -0
- package/src/aws/oidc/oidc-provider.ts +39 -7
- package/src/aws/policy-attachment.ts +44 -1
- package/src/aws/policy.ts +177 -2
- package/src/aws/queue.ts +89 -0
- package/src/aws/role.ts +174 -2
- package/src/aws/ses.ts +56 -1
- package/src/aws/table.ts +103 -0
- package/src/cloudflare/bucket.ts +36 -0
- package/src/cloudflare/durable-object-namespace.ts +25 -0
- package/src/cloudflare/kv-namespace.ts +36 -0
- package/src/cloudflare/static-site.ts +53 -1
- package/src/cloudflare/worker.ts +63 -0
- package/src/cloudflare/zone.ts +55 -0
- package/src/context.ts +30 -10
- package/src/destroy.ts +11 -8
- package/src/esbuild/bundle.ts +53 -3
- package/src/fs/file-collection.ts +24 -0
- package/src/fs/file-ref.ts +22 -0
- package/src/fs/file.ts +107 -6
- package/src/fs/folder.ts +45 -5
- package/src/fs/index.ts +6 -0
- package/src/fs/json-file.ts +23 -0
- package/src/fs/text-file.ts +19 -0
- package/src/fs/typescript-file.ts +36 -0
- package/src/fs/yaml-file.ts +26 -0
- package/src/github/secret.ts +65 -2
- package/src/internal/docs.ts +369 -0
- package/src/resource.ts +7 -2
- package/src/scope.ts +9 -9
- package/src/secret.ts +67 -0
- package/src/state.ts +9 -2
- package/src/stripe/price.ts +50 -0
- package/src/stripe/product.ts +38 -0
- package/src/stripe/webhook.ts +45 -0
- package/src/test/bun.ts +83 -3
- package/src/util/serde.ts +30 -4
- package/src/vitepress/dependencies.ts +68 -0
- package/src/vitepress/home-page.ts +166 -0
- package/src/vitepress/index.md +75 -0
- package/src/vitepress/index.ts +2 -0
- package/src/vitepress/vitepress.ts +382 -0
- package/lib/project/vite.d.ts +0 -90
- package/lib/project/vite.js +0 -228
- package/src/project/vite.ts +0 -406
package/lib/aws/policy.js
CHANGED
|
@@ -1,5 +1,83 @@
|
|
|
1
1
|
import { CreatePolicyCommand, CreatePolicyVersionCommand, DeletePolicyCommand, DeletePolicyVersionCommand, GetPolicyCommand, GetPolicyVersionCommand, IAMClient, ListPolicyVersionsCommand, NoSuchEntityException, } from "@aws-sdk/client-iam";
|
|
2
2
|
import { Resource } from "../resource";
|
|
3
|
+
/**
|
|
4
|
+
* AWS IAM Policy Resource
|
|
5
|
+
*
|
|
6
|
+
* Creates and manages IAM policies that define permissions for AWS services and resources.
|
|
7
|
+
* Supports automatic versioning and updates when policy content changes.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* // Create a basic S3 bucket access policy
|
|
11
|
+
* const s3Policy = await Policy("bucket-access", {
|
|
12
|
+
* policyName: "s3-bucket-access",
|
|
13
|
+
* document: {
|
|
14
|
+
* Version: "2012-10-17",
|
|
15
|
+
* Statement: [{
|
|
16
|
+
* Effect: "Allow",
|
|
17
|
+
* Action: [
|
|
18
|
+
* "s3:GetObject",
|
|
19
|
+
* "s3:PutObject"
|
|
20
|
+
* ],
|
|
21
|
+
* Resource: `${bucket.arn}/*`
|
|
22
|
+
* }]
|
|
23
|
+
* }
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* // Create a policy with multiple statements and conditions
|
|
28
|
+
* const apiPolicy = await Policy("api-access", {
|
|
29
|
+
* policyName: "api-gateway-access",
|
|
30
|
+
* document: {
|
|
31
|
+
* Version: "2012-10-17",
|
|
32
|
+
* Statement: [
|
|
33
|
+
* {
|
|
34
|
+
* Sid: "InvokeAPI",
|
|
35
|
+
* Effect: "Allow",
|
|
36
|
+
* Action: "execute-api:Invoke",
|
|
37
|
+
* Resource: `${api.executionArn}/*`,
|
|
38
|
+
* Condition: {
|
|
39
|
+
* StringEquals: {
|
|
40
|
+
* "aws:SourceVpc": vpc.id
|
|
41
|
+
* }
|
|
42
|
+
* }
|
|
43
|
+
* },
|
|
44
|
+
* {
|
|
45
|
+
* Sid: "ReadLogs",
|
|
46
|
+
* Effect: "Allow",
|
|
47
|
+
* Action: [
|
|
48
|
+
* "logs:GetLogEvents",
|
|
49
|
+
* "logs:FilterLogEvents"
|
|
50
|
+
* ],
|
|
51
|
+
* Resource: `${api.logGroupArn}:*`
|
|
52
|
+
* }
|
|
53
|
+
* ]
|
|
54
|
+
* },
|
|
55
|
+
* description: "Allows invoking API Gateway endpoints and reading logs",
|
|
56
|
+
* tags: {
|
|
57
|
+
* Service: "API Gateway",
|
|
58
|
+
* Environment: "production"
|
|
59
|
+
* }
|
|
60
|
+
* });
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* // Create a policy that denies access based on tags
|
|
64
|
+
* const denyPolicy = await Policy("deny-production", {
|
|
65
|
+
* policyName: "deny-production-access",
|
|
66
|
+
* document: {
|
|
67
|
+
* Version: "2012-10-17",
|
|
68
|
+
* Statement: [{
|
|
69
|
+
* Effect: "Deny",
|
|
70
|
+
* Action: "*",
|
|
71
|
+
* Resource: "*",
|
|
72
|
+
* Condition: {
|
|
73
|
+
* StringEquals: {
|
|
74
|
+
* "aws:ResourceTag/Environment": "production"
|
|
75
|
+
* }
|
|
76
|
+
* }
|
|
77
|
+
* }]
|
|
78
|
+
* }
|
|
79
|
+
* });
|
|
80
|
+
*/
|
|
3
81
|
export const Policy = Resource("iam::Policy", async function (id, props) {
|
|
4
82
|
const client = new IAMClient({});
|
|
5
83
|
const policyArn = `arn:aws:iam::${process.env.AWS_ACCOUNT_ID}:policy${props.path || "/"}${props.policyName}`;
|
package/lib/aws/queue.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { Context } from "../context";
|
|
2
2
|
import { Resource } from "../resource";
|
|
3
|
+
/**
|
|
4
|
+
* Properties for creating or updating an SQS queue
|
|
5
|
+
*/
|
|
3
6
|
export interface QueueProps {
|
|
4
7
|
/**
|
|
5
8
|
* Name of the queue
|
|
@@ -11,22 +14,101 @@ export interface QueueProps {
|
|
|
11
14
|
* If true, the queueName must end with .fifo suffix
|
|
12
15
|
*/
|
|
13
16
|
fifo?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* The length of time (in seconds) that a message received from a queue will be invisible to other receiving components
|
|
19
|
+
* Default: 30 seconds
|
|
20
|
+
*/
|
|
14
21
|
visibilityTimeout?: number;
|
|
22
|
+
/**
|
|
23
|
+
* The length of time (in seconds) for which Amazon SQS retains a message
|
|
24
|
+
* Default: 345600 seconds (4 days)
|
|
25
|
+
*/
|
|
15
26
|
messageRetentionPeriod?: number;
|
|
27
|
+
/**
|
|
28
|
+
* The limit of how many bytes a message can contain before Amazon SQS rejects it
|
|
29
|
+
* Default: 262144 bytes (256 KB)
|
|
30
|
+
*/
|
|
16
31
|
maximumMessageSize?: number;
|
|
32
|
+
/**
|
|
33
|
+
* The time in seconds that the delivery of all messages in the queue will be delayed
|
|
34
|
+
* Default: 0 seconds
|
|
35
|
+
*/
|
|
17
36
|
delaySeconds?: number;
|
|
37
|
+
/**
|
|
38
|
+
* The length of time (in seconds) for which a ReceiveMessage action waits for a message to arrive
|
|
39
|
+
* Default: 0 seconds
|
|
40
|
+
*/
|
|
18
41
|
receiveMessageWaitTimeSeconds?: number;
|
|
19
42
|
/**
|
|
20
43
|
* Enables content-based deduplication for FIFO queues.
|
|
21
44
|
* Only applicable when fifo is true.
|
|
22
45
|
*/
|
|
23
46
|
contentBasedDeduplication?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Specifies whether message deduplication occurs at the message group or queue level
|
|
49
|
+
* Only applicable when fifo is true
|
|
50
|
+
*/
|
|
24
51
|
deduplicationScope?: "messageGroup" | "queue";
|
|
52
|
+
/**
|
|
53
|
+
* Specifies whether the FIFO queue throughput quota applies to the entire queue or per message group
|
|
54
|
+
* Only applicable when fifo is true
|
|
55
|
+
*/
|
|
25
56
|
fifoThroughputLimit?: "perQueue" | "perMessageGroupId";
|
|
57
|
+
/**
|
|
58
|
+
* Resource tags for the queue
|
|
59
|
+
*/
|
|
26
60
|
tags?: Record<string, string>;
|
|
27
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Output returned after SQS queue creation/update
|
|
64
|
+
*/
|
|
28
65
|
export interface Queue extends Resource<"sqs::Queue">, QueueProps {
|
|
66
|
+
/**
|
|
67
|
+
* ARN of the queue
|
|
68
|
+
*/
|
|
29
69
|
arn: string;
|
|
70
|
+
/**
|
|
71
|
+
* URL of the queue
|
|
72
|
+
*/
|
|
30
73
|
url: string;
|
|
31
74
|
}
|
|
32
|
-
|
|
75
|
+
/**
|
|
76
|
+
* AWS SQS Queue Resource
|
|
77
|
+
*
|
|
78
|
+
* Creates and manages Amazon SQS queues with support for both standard and FIFO queues.
|
|
79
|
+
* Handles queue creation, attribute configuration, and automatic cleanup of deleted queues.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* // Create a standard queue with custom visibility timeout
|
|
83
|
+
* const standardQueue = await Queue("my-queue", {
|
|
84
|
+
* queueName: "my-queue",
|
|
85
|
+
* visibilityTimeout: 30,
|
|
86
|
+
* tags: {
|
|
87
|
+
* Environment: "production"
|
|
88
|
+
* }
|
|
89
|
+
* });
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* // Create a FIFO queue with content-based deduplication
|
|
93
|
+
* const fifoQueue = await Queue("orders-queue", {
|
|
94
|
+
* queueName: "orders-queue.fifo",
|
|
95
|
+
* fifo: true,
|
|
96
|
+
* contentBasedDeduplication: true,
|
|
97
|
+
* visibilityTimeout: 30,
|
|
98
|
+
* tags: {
|
|
99
|
+
* Environment: "production"
|
|
100
|
+
* }
|
|
101
|
+
* });
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* // Create a queue with custom message retention and size
|
|
105
|
+
* const customQueue = await Queue("large-messages", {
|
|
106
|
+
* queueName: "large-messages",
|
|
107
|
+
* messageRetentionPeriod: 345600, // 4 days
|
|
108
|
+
* maximumMessageSize: 262144, // 256 KB
|
|
109
|
+
* visibilityTimeout: 60,
|
|
110
|
+
* delaySeconds: 5,
|
|
111
|
+
* receiveMessageWaitTimeSeconds: 20
|
|
112
|
+
* });
|
|
113
|
+
*/
|
|
114
|
+
export declare const Queue: (((this: any, id: string, props?: {}) => never) & (new (_: never) => never)) | ((this: Context<Queue>, id: string, props: QueueProps) => Promise<Queue>);
|
package/lib/aws/queue.js
CHANGED
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
import { CreateQueueCommand, DeleteQueueCommand, GetQueueAttributesCommand, GetQueueUrlCommand, SQSClient, } from "@aws-sdk/client-sqs";
|
|
2
2
|
import { Resource } from "../resource";
|
|
3
|
+
/**
|
|
4
|
+
* AWS SQS Queue Resource
|
|
5
|
+
*
|
|
6
|
+
* Creates and manages Amazon SQS queues with support for both standard and FIFO queues.
|
|
7
|
+
* Handles queue creation, attribute configuration, and automatic cleanup of deleted queues.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* // Create a standard queue with custom visibility timeout
|
|
11
|
+
* const standardQueue = await Queue("my-queue", {
|
|
12
|
+
* queueName: "my-queue",
|
|
13
|
+
* visibilityTimeout: 30,
|
|
14
|
+
* tags: {
|
|
15
|
+
* Environment: "production"
|
|
16
|
+
* }
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* // Create a FIFO queue with content-based deduplication
|
|
21
|
+
* const fifoQueue = await Queue("orders-queue", {
|
|
22
|
+
* queueName: "orders-queue.fifo",
|
|
23
|
+
* fifo: true,
|
|
24
|
+
* contentBasedDeduplication: true,
|
|
25
|
+
* visibilityTimeout: 30,
|
|
26
|
+
* tags: {
|
|
27
|
+
* Environment: "production"
|
|
28
|
+
* }
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* // Create a queue with custom message retention and size
|
|
33
|
+
* const customQueue = await Queue("large-messages", {
|
|
34
|
+
* queueName: "large-messages",
|
|
35
|
+
* messageRetentionPeriod: 345600, // 4 days
|
|
36
|
+
* maximumMessageSize: 262144, // 256 KB
|
|
37
|
+
* visibilityTimeout: 60,
|
|
38
|
+
* delaySeconds: 5,
|
|
39
|
+
* receiveMessageWaitTimeSeconds: 20
|
|
40
|
+
* });
|
|
41
|
+
*/
|
|
3
42
|
export const Queue = Resource("sqs::Queue", async function (id, props) {
|
|
4
43
|
const client = new SQSClient({});
|
|
5
44
|
// Don't automatically add .fifo suffix - user must include it in queueName
|
package/lib/aws/role.d.ts
CHANGED
|
@@ -1,24 +1,185 @@
|
|
|
1
1
|
import type { Context } from "../context";
|
|
2
2
|
import { Resource } from "../resource";
|
|
3
3
|
import type { PolicyDocument } from "./policy";
|
|
4
|
+
/**
|
|
5
|
+
* Properties for creating or updating an IAM role
|
|
6
|
+
*/
|
|
4
7
|
export interface RoleProps {
|
|
8
|
+
/**
|
|
9
|
+
* Name of the IAM role
|
|
10
|
+
*/
|
|
5
11
|
roleName: string;
|
|
12
|
+
/**
|
|
13
|
+
* Policy that defines which entities can assume this role
|
|
14
|
+
*/
|
|
6
15
|
assumeRolePolicy: PolicyDocument;
|
|
16
|
+
/**
|
|
17
|
+
* Optional description of the role's purpose
|
|
18
|
+
*/
|
|
7
19
|
description?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Optional path prefix for the role
|
|
22
|
+
*/
|
|
8
23
|
path?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Maximum session duration in seconds when assumed
|
|
26
|
+
* Default: 3600 seconds (1 hour)
|
|
27
|
+
*/
|
|
9
28
|
maxSessionDuration?: number;
|
|
29
|
+
/**
|
|
30
|
+
* ARN of the policy used to set the permissions boundary
|
|
31
|
+
*/
|
|
10
32
|
permissionsBoundary?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Inline policies to embed in the role
|
|
35
|
+
* Each policy must have a unique name and policy document
|
|
36
|
+
*/
|
|
11
37
|
policies?: Array<{
|
|
12
38
|
policyName: string;
|
|
13
39
|
policyDocument: PolicyDocument;
|
|
14
40
|
}>;
|
|
41
|
+
/**
|
|
42
|
+
* List of managed policy ARNs to attach to the role
|
|
43
|
+
*/
|
|
15
44
|
managedPolicyArns?: string[];
|
|
45
|
+
/**
|
|
46
|
+
* Resource tags for the role
|
|
47
|
+
*/
|
|
16
48
|
tags?: Record<string, string>;
|
|
17
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Output returned after IAM role creation/update
|
|
52
|
+
*/
|
|
18
53
|
export interface Role extends Resource<"iam::Role">, RoleProps {
|
|
54
|
+
/**
|
|
55
|
+
* ARN of the role
|
|
56
|
+
*/
|
|
19
57
|
arn: string;
|
|
58
|
+
/**
|
|
59
|
+
* Unique identifier for the role
|
|
60
|
+
*/
|
|
20
61
|
uniqueId: string;
|
|
62
|
+
/**
|
|
63
|
+
* The stable and unique string identifying the role
|
|
64
|
+
*/
|
|
21
65
|
roleId: string;
|
|
66
|
+
/**
|
|
67
|
+
* When the role was created
|
|
68
|
+
*/
|
|
22
69
|
createDate: Date;
|
|
23
70
|
}
|
|
24
|
-
|
|
71
|
+
/**
|
|
72
|
+
* AWS IAM Role Resource
|
|
73
|
+
*
|
|
74
|
+
* Creates and manages IAM roles with support for inline policies, managed policies,
|
|
75
|
+
* and automatic cleanup of attached policies during deletion.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* // Create a basic Lambda execution role with inline policy
|
|
79
|
+
* const basicRole = await Role("lambda-role", {
|
|
80
|
+
* roleName: "lambda-role",
|
|
81
|
+
* assumeRolePolicy: {
|
|
82
|
+
* Version: "2012-10-17",
|
|
83
|
+
* Statement: [{
|
|
84
|
+
* Effect: "Allow",
|
|
85
|
+
* Principal: {
|
|
86
|
+
* Service: "lambda.amazonaws.com"
|
|
87
|
+
* },
|
|
88
|
+
* Action: "sts:AssumeRole"
|
|
89
|
+
* }]
|
|
90
|
+
* },
|
|
91
|
+
* description: "Basic Lambda execution role",
|
|
92
|
+
* tags: {
|
|
93
|
+
* Environment: "production"
|
|
94
|
+
* },
|
|
95
|
+
* policies: [{
|
|
96
|
+
* policyName: "logs",
|
|
97
|
+
* policyDocument: {
|
|
98
|
+
* Version: "2012-10-17",
|
|
99
|
+
* Statement: [{
|
|
100
|
+
* Effect: "Allow",
|
|
101
|
+
* Action: [
|
|
102
|
+
* "logs:CreateLogGroup",
|
|
103
|
+
* "logs:CreateLogStream",
|
|
104
|
+
* "logs:PutLogEvents"
|
|
105
|
+
* ],
|
|
106
|
+
* Resource: "*"
|
|
107
|
+
* }]
|
|
108
|
+
* }
|
|
109
|
+
* }]
|
|
110
|
+
* });
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* // Create a role with AWS managed policies
|
|
114
|
+
* const managedRole = await Role("readonly-role", {
|
|
115
|
+
* roleName: "readonly-role",
|
|
116
|
+
* assumeRolePolicy: {
|
|
117
|
+
* Version: "2012-10-17",
|
|
118
|
+
* Statement: [{
|
|
119
|
+
* Effect: "Allow",
|
|
120
|
+
* Principal: {
|
|
121
|
+
* Service: "lambda.amazonaws.com"
|
|
122
|
+
* },
|
|
123
|
+
* Action: "sts:AssumeRole"
|
|
124
|
+
* }]
|
|
125
|
+
* },
|
|
126
|
+
* description: "Role with managed policies",
|
|
127
|
+
* managedPolicyArns: [
|
|
128
|
+
* "arn:aws:iam::aws:policy/ReadOnlyAccess"
|
|
129
|
+
* ],
|
|
130
|
+
* tags: {
|
|
131
|
+
* Environment: "production"
|
|
132
|
+
* }
|
|
133
|
+
* });
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* // Create a role with multiple inline policies and custom session duration
|
|
137
|
+
* const customRole = await Role("custom-role", {
|
|
138
|
+
* roleName: "custom-role",
|
|
139
|
+
* assumeRolePolicy: {
|
|
140
|
+
* Version: "2012-10-17",
|
|
141
|
+
* Statement: [{
|
|
142
|
+
* Effect: "Allow",
|
|
143
|
+
* Principal: {
|
|
144
|
+
* Service: "lambda.amazonaws.com"
|
|
145
|
+
* },
|
|
146
|
+
* Action: "sts:AssumeRole"
|
|
147
|
+
* }]
|
|
148
|
+
* },
|
|
149
|
+
* description: "Role with multiple policies",
|
|
150
|
+
* maxSessionDuration: 7200,
|
|
151
|
+
* policies: [
|
|
152
|
+
* {
|
|
153
|
+
* policyName: "logs",
|
|
154
|
+
* policyDocument: {
|
|
155
|
+
* Version: "2012-10-17",
|
|
156
|
+
* Statement: [{
|
|
157
|
+
* Effect: "Allow",
|
|
158
|
+
* Action: [
|
|
159
|
+
* "logs:CreateLogGroup",
|
|
160
|
+
* "logs:CreateLogStream",
|
|
161
|
+
* "logs:PutLogEvents"
|
|
162
|
+
* ],
|
|
163
|
+
* Resource: "*"
|
|
164
|
+
* }]
|
|
165
|
+
* }
|
|
166
|
+
* },
|
|
167
|
+
* {
|
|
168
|
+
* policyName: "s3",
|
|
169
|
+
* policyDocument: {
|
|
170
|
+
* Version: "2012-10-17",
|
|
171
|
+
* Statement: [{
|
|
172
|
+
* Effect: "Allow",
|
|
173
|
+
* Action: "s3:ListBucket",
|
|
174
|
+
* Resource: "*"
|
|
175
|
+
* }]
|
|
176
|
+
* }
|
|
177
|
+
* }
|
|
178
|
+
* ],
|
|
179
|
+
* tags: {
|
|
180
|
+
* Environment: "production",
|
|
181
|
+
* Updated: "true"
|
|
182
|
+
* }
|
|
183
|
+
* });
|
|
184
|
+
*/
|
|
185
|
+
export declare const Role: (((this: any, id: string, props?: {}) => never) & (new (_: never) => never)) | ((this: Context<Role>, id: string, props: RoleProps) => Promise<Role>);
|
package/lib/aws/role.js
CHANGED
|
@@ -1,6 +1,120 @@
|
|
|
1
1
|
import { AttachRolePolicyCommand, CreateRoleCommand, DeleteRoleCommand, DeleteRolePolicyCommand, DetachRolePolicyCommand, EntityAlreadyExistsException, GetRoleCommand, IAMClient, ListAttachedRolePoliciesCommand, NoSuchEntityException, PutRolePolicyCommand, TagRoleCommand, UpdateAssumeRolePolicyCommand, UpdateRoleCommand, } from "@aws-sdk/client-iam";
|
|
2
2
|
import { Resource } from "../resource";
|
|
3
3
|
import { ignore } from "../util/ignore";
|
|
4
|
+
/**
|
|
5
|
+
* AWS IAM Role Resource
|
|
6
|
+
*
|
|
7
|
+
* Creates and manages IAM roles with support for inline policies, managed policies,
|
|
8
|
+
* and automatic cleanup of attached policies during deletion.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* // Create a basic Lambda execution role with inline policy
|
|
12
|
+
* const basicRole = await Role("lambda-role", {
|
|
13
|
+
* roleName: "lambda-role",
|
|
14
|
+
* assumeRolePolicy: {
|
|
15
|
+
* Version: "2012-10-17",
|
|
16
|
+
* Statement: [{
|
|
17
|
+
* Effect: "Allow",
|
|
18
|
+
* Principal: {
|
|
19
|
+
* Service: "lambda.amazonaws.com"
|
|
20
|
+
* },
|
|
21
|
+
* Action: "sts:AssumeRole"
|
|
22
|
+
* }]
|
|
23
|
+
* },
|
|
24
|
+
* description: "Basic Lambda execution role",
|
|
25
|
+
* tags: {
|
|
26
|
+
* Environment: "production"
|
|
27
|
+
* },
|
|
28
|
+
* policies: [{
|
|
29
|
+
* policyName: "logs",
|
|
30
|
+
* policyDocument: {
|
|
31
|
+
* Version: "2012-10-17",
|
|
32
|
+
* Statement: [{
|
|
33
|
+
* Effect: "Allow",
|
|
34
|
+
* Action: [
|
|
35
|
+
* "logs:CreateLogGroup",
|
|
36
|
+
* "logs:CreateLogStream",
|
|
37
|
+
* "logs:PutLogEvents"
|
|
38
|
+
* ],
|
|
39
|
+
* Resource: "*"
|
|
40
|
+
* }]
|
|
41
|
+
* }
|
|
42
|
+
* }]
|
|
43
|
+
* });
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* // Create a role with AWS managed policies
|
|
47
|
+
* const managedRole = await Role("readonly-role", {
|
|
48
|
+
* roleName: "readonly-role",
|
|
49
|
+
* assumeRolePolicy: {
|
|
50
|
+
* Version: "2012-10-17",
|
|
51
|
+
* Statement: [{
|
|
52
|
+
* Effect: "Allow",
|
|
53
|
+
* Principal: {
|
|
54
|
+
* Service: "lambda.amazonaws.com"
|
|
55
|
+
* },
|
|
56
|
+
* Action: "sts:AssumeRole"
|
|
57
|
+
* }]
|
|
58
|
+
* },
|
|
59
|
+
* description: "Role with managed policies",
|
|
60
|
+
* managedPolicyArns: [
|
|
61
|
+
* "arn:aws:iam::aws:policy/ReadOnlyAccess"
|
|
62
|
+
* ],
|
|
63
|
+
* tags: {
|
|
64
|
+
* Environment: "production"
|
|
65
|
+
* }
|
|
66
|
+
* });
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* // Create a role with multiple inline policies and custom session duration
|
|
70
|
+
* const customRole = await Role("custom-role", {
|
|
71
|
+
* roleName: "custom-role",
|
|
72
|
+
* assumeRolePolicy: {
|
|
73
|
+
* Version: "2012-10-17",
|
|
74
|
+
* Statement: [{
|
|
75
|
+
* Effect: "Allow",
|
|
76
|
+
* Principal: {
|
|
77
|
+
* Service: "lambda.amazonaws.com"
|
|
78
|
+
* },
|
|
79
|
+
* Action: "sts:AssumeRole"
|
|
80
|
+
* }]
|
|
81
|
+
* },
|
|
82
|
+
* description: "Role with multiple policies",
|
|
83
|
+
* maxSessionDuration: 7200,
|
|
84
|
+
* policies: [
|
|
85
|
+
* {
|
|
86
|
+
* policyName: "logs",
|
|
87
|
+
* policyDocument: {
|
|
88
|
+
* Version: "2012-10-17",
|
|
89
|
+
* Statement: [{
|
|
90
|
+
* Effect: "Allow",
|
|
91
|
+
* Action: [
|
|
92
|
+
* "logs:CreateLogGroup",
|
|
93
|
+
* "logs:CreateLogStream",
|
|
94
|
+
* "logs:PutLogEvents"
|
|
95
|
+
* ],
|
|
96
|
+
* Resource: "*"
|
|
97
|
+
* }]
|
|
98
|
+
* }
|
|
99
|
+
* },
|
|
100
|
+
* {
|
|
101
|
+
* policyName: "s3",
|
|
102
|
+
* policyDocument: {
|
|
103
|
+
* Version: "2012-10-17",
|
|
104
|
+
* Statement: [{
|
|
105
|
+
* Effect: "Allow",
|
|
106
|
+
* Action: "s3:ListBucket",
|
|
107
|
+
* Resource: "*"
|
|
108
|
+
* }]
|
|
109
|
+
* }
|
|
110
|
+
* }
|
|
111
|
+
* ],
|
|
112
|
+
* tags: {
|
|
113
|
+
* Environment: "production",
|
|
114
|
+
* Updated: "true"
|
|
115
|
+
* }
|
|
116
|
+
* });
|
|
117
|
+
*/
|
|
4
118
|
export const Role = Resource("iam::Role", async function (id, props) {
|
|
5
119
|
const client = new IAMClient({});
|
|
6
120
|
if (this.phase === "delete") {
|
package/lib/aws/ses.d.ts
CHANGED
|
@@ -7,38 +7,48 @@ import { Resource } from "../resource";
|
|
|
7
7
|
export interface SESProps {
|
|
8
8
|
/**
|
|
9
9
|
* Name of the configuration set
|
|
10
|
+
* Used to group email sending and tracking settings
|
|
10
11
|
*/
|
|
11
12
|
configurationSetName?: string;
|
|
12
13
|
/**
|
|
13
14
|
* Email identity to verify (email address or domain)
|
|
15
|
+
* For domains, use the format "example.com"
|
|
16
|
+
* For email addresses, use the format "user@example.com"
|
|
14
17
|
*/
|
|
15
18
|
emailIdentity?: string;
|
|
16
19
|
/**
|
|
17
20
|
* Whether to enable DKIM signing for the email identity
|
|
21
|
+
* DKIM helps prevent email spoofing by verifying sender authenticity
|
|
18
22
|
*/
|
|
19
23
|
enableDkim?: boolean;
|
|
20
24
|
/**
|
|
21
25
|
* Sending options for the configuration set
|
|
26
|
+
* Controls whether email sending is enabled and related settings
|
|
22
27
|
*/
|
|
23
28
|
sendingOptions?: SendingOptions;
|
|
24
29
|
/**
|
|
25
30
|
* Reputation options for the configuration set
|
|
31
|
+
* Controls reputation tracking and metrics collection
|
|
26
32
|
*/
|
|
27
33
|
reputationOptions?: ReputationOptions;
|
|
28
34
|
/**
|
|
29
35
|
* Tracking options for the configuration set
|
|
36
|
+
* Controls open and click tracking with optional custom domains
|
|
30
37
|
*/
|
|
31
38
|
trackingOptions?: TrackingOptions;
|
|
32
39
|
/**
|
|
33
40
|
* Suppression options for the configuration set
|
|
41
|
+
* Controls how bounces and complaints are handled
|
|
34
42
|
*/
|
|
35
43
|
suppressionOptions?: SuppressionOptions;
|
|
36
44
|
/**
|
|
37
45
|
* Delivery options for the configuration set
|
|
46
|
+
* Controls TLS settings and sending pool configuration
|
|
38
47
|
*/
|
|
39
48
|
deliveryOptions?: DeliveryOptions;
|
|
40
49
|
/**
|
|
41
50
|
* Tags to apply to the SES resources
|
|
51
|
+
* Key-value pairs for resource organization
|
|
42
52
|
*/
|
|
43
53
|
tags?: Record<string, string>;
|
|
44
54
|
}
|
|
@@ -48,22 +58,67 @@ export interface SESProps {
|
|
|
48
58
|
export interface SES extends Resource<"aws::SES">, SESProps {
|
|
49
59
|
/**
|
|
50
60
|
* ARN of the configuration set if created
|
|
61
|
+
* Format: arn:aws:ses:region:account-id:configuration-set/name
|
|
51
62
|
*/
|
|
52
63
|
configurationSetArn?: string;
|
|
53
64
|
/**
|
|
54
65
|
* Email identity verification status if an identity was created
|
|
66
|
+
* Can be "PENDING" or "VERIFIED"
|
|
55
67
|
*/
|
|
56
68
|
emailIdentityVerificationStatus?: string;
|
|
57
69
|
/**
|
|
58
70
|
* DKIM verification status if DKIM was enabled
|
|
71
|
+
* Can be "PENDING", "SUCCESS", "FAILED", "TEMPORARY_FAILURE", or "NOT_STARTED"
|
|
59
72
|
*/
|
|
60
73
|
dkimVerificationStatus?: string;
|
|
61
74
|
/**
|
|
62
75
|
* Email identity ARN if an identity was created
|
|
76
|
+
* Format: arn:aws:ses:region:account-id:identity/name
|
|
63
77
|
*/
|
|
64
78
|
emailIdentityArn?: string;
|
|
65
79
|
}
|
|
66
80
|
/**
|
|
67
|
-
* AWS SES
|
|
81
|
+
* AWS SES Resource
|
|
82
|
+
*
|
|
83
|
+
* Creates and manages Amazon Simple Email Service (SES) configuration sets and email identities.
|
|
84
|
+
* Supports email sending configuration, DKIM signing, and identity verification.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* // Create a configuration set with sending options
|
|
88
|
+
* const configSet = await SES("email-config", {
|
|
89
|
+
* configurationSetName: "my-email-config",
|
|
90
|
+
* sendingOptions: {
|
|
91
|
+
* SendingEnabled: true
|
|
92
|
+
* },
|
|
93
|
+
* tags: {
|
|
94
|
+
* Environment: "production",
|
|
95
|
+
* Project: "notifications"
|
|
96
|
+
* }
|
|
97
|
+
* });
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* // Create and verify a domain identity with DKIM
|
|
101
|
+
* const domainIdentity = await SES("domain-identity", {
|
|
102
|
+
* emailIdentity: "example.com",
|
|
103
|
+
* enableDkim: true,
|
|
104
|
+
* tags: {
|
|
105
|
+
* Environment: "production",
|
|
106
|
+
* Project: "transactional-emails"
|
|
107
|
+
* }
|
|
108
|
+
* });
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* // Update configuration set sending options
|
|
112
|
+
* const updatedConfig = await SES("email-config", {
|
|
113
|
+
* configurationSetName: "my-email-config",
|
|
114
|
+
* sendingOptions: {
|
|
115
|
+
* SendingEnabled: false
|
|
116
|
+
* },
|
|
117
|
+
* tags: {
|
|
118
|
+
* Environment: "production",
|
|
119
|
+
* Project: "notifications",
|
|
120
|
+
* Updated: "true"
|
|
121
|
+
* }
|
|
122
|
+
* });
|
|
68
123
|
*/
|
|
69
|
-
export declare const SES: ((this:
|
|
124
|
+
export declare const SES: (((this: any, id: string, props?: {}) => never) & (new (_: never) => never)) | ((this: Context<SES>, id: string, props: SESProps) => Promise<SES>);
|