@intentius/chant-lexicon-azure 0.124.31 → 0.124.33

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 (144) hide show
  1. package/dist/actions/appservice.js +7 -0
  2. package/dist/actions/compute.js +9 -0
  3. package/dist/actions/container.js +14 -0
  4. package/dist/actions/identity.js +11 -0
  5. package/dist/actions/index.js +11 -0
  6. package/dist/actions/keyvault.js +12 -0
  7. package/dist/actions/network.js +9 -0
  8. package/dist/actions/sql.js +9 -0
  9. package/dist/actions/storage.js +15 -0
  10. package/dist/api/read-client.js +146 -0
  11. package/dist/codegen/docs-cli.js +2 -0
  12. package/dist/codegen/docs.js +83 -0
  13. package/dist/codegen/generate-cli.js +11 -0
  14. package/dist/codegen/generate-lexicon.js +77 -0
  15. package/dist/codegen/generate-typescript.js +163 -0
  16. package/dist/codegen/generate.js +106 -0
  17. package/dist/codegen/naming.js +139 -0
  18. package/dist/codegen/package.js +64 -0
  19. package/dist/composites/aks-cluster.js +68 -0
  20. package/dist/composites/app-service.js +62 -0
  21. package/dist/composites/application-gateway.js +107 -0
  22. package/dist/composites/catalog.js +856 -0
  23. package/dist/composites/container-instance.js +36 -0
  24. package/dist/composites/container-registry.js +62 -0
  25. package/dist/composites/cosmos-database.js +56 -0
  26. package/dist/composites/from-arm.js +47 -0
  27. package/dist/composites/function-app.js +57 -0
  28. package/dist/composites/index.js +16 -0
  29. package/dist/composites/keyvault.js +69 -0
  30. package/dist/composites/landing-zone.js +119 -0
  31. package/dist/composites/private-endpoint.js +61 -0
  32. package/dist/composites/redis-cache.js +21 -0
  33. package/dist/composites/service-bus-pipeline.js +54 -0
  34. package/dist/composites/sql-database.js +62 -0
  35. package/dist/composites/storage-account.js +59 -0
  36. package/dist/composites/vm-linux.js +139 -0
  37. package/dist/composites/vnet-default.js +102 -0
  38. package/dist/coverage.js +28 -0
  39. package/dist/deep-observe.js +356 -0
  40. package/dist/default-tags.js +50 -0
  41. package/dist/deploy-scopes.d.ts.map +1 -1
  42. package/dist/deploy-scopes.js +157 -0
  43. package/dist/describe-resources.js +187 -0
  44. package/dist/detect.js +17 -0
  45. package/dist/export-resources.js +108 -0
  46. package/dist/generated/index.d.ts.map +1 -1
  47. package/dist/generated/index.js +16598 -0
  48. package/dist/generated/runtime.js +4 -0
  49. package/dist/governance.js +144 -0
  50. package/dist/health.d.ts +42 -0
  51. package/dist/health.d.ts.map +1 -0
  52. package/dist/health.js +137 -0
  53. package/dist/import/generator.js +140 -0
  54. package/dist/import/live-export.js +39 -0
  55. package/dist/import/parser.js +192 -0
  56. package/dist/index.js +44 -0
  57. package/dist/integrity.json +5 -5
  58. package/dist/intrinsics.js +179 -0
  59. package/dist/lint/audit-catalog.js +36 -0
  60. package/dist/lint/audit-lineage.js +71 -0
  61. package/dist/lint/post-synth/arm-refs.d.ts +1 -0
  62. package/dist/lint/post-synth/arm-refs.d.ts.map +1 -1
  63. package/dist/lint/post-synth/arm-refs.js +96 -0
  64. package/dist/lint/post-synth/azr010.js +45 -0
  65. package/dist/lint/post-synth/azr011.js +43 -0
  66. package/dist/lint/post-synth/azr012.js +41 -0
  67. package/dist/lint/post-synth/azr013.js +50 -0
  68. package/dist/lint/post-synth/azr014.js +49 -0
  69. package/dist/lint/post-synth/azr015.js +66 -0
  70. package/dist/lint/post-synth/azr016.js +37 -0
  71. package/dist/lint/post-synth/azr017.js +37 -0
  72. package/dist/lint/post-synth/azr018.js +42 -0
  73. package/dist/lint/post-synth/azr019.js +41 -0
  74. package/dist/lint/post-synth/azr020.js +37 -0
  75. package/dist/lint/post-synth/azr021.js +36 -0
  76. package/dist/lint/post-synth/azr022.js +39 -0
  77. package/dist/lint/post-synth/azr023.js +39 -0
  78. package/dist/lint/post-synth/azr024.js +39 -0
  79. package/dist/lint/post-synth/azr025.js +37 -0
  80. package/dist/lint/post-synth/azr026.js +38 -0
  81. package/dist/lint/post-synth/azr027.js +37 -0
  82. package/dist/lint/post-synth/azr028.js +37 -0
  83. package/dist/lint/post-synth/azr029.js +38 -0
  84. package/dist/lint/post-synth/azr030.js +44 -0
  85. package/dist/lint/post-synth/azr031.js +36 -0
  86. package/dist/lint/post-synth/azr032.js +53 -0
  87. package/dist/lint/post-synth/azr033.js +35 -0
  88. package/dist/lint/post-synth/index.js +50 -0
  89. package/dist/lint/rules/hardcoded-location.js +82 -0
  90. package/dist/lint/rules/index.js +6 -0
  91. package/dist/lint/rules/nsg-wildcard.js +44 -0
  92. package/dist/lint/rules/storage-https.js +62 -0
  93. package/dist/lsp/completions.d.ts.map +1 -1
  94. package/dist/lsp/completions.js +18 -0
  95. package/dist/lsp/hover.d.ts.map +1 -1
  96. package/dist/lsp/hover.js +44 -0
  97. package/dist/manifest.json +1 -1
  98. package/dist/meta.json +6 -1
  99. package/dist/okf/types/containerApps.md +5 -0
  100. package/dist/op/activities/az-apply.js +563 -0
  101. package/dist/op/activities/azure.js +48 -0
  102. package/dist/op/activities/floci-az.js +37 -0
  103. package/dist/op/activities/index.js +10 -0
  104. package/dist/op/builders.js +70 -0
  105. package/dist/ownership.js +13 -0
  106. package/dist/package-cli.js +21 -0
  107. package/dist/parameter.js +13 -0
  108. package/dist/plugin.d.ts.map +1 -1
  109. package/dist/plugin.js +478 -0
  110. package/dist/pseudo.js +40 -0
  111. package/dist/rules/arm-refs.ts +5 -3
  112. package/dist/serializer.d.ts +7 -0
  113. package/dist/serializer.d.ts.map +1 -1
  114. package/dist/serializer.js +543 -0
  115. package/dist/spec/api-versions.js +130 -0
  116. package/dist/spec/fetch.js +196 -0
  117. package/dist/spec/parse.d.ts.map +1 -1
  118. package/dist/spec/parse.js +318 -0
  119. package/dist/taggable.js +34 -0
  120. package/dist/types/index.d.ts +5 -0
  121. package/dist/validate-cli.js +16 -0
  122. package/dist/validate.js +53 -0
  123. package/package.json +8 -8
  124. package/src/attributes.test.ts +17 -0
  125. package/src/codegen/generate-typescript.ts +1 -1
  126. package/src/codegen/generate.ts +1 -1
  127. package/src/codegen/package.ts +2 -2
  128. package/src/deploy-scopes.ts +2 -1
  129. package/src/generated/index.d.ts +5 -0
  130. package/src/generated/index.ts +1 -1
  131. package/src/generated/lexicon-azure.json +6 -1
  132. package/src/health.test.ts +66 -0
  133. package/src/health.ts +162 -0
  134. package/src/lint/post-synth/arm-refs.ts +5 -3
  135. package/src/lint/post-synth/post-synth.test.ts +1 -1
  136. package/src/lsp/completions.ts +2 -1
  137. package/src/lsp/hover.ts +2 -1
  138. package/src/plugin.ts +11 -2
  139. package/src/serializer-names.test.ts +83 -0
  140. package/src/serializer-outputs.test.ts +65 -0
  141. package/src/serializer.ts +112 -30
  142. package/src/spec/parse.test.ts +15 -0
  143. package/src/spec/parse.ts +10 -0
  144. package/src/taggable.ts +2 -2
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Azure ARM generation pipeline — uses core generatePipeline
3
+ * with Azure-specific fetch, parse, naming, and generation callbacks.
4
+ */
5
+ import { generatePipeline, writeGeneratedArtifacts, } from "@intentius/chant/codegen/generate";
6
+ import { fetchArmSchemas } from "../spec/fetch.js";
7
+ import { parseArmSchema, armShortName } from "../spec/parse.js";
8
+ import { NamingStrategy, propertyTypeName, extractDefName } from "./naming.js";
9
+ import { generateLexiconJSON } from "./generate-lexicon.js";
10
+ import { generateTypeScriptDeclarations } from "./generate-typescript.js";
11
+ import { generateRuntimeIndex as coreGenerateRuntimeIndex, } from "@intentius/chant/codegen/generate-runtime-index";
12
+ const azurePipelineConfig = {
13
+ fetchSchemas: async (opts) => {
14
+ return fetchArmSchemas(opts.force);
15
+ },
16
+ parseSchema: (_typeName, data) => {
17
+ const result = parseArmSchema(data);
18
+ if (!result.resource.typeName)
19
+ return null;
20
+ return result;
21
+ },
22
+ createNaming: (results) => new NamingStrategy(results),
23
+ generateRegistry: (results, naming) => {
24
+ return generateLexiconJSON(results, naming);
25
+ },
26
+ generateTypes: (results, naming) => {
27
+ return generateTypeScriptDeclarations(results, naming);
28
+ },
29
+ generateRuntimeIndex: (results, naming) => {
30
+ return generateRuntimeIndex(results, naming);
31
+ },
32
+ };
33
+ /**
34
+ * Run the full Azure generation pipeline.
35
+ */
36
+ export async function generate(opts = {}) {
37
+ return generatePipeline(azurePipelineConfig, opts);
38
+ }
39
+ /**
40
+ * Write generated artifacts to disk.
41
+ */
42
+ export function writeGeneratedFiles(result, baseDir) {
43
+ writeGeneratedArtifacts({
44
+ baseDir,
45
+ files: {
46
+ "lexicon-azure.json": result.lexiconJSON,
47
+ "index.d.ts": result.typesDTS,
48
+ "index.ts": result.indexTS,
49
+ "runtime.ts": [
50
+ "/**",
51
+ " * Runtime factory constructors — re-exported from core.",
52
+ " */",
53
+ 'export { createResource, createProperty } from "@intentius/chant/runtime";',
54
+ "",
55
+ ].join("\n"),
56
+ },
57
+ });
58
+ }
59
+ /**
60
+ * Generate the runtime index.ts with factory constructor exports.
61
+ */
62
+ function generateRuntimeIndex(results, naming) {
63
+ const resourceEntries = [];
64
+ const propertyEntries = [];
65
+ for (const r of results) {
66
+ const armType = r.resource.typeName;
67
+ const tsName = naming.resolve(armType);
68
+ if (!tsName)
69
+ continue;
70
+ // Build attrs map
71
+ const attrs = {};
72
+ for (const a of r.resource.attributes) {
73
+ attrs[a.name.replace(/\./g, "_")] = a.name;
74
+ }
75
+ resourceEntries.push({ tsName, resourceType: armType, attrs });
76
+ for (const alias of naming.aliases(armType)) {
77
+ resourceEntries.push({ tsName: alias, resourceType: armType, attrs });
78
+ }
79
+ // Property types
80
+ const shortName = armShortName(armType);
81
+ const ptAliases = naming.propertyTypeAliases(armType);
82
+ for (const pt of r.propertyTypes) {
83
+ const defName = extractDefName(pt.name, shortName);
84
+ const ptName = propertyTypeName(tsName, defName);
85
+ const ptArmType = `${armType}.${pt.specType}`;
86
+ propertyEntries.push({ tsName: ptName, resourceType: ptArmType });
87
+ if (ptAliases) {
88
+ const aliasName = ptAliases.get(defName);
89
+ if (aliasName) {
90
+ propertyEntries.push({ tsName: aliasName, resourceType: ptArmType });
91
+ }
92
+ }
93
+ }
94
+ }
95
+ return coreGenerateRuntimeIndex(resourceEntries, propertyEntries, {
96
+ lexiconName: "azure",
97
+ intrinsicReExports: {
98
+ names: ["ResourceId", "Reference", "Concat", "ResourceGroup", "Subscription", "UniqueString", "Format", "If", "ListKeys"],
99
+ from: "../intrinsics",
100
+ },
101
+ pseudoReExports: {
102
+ names: ["Azure", "ResourceGroupName", "ResourceGroupLocation", "ResourceGroupId", "SubscriptionId", "TenantId", "DeploymentName"],
103
+ from: "../pseudo",
104
+ },
105
+ });
106
+ }
@@ -0,0 +1,139 @@
1
+ /**
2
+ * Azure-specific naming configuration for the core NamingStrategy.
3
+ *
4
+ * The algorithm lives in core; only the data tables and helper functions
5
+ * for extracting names from Azure resource types are defined here.
6
+ */
7
+ import { NamingStrategy as CoreNamingStrategy, } from "@intentius/chant/codegen/naming";
8
+ export { propertyTypeName, extractDefName } from "@intentius/chant/codegen/naming";
9
+ import { armShortName, armServiceName } from "../spec/parse.js";
10
+ /**
11
+ * Fixed TypeScript class names for core Azure resources.
12
+ */
13
+ const priorityNames = {
14
+ "Microsoft.Storage/storageAccounts": "StorageAccount",
15
+ "Microsoft.Compute/virtualMachines": "VirtualMachine",
16
+ "Microsoft.Network/virtualNetworks": "VirtualNetwork",
17
+ "Microsoft.Network/networkSecurityGroups": "NetworkSecurityGroup",
18
+ "Microsoft.Network/publicIPAddresses": "PublicIPAddress",
19
+ "Microsoft.Network/networkInterfaces": "NetworkInterface",
20
+ "Microsoft.Network/loadBalancers": "LoadBalancer",
21
+ "Microsoft.Network/routeTables": "RouteTable",
22
+ "Microsoft.Web/serverfarms": "AppServicePlan",
23
+ "Microsoft.Web/sites": "WebApp",
24
+ "Microsoft.Sql/servers": "SqlServer",
25
+ "Microsoft.Sql/servers_databases": "SqlDatabase",
26
+ "Microsoft.Sql/servers_firewallRules": "SqlFirewallRule",
27
+ "Microsoft.KeyVault/vaults": "KeyVault",
28
+ "Microsoft.ContainerService/managedClusters": "ManagedCluster",
29
+ "Microsoft.ContainerRegistry/registries": "ContainerRegistry",
30
+ "Microsoft.DocumentDB/databaseAccounts": "CosmosDbAccount",
31
+ "Microsoft.Compute/disks": "ManagedDisk",
32
+ "Microsoft.Compute/availabilitySets": "AvailabilitySet",
33
+ "Microsoft.Network/applicationGateways": "ApplicationGateway",
34
+ "Microsoft.Network/privateDnsZones": "PrivateDnsZone",
35
+ "Microsoft.Network/dnsZones": "DnsZone",
36
+ "Microsoft.ManagedIdentity/userAssignedIdentities": "ManagedIdentity",
37
+ "Microsoft.Authorization/roleAssignments": "RoleAssignment",
38
+ "Microsoft.Authorization/roleDefinitions": "RoleDefinition",
39
+ "Microsoft.Authorization/policyDefinitions": "PolicyDefinition",
40
+ "Microsoft.Authorization/policyAssignments": "PolicyAssignment",
41
+ "Microsoft.Authorization/policySetDefinitions": "PolicySetDefinition",
42
+ "Microsoft.Authorization/policyExemptions": "PolicyExemption",
43
+ "Microsoft.Management/managementGroups": "ManagementGroup",
44
+ "Microsoft.Management/managementGroups_subscriptions": "ManagementGroupSubscription",
45
+ "Microsoft.Subscription/aliases": "SubscriptionAlias",
46
+ "Microsoft.Insights/diagnosticSettings": "DiagnosticSetting",
47
+ "Microsoft.Insights/components": "AppInsights",
48
+ "Microsoft.OperationalInsights/workspaces": "LogAnalyticsWorkspace",
49
+ "Microsoft.EventHub/namespaces": "EventHubNamespace",
50
+ "Microsoft.ServiceBus/namespaces": "ServiceBusNamespace",
51
+ "Microsoft.Cache/redis": "RedisCache",
52
+ "Microsoft.Cdn/profiles": "CdnProfile",
53
+ "Microsoft.SignalRService/signalR": "SignalR",
54
+ "Microsoft.Storage/storageAccounts_blobServices_containers": "BlobContainer",
55
+ "Microsoft.Network/virtualNetworks_subnets": "Subnet",
56
+ "Microsoft.Network/trafficmanagerprofiles": "TrafficManagerProfile",
57
+ "Microsoft.Compute/virtualMachineScaleSets": "VirtualMachineScaleSet",
58
+ "Microsoft.Resources/deployments": "Deployment",
59
+ };
60
+ /**
61
+ * Additional TypeScript names beyond the primary priority name.
62
+ */
63
+ const priorityAliases = {
64
+ "Microsoft.Web/sites": ["AppService"],
65
+ "Microsoft.ContainerService/managedClusters": ["AksCluster"],
66
+ "Microsoft.DocumentDB/databaseAccounts": ["CosmosDb"],
67
+ "Microsoft.ManagedIdentity/userAssignedIdentities": ["UserAssignedIdentity"],
68
+ };
69
+ /**
70
+ * Property type aliases for backward compatibility.
71
+ */
72
+ const priorityPropertyAliases = {
73
+ "Microsoft.Storage/storageAccounts": {
74
+ Encryption: "StorageEncryption",
75
+ NetworkRuleSet: "StorageNetworkRules",
76
+ Sku: "Sku",
77
+ },
78
+ "Microsoft.Compute/virtualMachines": {
79
+ HardwareProfile: "HardwareProfile",
80
+ StorageProfile: "StorageProfile",
81
+ OSProfile: "OsProfile",
82
+ NetworkProfile: "NetworkProfile",
83
+ OSDisk: "OsDisk",
84
+ ImageReference: "ImageReference",
85
+ },
86
+ "Microsoft.Compute/virtualMachineScaleSets": {
87
+ VirtualMachineScaleSetIdentity: "Identity",
88
+ },
89
+ "Microsoft.Network/networkSecurityGroups": {
90
+ CommonSecurityRule: "SecurityRule",
91
+ },
92
+ "Microsoft.Network/virtualNetworks_subnets": {
93
+ CommonSubnetPropertiesFormat: "SubnetProperties",
94
+ },
95
+ "Microsoft.Network/networkInterfaces": {
96
+ CommonNetworkInterfaceIPConfiguration: "IpConfiguration",
97
+ },
98
+ "Microsoft.Sql/servers_databases": {
99
+ Sku: "SqlSku",
100
+ },
101
+ "Microsoft.Web/sites": {
102
+ SiteConfig: "SiteConfig",
103
+ },
104
+ };
105
+ /**
106
+ * Service name abbreviations for collision-resolved names.
107
+ */
108
+ const serviceAbbreviations = {
109
+ ContainerService: "Aks",
110
+ ContainerRegistry: "Acr",
111
+ OperationalInsights: "Oi",
112
+ ManagedIdentity: "Mi",
113
+ Authorization: "Auth",
114
+ DocumentDB: "Cosmos",
115
+ SignalRService: "Sr",
116
+ ServiceBus: "Sb",
117
+ EventHub: "Eh",
118
+ Insights: "Ai",
119
+ };
120
+ const azureNamingConfig = {
121
+ priorityNames,
122
+ priorityAliases,
123
+ priorityPropertyAliases,
124
+ serviceAbbreviations,
125
+ shortName: armShortName,
126
+ serviceName: armServiceName,
127
+ };
128
+ /**
129
+ * Azure-specific NamingStrategy — wraps the core algorithm with Azure data tables.
130
+ */
131
+ export class NamingStrategy extends CoreNamingStrategy {
132
+ constructor(results) {
133
+ const inputs = results.map((r) => ({
134
+ typeName: r.resource.typeName,
135
+ propertyTypes: r.propertyTypes,
136
+ }));
137
+ super(inputs, azureNamingConfig);
138
+ }
139
+ }
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Azure lexicon packaging — delegates to core packagePipeline
3
+ * with Azure-specific manifest building and skill collection.
4
+ */
5
+ import { readFileSync } from "fs";
6
+ import { azurePlugin } from "../plugin.js";
7
+ import { dirname } from "path";
8
+ import { moduleSourceDir } from "@intentius/chant/module-source";
9
+ import { packagePipeline, collectSkills, } from "@intentius/chant/codegen/package";
10
+ import { generate } from "./generate.js";
11
+ const pkgDir = dirname(moduleSourceDir(import.meta.url));
12
+ /**
13
+ * Map intrinsic name to its ARM output key.
14
+ */
15
+ function intrinsicOutputKey(name) {
16
+ return name;
17
+ }
18
+ /**
19
+ * Package the Azure lexicon into a distributable BundleSpec.
20
+ */
21
+ export async function packageLexicon(opts = {}) {
22
+ const pkgJson = JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf-8"));
23
+ return packagePipeline({
24
+ generate: (genOpts) => generate({ verbose: genOpts.verbose, force: genOpts.force }),
25
+ buildManifest: (_genResult) => {
26
+ // Lazy-import to avoid circular dependency
27
+ // Trust the plugin's own `isTag` registration (chant #1067) instead
28
+ // of hardcoding `false` for every entry regardless of what
29
+ // ../plugin.ts declares — see aws's codegen/package.ts for the bug
30
+ // this pattern produced (#1039) when the two sources disagree.
31
+ const intrinsics = (azurePlugin.intrinsics?.() ?? []).map((i) => ({
32
+ name: i.name,
33
+ description: i.description,
34
+ outputKey: intrinsicOutputKey(i.name),
35
+ isTag: i.isTag,
36
+ // chant #1044 — carried through verbatim for the same reason as
37
+ // `isTag`: the packaged manifest is what a consumer reads to
38
+ // learn which intrinsics fold, so recomputing it here would be a
39
+ // second source of truth able to drift from ../plugin.ts.
40
+ foldsAsCall: i.foldsAsCall,
41
+ }));
42
+ const pseudoParams = azurePlugin.pseudoParameters?.() ?? [];
43
+ const pseudoParameters = {};
44
+ for (const p of pseudoParams) {
45
+ const shortName = p.split(".").pop();
46
+ pseudoParameters[shortName] = p;
47
+ }
48
+ return {
49
+ name: "azure",
50
+ version: pkgJson.version ?? "0.0.0",
51
+ chantVersion: ">=0.1.0",
52
+ namespace: "Azure",
53
+ intrinsics,
54
+ pseudoParameters,
55
+ };
56
+ },
57
+ srcDir: pkgDir,
58
+ collectSkills: () => {
59
+ const skillDefs = azurePlugin.skills?.() ?? [];
60
+ return collectSkills(skillDefs);
61
+ },
62
+ version: pkgJson.version ?? "0.0.0",
63
+ }, opts);
64
+ }
@@ -0,0 +1,68 @@
1
+ /**
2
+ * AksCluster composite — Azure Kubernetes Service cluster.
3
+ *
4
+ * A higher-level construct for deploying an AKS cluster with
5
+ * managed identity, RBAC, and a default node pool.
6
+ */
7
+ import { Composite, mergeDefaults } from "@intentius/chant";
8
+ import { AksCluster as AksClusterResource } from "../generated/index.js";
9
+ /**
10
+ * Create an AksCluster composite — returns an AKS managed cluster
11
+ * with production defaults.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * import { AksCluster } from "@intentius/chant-lexicon-azure";
16
+ *
17
+ * const { cluster } = AksCluster({
18
+ * name: "my-aks",
19
+ * nodeCount: 5,
20
+ * vmSize: "Standard_D4s_v5",
21
+ * kubernetesVersion: "1.29",
22
+ * });
23
+ *
24
+ * export { cluster };
25
+ * ```
26
+ */
27
+ export const AksCluster = Composite((props) => {
28
+ const { name, nodeCount = 3, vmSize = "Standard_D2s_v5", kubernetesVersion = "1.28", location = "[resourceGroup().location]", tags = {}, defaults, } = props;
29
+ const commonTags = {
30
+ "managed-by": "chant",
31
+ ...tags,
32
+ };
33
+ const dnsPrefix = name;
34
+ const cluster = new AksClusterResource(mergeDefaults({
35
+ name,
36
+ location,
37
+ tags: commonTags,
38
+ identity: {
39
+ type: "SystemAssigned",
40
+ },
41
+ kubernetesVersion,
42
+ dnsPrefix,
43
+ enableRBAC: true,
44
+ agentPoolProfiles: [
45
+ {
46
+ name: "default",
47
+ count: nodeCount,
48
+ vmSize,
49
+ osType: "Linux",
50
+ mode: "System",
51
+ enableAutoScaling: false,
52
+ type: "VirtualMachineScaleSets",
53
+ },
54
+ ],
55
+ networkProfile: {
56
+ networkPlugin: "azure",
57
+ loadBalancerSku: "standard",
58
+ serviceCidr: "10.0.0.0/16",
59
+ dnsServiceIP: "10.0.0.10",
60
+ },
61
+ addonProfiles: {
62
+ omsagent: {
63
+ enabled: false,
64
+ },
65
+ },
66
+ }, defaults?.cluster), { apiVersion: "2023-08-01" });
67
+ return { cluster };
68
+ }, "AksCluster");
@@ -0,0 +1,62 @@
1
+ /**
2
+ * AppService composite — App Service Plan + Web App.
3
+ *
4
+ * A higher-level construct for deploying a Web App on Azure App Service
5
+ * with a plan and common defaults (HTTPS-only, TLS 1.2, managed identity).
6
+ */
7
+ import { Composite, mergeDefaults } from "@intentius/chant";
8
+ import { AppServicePlan, AppService as AppServiceResource } from "../generated/index.js";
9
+ /**
10
+ * Create an AppService composite — returns an App Service Plan and a Web App.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { AppService } from "@intentius/chant-lexicon-azure";
15
+ *
16
+ * const { plan, webApp } = AppService({
17
+ * name: "my-web-app",
18
+ * sku: "P1v3",
19
+ * runtime: "DOTNETCORE|8.0",
20
+ * tags: { environment: "staging" },
21
+ * });
22
+ *
23
+ * export { plan, webApp };
24
+ * ```
25
+ */
26
+ export const AppService = Composite((props) => {
27
+ const { name, sku = "B1", runtime = "NODE|18-lts", location = "[resourceGroup().location]", tags = {}, defaults, } = props;
28
+ const commonTags = {
29
+ "managed-by": "chant",
30
+ ...tags,
31
+ };
32
+ const planName = `${name}-plan`;
33
+ const plan = new AppServicePlan(mergeDefaults({
34
+ name: planName,
35
+ location,
36
+ tags: commonTags,
37
+ sku: {
38
+ name: sku,
39
+ },
40
+ kind: "linux",
41
+ reserved: true,
42
+ }, defaults?.plan), { apiVersion: "2022-09-01" });
43
+ const webApp = new AppServiceResource(mergeDefaults({
44
+ name,
45
+ location,
46
+ tags: commonTags,
47
+ kind: "app,linux",
48
+ identity: {
49
+ type: "SystemAssigned",
50
+ },
51
+ serverFarmId: `[resourceId('Microsoft.Web/serverfarms', '${planName}')]`,
52
+ httpsOnly: true,
53
+ siteConfig: {
54
+ linuxFxVersion: runtime,
55
+ minTlsVersion: "1.2",
56
+ ftpsState: "Disabled",
57
+ alwaysOn: true,
58
+ http20Enabled: true,
59
+ },
60
+ }, defaults?.webApp), { apiVersion: "2022-09-01" });
61
+ return { plan, webApp };
62
+ }, "AppService");
@@ -0,0 +1,107 @@
1
+ /**
2
+ * ApplicationGateway composite — Public IP + Application Gateway.
3
+ *
4
+ * Creates a Public IP and Application Gateway with WAF_v2 default SKU
5
+ * and TLS 1.2 policy.
6
+ */
7
+ import { Composite, mergeDefaults } from "@intentius/chant";
8
+ import { PublicIPAddress, ApplicationGateway as ApplicationGatewayResource, } from "../generated/index.js";
9
+ export const ApplicationGateway = Composite((props) => {
10
+ const { name, location = "[resourceGroup().location]", subnetId = "[resourceId('Microsoft.Network/virtualNetworks/subnets', 'vnet', 'appgw-subnet')]", sku = "WAF_v2", tags = {}, defaults, } = props;
11
+ const mergedTags = { "managed-by": "chant", ...tags };
12
+ const publicIp = new PublicIPAddress(mergeDefaults({
13
+ name: `${name}-pip`,
14
+ location,
15
+ tags: mergedTags,
16
+ sku: { name: "Standard" },
17
+ publicIPAllocationMethod: "Static",
18
+ }, defaults?.publicIp), { apiVersion: "2023-05-01" });
19
+ const gateway = new ApplicationGatewayResource(mergeDefaults({
20
+ name,
21
+ location,
22
+ tags: mergedTags,
23
+ sku: {
24
+ name: sku,
25
+ tier: sku,
26
+ capacity: 2,
27
+ },
28
+ sslPolicy: {
29
+ policyType: "Predefined",
30
+ policyName: "AppGwSslPolicy20220101",
31
+ minProtocolVersion: "TLSv1_2",
32
+ },
33
+ gatewayIPConfigurations: [
34
+ {
35
+ name: "appGatewayIpConfig",
36
+ properties: {
37
+ subnet: { id: subnetId },
38
+ },
39
+ },
40
+ ],
41
+ frontendIPConfigurations: [
42
+ {
43
+ name: "appGwPublicFrontendIp",
44
+ properties: {
45
+ publicIPAddress: {
46
+ id: `[resourceId('Microsoft.Network/publicIPAddresses', '${name}-pip')]`,
47
+ },
48
+ },
49
+ },
50
+ ],
51
+ frontendPorts: [
52
+ { name: "port_80", properties: { port: 80 } },
53
+ ],
54
+ backendAddressPools: [
55
+ { name: "defaultBackendPool", properties: {} },
56
+ ],
57
+ backendHttpSettingsCollection: [
58
+ {
59
+ name: "defaultHttpSettings",
60
+ properties: {
61
+ port: 80,
62
+ protocol: "Http",
63
+ cookieBasedAffinity: "Disabled",
64
+ requestTimeout: 30,
65
+ },
66
+ },
67
+ ],
68
+ httpListeners: [
69
+ {
70
+ name: "defaultListener",
71
+ properties: {
72
+ frontendIPConfiguration: {
73
+ id: `[concat(resourceId('Microsoft.Network/applicationGateways', '${name}'), '/frontendIPConfigurations/appGwPublicFrontendIp')]`,
74
+ },
75
+ frontendPort: {
76
+ id: `[concat(resourceId('Microsoft.Network/applicationGateways', '${name}'), '/frontendPorts/port_80')]`,
77
+ },
78
+ protocol: "Http",
79
+ },
80
+ },
81
+ ],
82
+ requestRoutingRules: [
83
+ {
84
+ name: "defaultRule",
85
+ properties: {
86
+ ruleType: "Basic",
87
+ priority: 100,
88
+ httpListener: {
89
+ id: `[concat(resourceId('Microsoft.Network/applicationGateways', '${name}'), '/httpListeners/defaultListener')]`,
90
+ },
91
+ backendAddressPool: {
92
+ id: `[concat(resourceId('Microsoft.Network/applicationGateways', '${name}'), '/backendAddressPools/defaultBackendPool')]`,
93
+ },
94
+ backendHttpSettings: {
95
+ id: `[concat(resourceId('Microsoft.Network/applicationGateways', '${name}'), '/backendHttpSettingsCollection/defaultHttpSettings')]`,
96
+ },
97
+ },
98
+ },
99
+ ],
100
+ }, defaults?.gateway), {
101
+ apiVersion: "2023-05-01",
102
+ DependsOn: [
103
+ `[resourceId('Microsoft.Network/publicIPAddresses', '${name}-pip')]`,
104
+ ],
105
+ });
106
+ return { publicIp, gateway };
107
+ }, "ApplicationGateway");