@intentius/chant-lexicon-gcp 0.124.37 → 0.124.39

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.
Files changed (58) hide show
  1. package/dist/api/read-client.d.ts +14 -1
  2. package/dist/api/read-client.d.ts.map +1 -1
  3. package/dist/api/read-client.js +25 -10
  4. package/dist/composites/catalog.d.ts.map +1 -1
  5. package/dist/composites/catalog.js +187 -0
  6. package/dist/composites/index.d.ts +4 -0
  7. package/dist/composites/index.d.ts.map +1 -1
  8. package/dist/composites/index.js +2 -0
  9. package/dist/composites/private-egress-network.d.ts +42 -0
  10. package/dist/composites/private-egress-network.d.ts.map +1 -0
  11. package/dist/composites/private-egress-network.js +48 -0
  12. package/dist/composites/public-cloud-run.d.ts +85 -0
  13. package/dist/composites/public-cloud-run.d.ts.map +1 -0
  14. package/dist/composites/public-cloud-run.js +144 -0
  15. package/dist/deep-observe.d.ts +5 -0
  16. package/dist/deep-observe.d.ts.map +1 -1
  17. package/dist/deep-observe.js +37 -3
  18. package/dist/describe-resources.d.ts +13 -0
  19. package/dist/describe-resources.d.ts.map +1 -1
  20. package/dist/describe-resources.js +19 -0
  21. package/dist/health.d.ts +26 -2
  22. package/dist/health.d.ts.map +1 -1
  23. package/dist/health.js +85 -6
  24. package/dist/index.d.ts +2 -2
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +1 -1
  27. package/dist/integrity.json +3 -3
  28. package/dist/manifest.json +1 -1
  29. package/dist/op/activities/gcp-apply.d.ts +19 -0
  30. package/dist/op/activities/gcp-apply.d.ts.map +1 -1
  31. package/dist/op/activities/gcp-apply.js +16 -0
  32. package/dist/op/activities/gcp-compute.d.ts +9 -0
  33. package/dist/op/activities/gcp-compute.d.ts.map +1 -1
  34. package/dist/op/activities/gcp-compute.js +107 -11
  35. package/dist/plugin.d.ts.map +1 -1
  36. package/dist/plugin.js +6 -2
  37. package/dist/skills/chant-gcp.md +2 -0
  38. package/package.json +2 -2
  39. package/src/api/read-client.ts +30 -9
  40. package/src/composites/catalog.ts +187 -0
  41. package/src/composites/cloud-run-lb.test.ts +93 -0
  42. package/src/composites/index.ts +4 -0
  43. package/src/composites/private-egress-network.ts +82 -0
  44. package/src/composites/public-cloud-run.ts +245 -0
  45. package/src/deep-observe.test.ts +46 -0
  46. package/src/deep-observe.ts +41 -3
  47. package/src/describe-resources.ts +23 -1
  48. package/src/health.test.ts +65 -1
  49. package/src/health.ts +88 -11
  50. package/src/index.ts +2 -1
  51. package/src/op/activities/gcp-apply.ts +31 -1
  52. package/src/op/activities/gcp-compute-reconcile.test.ts +150 -0
  53. package/src/op/activities/gcp-compute.test.ts +4 -2
  54. package/src/op/activities/gcp-compute.ts +129 -11
  55. package/src/plugin.ts +6 -2
  56. package/src/project-config.test.ts +50 -3
  57. package/src/read-refs.test.ts +60 -0
  58. package/src/skills/chant-gcp.md +2 -0
@@ -37,7 +37,7 @@
37
37
  * quietly implying it is not there. Widening the table is #1209's stated
38
38
  * non-goal and belongs with the applier.
39
39
  */
40
- import { type ResourceMapper } from "../op/activities/gcp-apply.js";
40
+ import { type GcpResource, type ResourceMapper } from "../op/activities/gcp-apply.js";
41
41
  /** Where to read, and as whom. */
42
42
  export interface GcpReadClientOptions {
43
43
  /** Endpoint override for every kind (floci-gcp `http://localhost:4588`). Omit for real GCP. */
@@ -46,6 +46,12 @@ export interface GcpReadClientOptions {
46
46
  project: string;
47
47
  /** Injectable HTTP, so tests never touch the network. */
48
48
  http?: GcpReadHttp;
49
+ /**
50
+ * The declared resources, refs resolved, as apply passes them (#4251): an
51
+ * IAMPolicyMember on a RunService named by `name` takes the service's region
52
+ * from its declaration, which a read otherwise can't know.
53
+ */
54
+ manifest?: readonly GcpResource[];
49
55
  }
50
56
  /** Injectable HTTP client — mirrors the applier's `GcpHttp`. A body is sent only for a POST read (`:getIamPolicy`). */
51
57
  export type GcpReadHttp = (method: string, url: string, body?: unknown) => Promise<{
@@ -72,5 +78,12 @@ export declare function mapperForKind(kind: string): ResourceMapper | undefined;
72
78
  * build a URL — the same input the applier hands it. Returns the parsed body,
73
79
  * or throws {@link GcpReadError} carrying the status.
74
80
  */
81
+ /**
82
+ * The URL a read of this resource GETs: the applier's own `plan().getUrl`, so
83
+ * a health read's sub-calls (`getHealth`) land on the same resource path.
84
+ * Throws a {@link GcpReadError} when the declared spec can't produce one,
85
+ * which is a hole, never an absence.
86
+ */
87
+ export declare function readUrl(client: GcpReadClientOptions, kind: string, name: string, declared?: Record<string, unknown>): string;
75
88
  export declare function getResource(client: GcpReadClientOptions, kind: string, name: string, declared?: Record<string, unknown>): Promise<Record<string, unknown>>;
76
89
  //# sourceMappingURL=read-client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"read-client.d.ts","sourceRoot":"","sources":["../../src/api/read-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,OAAO,EAA6B,KAAK,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5F,kCAAkC;AAClC,MAAM,WAAW,oBAAoB;IACnC,+FAA+F;IAC/F,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AAED,uHAAuH;AACvH,MAAM,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAUrH;;;;GAIG;AACH,qBAAa,YAAa,SAAQ,KAAK;IAGnC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM;IAF1B,YACE,OAAO,EAAE,MAAM,EACN,MAAM,CAAC,EAAE,MAAM,YAAA,EAIzB;CACF;AAED,mFAAmF;A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YAAA,EAIzB;CACF;AAED,mFAAmF;AACnF,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAEhD;AAED,4EAA4E;AAC5E,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAEtE;AAED;;;;;;GAMG;AACH;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAc5H;AAED,wBAAsB,WAAW,CAC/B,MAAM,EAAE,oBAAoB,EAC5B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CA0ClC"}
@@ -72,6 +72,29 @@ export function mapperForKind(kind) {
72
72
  * build a URL — the same input the applier hands it. Returns the parsed body,
73
73
  * or throws {@link GcpReadError} carrying the status.
74
74
  */
75
+ /**
76
+ * The URL a read of this resource GETs: the applier's own `plan().getUrl`, so
77
+ * a health read's sub-calls (`getHealth`) land on the same resource path.
78
+ * Throws a {@link GcpReadError} when the declared spec can't produce one,
79
+ * which is a hole, never an absence.
80
+ */
81
+ export function readUrl(client, kind, name, declared) {
82
+ const mapper = mapperForKind(kind);
83
+ if (!mapper)
84
+ throw new GcpReadError(`no REST mapper for kind ${kind}`);
85
+ const base = (client.endpoint ?? mapper.defaultHost).replace(/\/$/, "");
86
+ const resource = {
87
+ kind,
88
+ metadata: { name },
89
+ spec: declared?.spec ?? declared ?? {},
90
+ };
91
+ try {
92
+ return mapper.plan(resource, { base, project: client.project, ...(client.manifest ? { manifest: client.manifest } : {}) }).getUrl;
93
+ }
94
+ catch (err) {
95
+ throw new GcpReadError(`could not build a read URL for ${kind}/${name}: ${err instanceof Error ? err.message : String(err)}`);
96
+ }
97
+ }
75
98
  export async function getResource(client, kind, name, declared) {
76
99
  const mapper = mapperForKind(kind);
77
100
  if (!mapper)
@@ -82,7 +105,7 @@ export async function getResource(client, kind, name, declared) {
82
105
  metadata: { name },
83
106
  spec: declared?.spec ?? declared ?? {},
84
107
  };
85
- const ctx = { base, project: client.project };
108
+ const ctx = { base, project: client.project, ...(client.manifest ? { manifest: client.manifest } : {}) };
86
109
  if (mapper.accepts && !mapper.accepts(resource, ctx)) {
87
110
  throw new GcpReadError(`no REST read for ${kind}/${name}: its target has no endpoint chant can read`);
88
111
  }
@@ -97,15 +120,7 @@ export async function getResource(client, kind, name, declared) {
97
120
  }
98
121
  }
99
122
  else {
100
- let getUrl;
101
- try {
102
- getUrl = mapper.plan(resource, ctx).getUrl;
103
- }
104
- catch (err) {
105
- // A mapper that cannot plan from the declared spec cannot produce a URL, so
106
- // there is nothing to read — a hole, never an absence.
107
- throw new GcpReadError(`could not build a read URL for ${kind}/${name}: ${err instanceof Error ? err.message : String(err)}`);
108
- }
123
+ const getUrl = readUrl(client, kind, name, declared);
109
124
  try {
110
125
  res = await http("GET", getUrl);
111
126
  }
@@ -1 +1 @@
1
- {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/composites/catalog.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,eAAO,MAAM,gBAAgB,EAAE,cAAc,EAkuC5C,CAAC"}
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/composites/catalog.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,eAAO,MAAM,gBAAgB,EAAE,cAAc,EA65C5C,CAAC"}
@@ -170,6 +170,12 @@ export const compositeCatalog = [
170
170
  "required": false,
171
171
  "description": "Environment variables."
172
172
  },
173
+ {
174
+ "name": "serviceAccount",
175
+ "type": "string",
176
+ "required": false,
177
+ "description": "Service account the service runs as: an email, or the account id of an IAMServiceAccount in the project."
178
+ },
173
179
  {
174
180
  "name": "labels",
175
181
  "type": "Record<string, string>",
@@ -950,6 +956,59 @@ export const compositeCatalog = [
950
956
  }
951
957
  ]
952
958
  },
959
+ {
960
+ "name": "PrivateEgressNetwork",
961
+ "lexicon": "gcp",
962
+ "description": "Create a PrivateEgressNetwork composite.",
963
+ "bundles": [
964
+ "Subnetwork",
965
+ "VPCNetwork"
966
+ ],
967
+ "params": [
968
+ {
969
+ "name": "name",
970
+ "type": "string",
971
+ "required": true,
972
+ "description": "Name prefix: the network is `<name>-vpc`, its subnet `<name>-apps`."
973
+ },
974
+ {
975
+ "name": "region",
976
+ "type": "string",
977
+ "required": true,
978
+ "description": "GCP region of the subnet."
979
+ },
980
+ {
981
+ "name": "subnetCidr",
982
+ "type": "string",
983
+ "required": true,
984
+ "description": "IP CIDR range of the subnet."
985
+ },
986
+ {
987
+ "name": "privateIpGoogleAccess",
988
+ "type": "boolean",
989
+ "required": false,
990
+ "description": "Enable private Google access on the subnet (default: true)."
991
+ },
992
+ {
993
+ "name": "labels",
994
+ "type": "Record<string, string>",
995
+ "required": false,
996
+ "description": "Additional labels."
997
+ },
998
+ {
999
+ "name": "namespace",
1000
+ "type": "string",
1001
+ "required": false,
1002
+ "description": "Namespace for all resources."
1003
+ },
1004
+ {
1005
+ "name": "defaults",
1006
+ "type": "{ vpc?: Partial<ConstructorParameters<typeof VPCNetwork>[0]>; subnet?: Partial<ConstructorParameters<typeof Subnetwor...",
1007
+ "required": false,
1008
+ "description": "Per-member defaults for customizing individual resources."
1009
+ }
1010
+ ]
1011
+ },
953
1012
  {
954
1013
  "name": "PrivateService",
955
1014
  "lexicon": "gcp",
@@ -1028,6 +1087,134 @@ export const compositeCatalog = [
1028
1087
  }
1029
1088
  ]
1030
1089
  },
1090
+ {
1091
+ "name": "PublicCloudRun",
1092
+ "lexicon": "gcp",
1093
+ "description": "Create a PublicCloudRun composite.",
1094
+ "bundles": [
1095
+ "BackendService",
1096
+ "CloudRunService",
1097
+ "ComputeAddress",
1098
+ "ForwardingRule",
1099
+ "GCPServiceAccount",
1100
+ "IAMPolicyMember",
1101
+ "ManagedSSLCertificate",
1102
+ "RegionNetworkEndpointGroup",
1103
+ "TargetHTTPProxy",
1104
+ "TargetHTTPSProxy",
1105
+ "URLMap"
1106
+ ],
1107
+ "params": [
1108
+ {
1109
+ "name": "name",
1110
+ "type": "string",
1111
+ "required": true,
1112
+ "description": "Name prefix every resource is named with."
1113
+ },
1114
+ {
1115
+ "name": "image",
1116
+ "type": "string",
1117
+ "required": true,
1118
+ "description": "Container image."
1119
+ },
1120
+ {
1121
+ "name": "region",
1122
+ "type": "string",
1123
+ "required": true,
1124
+ "description": "GCP region of the service and its network endpoint group."
1125
+ },
1126
+ {
1127
+ "name": "projectId",
1128
+ "type": "string",
1129
+ "required": false,
1130
+ "description": "GCP project, as `projectRef.external` (default: GCP.ProjectId, resolved from GCP_PROJECT_ID at build)."
1131
+ },
1132
+ {
1133
+ "name": "vpc",
1134
+ "type": "{ name: string }",
1135
+ "required": true,
1136
+ "description": "VPC the service's egress goes into, such as a PrivateEgressNetwork's `vpc`."
1137
+ },
1138
+ {
1139
+ "name": "subnet",
1140
+ "type": "{ name: string }",
1141
+ "required": true,
1142
+ "description": "Subnet the service's egress goes into, such as a PrivateEgressNetwork's `subnet`."
1143
+ },
1144
+ {
1145
+ "name": "vpcEgress",
1146
+ "type": "string",
1147
+ "required": false,
1148
+ "description": "Egress sent through the VPC: \"PRIVATE_RANGES_ONLY\" or \"ALL_TRAFFIC\" (default: \"PRIVATE_RANGES_ONLY\")."
1149
+ },
1150
+ {
1151
+ "name": "port",
1152
+ "type": "number",
1153
+ "required": false,
1154
+ "description": "Port the container listens on (default: 8080)."
1155
+ },
1156
+ {
1157
+ "name": "frontendPort",
1158
+ "type": "number",
1159
+ "required": false,
1160
+ "description": "Port the HTTP forwarding rule listens on (default: 80)."
1161
+ },
1162
+ {
1163
+ "name": "minInstanceCount",
1164
+ "type": "number",
1165
+ "required": false,
1166
+ "description": "Minimum instances (default: 0)."
1167
+ },
1168
+ {
1169
+ "name": "maxInstanceCount",
1170
+ "type": "number",
1171
+ "required": false,
1172
+ "description": "Maximum instances (default: 100)."
1173
+ },
1174
+ {
1175
+ "name": "env",
1176
+ "type": "Array<{ name: string; value: string }>",
1177
+ "required": false,
1178
+ "description": "Environment variables."
1179
+ },
1180
+ {
1181
+ "name": "serviceAccount",
1182
+ "type": "string",
1183
+ "required": false,
1184
+ "description": "An existing service account to run as: an email, or the account id of an IAMServiceAccount in the project."
1185
+ },
1186
+ {
1187
+ "name": "domains",
1188
+ "type": "string[]",
1189
+ "required": false,
1190
+ "description": "Domains for a Google-managed certificate."
1191
+ },
1192
+ {
1193
+ "name": "securityPolicy",
1194
+ "type": "string",
1195
+ "required": false,
1196
+ "description": "Name of a ComputeSecurityPolicy (Cloud Armor) attached to the backend service."
1197
+ },
1198
+ {
1199
+ "name": "labels",
1200
+ "type": "Record<string, string>",
1201
+ "required": false,
1202
+ "description": "Additional labels."
1203
+ },
1204
+ {
1205
+ "name": "namespace",
1206
+ "type": "string",
1207
+ "required": false,
1208
+ "description": "Namespace for all resources."
1209
+ },
1210
+ {
1211
+ "name": "defaults",
1212
+ "type": "{ runtime?: Partial<ConstructorParameters<typeof GCPServiceAccount>[0]>; service?: Record<string, unknown>; publicAcc...",
1213
+ "required": false,
1214
+ "description": "Per-member defaults for customizing individual resources."
1215
+ }
1216
+ ]
1217
+ },
1031
1218
  {
1032
1219
  "name": "PubSubPipeline",
1033
1220
  "lexicon": "gcp",
@@ -28,4 +28,8 @@ export { GkeCrdbRegion } from "./gke-crdb-region.js";
28
28
  export type { GkeCrdbRegionConfig, GkeCrdbRegionNodeConfig } from "./gke-crdb-region.js";
29
29
  export { GpuNodePool } from "./gpu-node-pool.js";
30
30
  export type { GpuNodePoolProps, GpuNodePoolTaint } from "./gpu-node-pool.js";
31
+ export { PrivateEgressNetwork } from "./private-egress-network.js";
32
+ export type { PrivateEgressNetworkProps } from "./private-egress-network.js";
33
+ export { PublicCloudRun } from "./public-cloud-run.js";
34
+ export type { PublicCloudRunProps } from "./public-cloud-run.js";
31
35
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/composites/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACpG,YAAY,EACV,yBAAyB,EACzB,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,YAAY,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,YAAY,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,YAAY,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,YAAY,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,YA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E,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,YAAY,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -13,3 +13,5 @@ export { MemorystoreRedis } from "./memorystore-redis.js";
13
13
  export { MultiRegionVpc } from "./multi-region-vpc.js";
14
14
  export { GkeCrdbRegion } from "./gke-crdb-region.js";
15
15
  export { GpuNodePool } from "./gpu-node-pool.js";
16
+ export { PrivateEgressNetwork } from "./private-egress-network.js";
17
+ export { PublicCloudRun } from "./public-cloud-run.js";
@@ -0,0 +1,42 @@
1
+ /**
2
+ * PrivateEgressNetwork composite: a custom-mode VPC with one subnet a service sends its egress into.
3
+ */
4
+ import { VPCNetwork, Subnetwork } from "../generated/index.js";
5
+ export interface PrivateEgressNetworkProps {
6
+ /** Name prefix: the network is `<name>-vpc`, its subnet `<name>-apps`. */
7
+ name: string;
8
+ /** GCP region of the subnet. */
9
+ region: string;
10
+ /** IP CIDR range of the subnet. */
11
+ subnetCidr: string;
12
+ /** Enable private Google access on the subnet (default: true). */
13
+ privateIpGoogleAccess?: boolean;
14
+ /** Additional labels. */
15
+ labels?: Record<string, string>;
16
+ /** Namespace for all resources. */
17
+ namespace?: string;
18
+ /** Per-member defaults for customizing individual resources. */
19
+ defaults?: {
20
+ vpc?: Partial<ConstructorParameters<typeof VPCNetwork>[0]>;
21
+ subnet?: Partial<ConstructorParameters<typeof Subnetwork>[0]>;
22
+ };
23
+ }
24
+ /**
25
+ * Create a PrivateEgressNetwork composite.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * import { PrivateEgressNetwork } from "@intentius/chant-lexicon-gcp";
30
+ *
31
+ * const { vpc, subnet } = PrivateEgressNetwork({
32
+ * name: "web",
33
+ * region: "us-central1",
34
+ * subnetCidr: "10.10.0.0/24",
35
+ * });
36
+ * ```
37
+ */
38
+ export declare const PrivateEgressNetwork: import("@intentius/chant").CompositeDefinition<PrivateEgressNetworkProps, {
39
+ vpc: import("@intentius/chant").Declarable & Record<string, string>;
40
+ subnet: import("@intentius/chant").Declarable & Record<string, string>;
41
+ }>;
42
+ //# sourceMappingURL=private-egress-network.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"private-egress-network.d.ts","sourceRoot":"","sources":["../../src/composites/private-egress-network.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEtD,MAAM,WAAW,yBAAyB;IACxC,0EAA0E;IAC1E,IAAI,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,yBAAyB;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,mCAAmC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gEAAgE;IAChE,QAAQ,CAAC,EAAE;QACT,GAAG,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3D,MAAM,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAC/D,CAAC;CACH;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,oBAAoB;;;EAwCP,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * PrivateEgressNetwork composite: a custom-mode VPC with one subnet a service sends its egress into.
3
+ */
4
+ import { Composite, mergeDefaults } from "@intentius/chant";
5
+ import { VPCNetwork, Subnetwork } from "../generated/index.js";
6
+ /**
7
+ * Create a PrivateEgressNetwork composite.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import { PrivateEgressNetwork } from "@intentius/chant-lexicon-gcp";
12
+ *
13
+ * const { vpc, subnet } = PrivateEgressNetwork({
14
+ * name: "web",
15
+ * region: "us-central1",
16
+ * subnetCidr: "10.10.0.0/24",
17
+ * });
18
+ * ```
19
+ */
20
+ export const PrivateEgressNetwork = Composite((props) => {
21
+ const { name, region, subnetCidr, privateIpGoogleAccess = true, labels: extraLabels = {}, namespace, defaults: defs, } = props;
22
+ const commonLabels = {
23
+ "app.kubernetes.io/name": name,
24
+ "app.kubernetes.io/managed-by": "chant",
25
+ ...extraLabels,
26
+ };
27
+ const vpc = new VPCNetwork(mergeDefaults({
28
+ metadata: {
29
+ name: `${name}-vpc`,
30
+ ...(namespace && { namespace }),
31
+ labels: { ...commonLabels, "app.kubernetes.io/component": "network" },
32
+ },
33
+ autoCreateSubnetworks: false,
34
+ routingMode: "REGIONAL",
35
+ }, defs?.vpc));
36
+ const subnet = new Subnetwork(mergeDefaults({
37
+ metadata: {
38
+ name: `${name}-apps`,
39
+ ...(namespace && { namespace }),
40
+ labels: { ...commonLabels, "app.kubernetes.io/component": "subnet" },
41
+ },
42
+ region,
43
+ ipCidrRange: subnetCidr,
44
+ privateIpGoogleAccess,
45
+ networkRef: { name: vpc.name },
46
+ }, defs?.subnet));
47
+ return { vpc, subnet };
48
+ }, "PrivateEgressNetwork");
@@ -0,0 +1,85 @@
1
+ /**
2
+ * PublicCloudRun composite: a Cloud Run service behind a global external
3
+ * Application Load Balancer, running as its own service account with Direct
4
+ * VPC egress into a subnet.
5
+ */
6
+ import { BackendService, ComputeAddress, ForwardingRule, GCPServiceAccount, ManagedSSLCertificate, RegionNetworkEndpointGroup, TargetHTTPProxy, TargetHTTPSProxy, URLMap } from "../generated/index.js";
7
+ export interface PublicCloudRunProps {
8
+ /** Name prefix every resource is named with. */
9
+ name: string;
10
+ /** Container image. */
11
+ image: string;
12
+ /** GCP region of the service and its network endpoint group. */
13
+ region: string;
14
+ /** GCP project, as `projectRef.external` (default: GCP.ProjectId, resolved from GCP_PROJECT_ID at build). */
15
+ projectId?: string;
16
+ /** VPC the service's egress goes into, such as a PrivateEgressNetwork's `vpc`. */
17
+ vpc: {
18
+ name: string;
19
+ };
20
+ /** Subnet the service's egress goes into, such as a PrivateEgressNetwork's `subnet`. */
21
+ subnet: {
22
+ name: string;
23
+ };
24
+ /** Egress sent through the VPC: "PRIVATE_RANGES_ONLY" or "ALL_TRAFFIC" (default: "PRIVATE_RANGES_ONLY"). */
25
+ vpcEgress?: string;
26
+ /** Port the container listens on (default: 8080). */
27
+ port?: number;
28
+ /** Port the HTTP forwarding rule listens on (default: 80). */
29
+ frontendPort?: number;
30
+ /** Minimum instances (default: 0). */
31
+ minInstanceCount?: number;
32
+ /** Maximum instances (default: 100). */
33
+ maxInstanceCount?: number;
34
+ /** Environment variables. */
35
+ env?: Array<{
36
+ name: string;
37
+ value: string;
38
+ }>;
39
+ /** An existing service account to run as: an email, or the account id of an IAMServiceAccount in the project. When unset, the composite creates `<name>-run`. */
40
+ serviceAccount?: string;
41
+ /** Domains for a Google-managed certificate. When set, the composite adds an HTTPS proxy and a rule on 443, and the HTTP rule redirects to HTTPS. */
42
+ domains?: string[];
43
+ /** Name of a ComputeSecurityPolicy (Cloud Armor) attached to the backend service. */
44
+ securityPolicy?: string;
45
+ /** Additional labels. */
46
+ labels?: Record<string, string>;
47
+ /** Namespace for all resources. */
48
+ namespace?: string;
49
+ /** Per-member defaults for customizing individual resources. */
50
+ defaults?: {
51
+ runtime?: Partial<ConstructorParameters<typeof GCPServiceAccount>[0]>;
52
+ service?: Record<string, unknown>;
53
+ publicAccess?: Record<string, unknown>;
54
+ neg?: Partial<ConstructorParameters<typeof RegionNetworkEndpointGroup>[0]>;
55
+ backend?: Partial<ConstructorParameters<typeof BackendService>[0]>;
56
+ urlMap?: Partial<ConstructorParameters<typeof URLMap>[0]>;
57
+ proxy?: Partial<ConstructorParameters<typeof TargetHTTPProxy>[0]>;
58
+ address?: Partial<ConstructorParameters<typeof ComputeAddress>[0]>;
59
+ rule?: Partial<ConstructorParameters<typeof ForwardingRule>[0]>;
60
+ certificate?: Partial<ConstructorParameters<typeof ManagedSSLCertificate>[0]>;
61
+ httpsProxy?: Partial<ConstructorParameters<typeof TargetHTTPSProxy>[0]>;
62
+ httpsRule?: Partial<ConstructorParameters<typeof ForwardingRule>[0]>;
63
+ redirectMap?: Partial<ConstructorParameters<typeof URLMap>[0]>;
64
+ };
65
+ }
66
+ /**
67
+ * Create a PublicCloudRun composite.
68
+ *
69
+ * @example
70
+ * ```ts
71
+ * import { PrivateEgressNetwork, PublicCloudRun } from "@intentius/chant-lexicon-gcp";
72
+ *
73
+ * const network = PrivateEgressNetwork({ name: "web", region: "us-central1", subnetCidr: "10.10.0.0/24" });
74
+ * const web = PublicCloudRun({
75
+ * name: "web",
76
+ * projectId: "my-project",
77
+ * region: "us-central1",
78
+ * vpc: network.vpc,
79
+ * subnet: network.subnet,
80
+ * image: "us-docker.pkg.dev/my-project/web/site:1",
81
+ * });
82
+ * ```
83
+ */
84
+ export declare const PublicCloudRun: import("@intentius/chant").CompositeDefinition<PublicCloudRunProps, Record<string, any>>;
85
+ //# sourceMappingURL=public-cloud-run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-cloud-run.d.ts","sourceRoot":"","sources":["../../src/composites/public-cloud-run.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,cAAc,EACd,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EACrB,0BAA0B,EAC1B,eAAe,EACf,gBAAgB,EAChB,MAAM,EACP,MAAM,cAAc,CAAC;AAItB,MAAM,WAAW,mBAAmB;IAClC,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,MAAM,EAAE,MAAM,CAAC;IACf,6GAA6G;IAC7G,SA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