@microsoft/terraform-cdk-constructs 2.2.0 → 2.5.1

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 (259) hide show
  1. package/.jsii +64029 -35477
  2. package/API.md +89314 -49618
  3. package/README.md +15 -0
  4. package/cdktf.json +1 -1
  5. package/docs/azure-api-version-update-pipeline.md +271 -0
  6. package/lib/azure-actiongroup/lib/action-group.js +1 -1
  7. package/lib/azure-activitylogalert/lib/activity-log-alert.js +1 -1
  8. package/lib/azure-aks/lib/aks-cluster.js +1 -1
  9. package/lib/azure-applicationinsights/index.d.ts +7 -0
  10. package/lib/azure-applicationinsights/index.js +24 -0
  11. package/lib/azure-applicationinsights/lib/application-insights-schemas.d.ts +29 -0
  12. package/lib/azure-applicationinsights/lib/application-insights-schemas.js +162 -0
  13. package/lib/azure-applicationinsights/lib/application-insights.d.ts +206 -0
  14. package/lib/azure-applicationinsights/lib/application-insights.js +209 -0
  15. package/lib/azure-applicationinsights/lib/index.d.ts +5 -0
  16. package/lib/azure-applicationinsights/lib/index.js +22 -0
  17. package/lib/azure-applicationinsights/test/application-insights.integ.d.ts +9 -0
  18. package/lib/azure-applicationinsights/test/application-insights.integ.js +84 -0
  19. package/lib/azure-applicationinsights/test/application-insights.spec.d.ts +8 -0
  20. package/lib/azure-applicationinsights/test/application-insights.spec.js +209 -0
  21. package/lib/azure-containerapps/lib/container-app-environment-schemas.d.ts +1 -1
  22. package/lib/azure-containerapps/lib/container-app-environment-schemas.js +2 -2
  23. package/lib/azure-containerapps/lib/container-app-environment.js +1 -1
  24. package/lib/azure-containerapps/lib/container-app-schemas.d.ts +1 -1
  25. package/lib/azure-containerapps/lib/container-app-schemas.js +2 -2
  26. package/lib/azure-containerapps/lib/container-app.js +1 -1
  27. package/lib/azure-containerapps/lib/container-apps-job-schemas.d.ts +8 -0
  28. package/lib/azure-containerapps/lib/container-apps-job-schemas.js +179 -0
  29. package/lib/azure-containerapps/lib/container-apps-job.d.ts +128 -0
  30. package/lib/azure-containerapps/lib/container-apps-job.js +81 -0
  31. package/lib/azure-containerapps/lib/index.d.ts +2 -0
  32. package/lib/azure-containerapps/lib/index.js +3 -1
  33. package/lib/azure-containerapps/test/container-apps-job.integ.d.ts +6 -0
  34. package/lib/azure-containerapps/test/container-apps-job.integ.js +95 -0
  35. package/lib/azure-containerapps/test/container-apps-job.spec.d.ts +1 -0
  36. package/lib/azure-containerapps/test/container-apps-job.spec.js +261 -0
  37. package/lib/azure-containerregistry/index.d.ts +1 -0
  38. package/lib/azure-containerregistry/index.js +18 -0
  39. package/lib/azure-containerregistry/lib/container-registry-schemas.d.ts +32 -0
  40. package/lib/azure-containerregistry/lib/container-registry-schemas.js +316 -0
  41. package/lib/azure-containerregistry/lib/container-registry.d.ts +330 -0
  42. package/lib/azure-containerregistry/lib/container-registry.js +217 -0
  43. package/lib/azure-containerregistry/lib/index.d.ts +2 -0
  44. package/lib/azure-containerregistry/lib/index.js +19 -0
  45. package/lib/azure-containerregistry/test/container-registry.integ.d.ts +9 -0
  46. package/lib/azure-containerregistry/test/container-registry.integ.js +101 -0
  47. package/lib/azure-containerregistry/test/container-registry.spec.d.ts +4 -0
  48. package/lib/azure-containerregistry/test/container-registry.spec.js +425 -0
  49. package/lib/azure-cosmosdb/index.d.ts +1 -0
  50. package/lib/azure-cosmosdb/index.js +18 -0
  51. package/lib/azure-cosmosdb/lib/cosmos-db-schemas.d.ts +40 -0
  52. package/lib/azure-cosmosdb/lib/cosmos-db-schemas.js +330 -0
  53. package/lib/azure-cosmosdb/lib/cosmos-db.d.ts +290 -0
  54. package/lib/azure-cosmosdb/lib/cosmos-db.js +222 -0
  55. package/lib/azure-cosmosdb/lib/index.d.ts +2 -0
  56. package/lib/azure-cosmosdb/lib/index.js +19 -0
  57. package/lib/azure-cosmosdb/test/cosmos-db.integ.d.ts +9 -0
  58. package/lib/azure-cosmosdb/test/cosmos-db.integ.js +98 -0
  59. package/lib/azure-cosmosdb/test/cosmos-db.spec.d.ts +4 -0
  60. package/lib/azure-cosmosdb/test/cosmos-db.spec.js +339 -0
  61. package/lib/azure-dataexplorer/index.d.ts +1 -0
  62. package/lib/azure-dataexplorer/index.js +18 -0
  63. package/lib/azure-dataexplorer/lib/data-explorer-cluster-schemas.d.ts +5 -0
  64. package/lib/azure-dataexplorer/lib/data-explorer-cluster-schemas.js +131 -0
  65. package/lib/azure-dataexplorer/lib/data-explorer-cluster.d.ts +54 -0
  66. package/lib/azure-dataexplorer/lib/data-explorer-cluster.js +91 -0
  67. package/lib/azure-dataexplorer/lib/data-explorer-database-schemas.d.ts +5 -0
  68. package/lib/azure-dataexplorer/lib/data-explorer-database-schemas.js +78 -0
  69. package/lib/azure-dataexplorer/lib/data-explorer-database.d.ts +24 -0
  70. package/lib/azure-dataexplorer/lib/data-explorer-database.js +68 -0
  71. package/lib/azure-dataexplorer/lib/data-explorer-table-schemas.d.ts +5 -0
  72. package/lib/azure-dataexplorer/lib/data-explorer-table-schemas.js +94 -0
  73. package/lib/azure-dataexplorer/lib/data-explorer-table.d.ts +25 -0
  74. package/lib/azure-dataexplorer/lib/data-explorer-table.js +62 -0
  75. package/lib/azure-dataexplorer/lib/index.d.ts +6 -0
  76. package/lib/azure-dataexplorer/lib/index.js +23 -0
  77. package/lib/azure-dataexplorer/test/data-explorer.integ.d.ts +1 -0
  78. package/lib/azure-dataexplorer/test/data-explorer.integ.js +78 -0
  79. package/lib/azure-dataexplorer/test/data-explorer.spec.d.ts +1 -0
  80. package/lib/azure-dataexplorer/test/data-explorer.spec.js +248 -0
  81. package/lib/azure-diagnosticsettings/lib/diagnostic-settings.js +1 -1
  82. package/lib/azure-dnsforwardingruleset/lib/dns-forwarding-ruleset.js +1 -1
  83. package/lib/azure-dnsforwardingruleset/lib/forwarding-rule.js +1 -1
  84. package/lib/azure-dnsforwardingruleset/lib/virtual-network-link.js +1 -1
  85. package/lib/azure-dnsresolver/lib/dns-resolver.js +1 -1
  86. package/lib/azure-dnsresolver/lib/inbound-endpoint.js +1 -1
  87. package/lib/azure-dnsresolver/lib/outbound-endpoint.js +1 -1
  88. package/lib/azure-dnszone/lib/dns-zone.js +1 -1
  89. package/lib/azure-dnszone/lib/records/dns-records.js +10 -10
  90. package/lib/azure-eventgrideventsubscription/index.d.ts +1 -0
  91. package/lib/azure-eventgrideventsubscription/index.js +18 -0
  92. package/lib/azure-eventgrideventsubscription/lib/event-grid-event-subscription-schemas.d.ts +5 -0
  93. package/lib/azure-eventgrideventsubscription/lib/event-grid-event-subscription-schemas.js +151 -0
  94. package/lib/azure-eventgrideventsubscription/lib/event-grid-event-subscription.d.ts +59 -0
  95. package/lib/azure-eventgrideventsubscription/lib/event-grid-event-subscription.js +67 -0
  96. package/lib/azure-eventgrideventsubscription/lib/index.d.ts +2 -0
  97. package/lib/azure-eventgrideventsubscription/lib/index.js +19 -0
  98. package/lib/azure-eventgrideventsubscription/test/event-grid-event-subscription.integ.d.ts +1 -0
  99. package/lib/azure-eventgrideventsubscription/test/event-grid-event-subscription.integ.js +100 -0
  100. package/lib/azure-eventgrideventsubscription/test/event-grid-event-subscription.spec.d.ts +1 -0
  101. package/lib/azure-eventgrideventsubscription/test/event-grid-event-subscription.spec.js +242 -0
  102. package/lib/azure-eventgridsystemtopic/index.d.ts +1 -0
  103. package/lib/azure-eventgridsystemtopic/index.js +18 -0
  104. package/lib/azure-eventgridsystemtopic/lib/event-grid-system-topic-schemas.d.ts +5 -0
  105. package/lib/azure-eventgridsystemtopic/lib/event-grid-system-topic-schemas.js +164 -0
  106. package/lib/azure-eventgridsystemtopic/lib/event-grid-system-topic.d.ts +46 -0
  107. package/lib/azure-eventgridsystemtopic/lib/event-grid-system-topic.js +68 -0
  108. package/lib/azure-eventgridsystemtopic/lib/index.d.ts +2 -0
  109. package/lib/azure-eventgridsystemtopic/lib/index.js +19 -0
  110. package/lib/azure-eventgridsystemtopic/test/event-grid-system-topic.integ.d.ts +1 -0
  111. package/lib/azure-eventgridsystemtopic/test/event-grid-system-topic.integ.js +64 -0
  112. package/lib/azure-eventgridsystemtopic/test/event-grid-system-topic.spec.d.ts +1 -0
  113. package/lib/azure-eventgridsystemtopic/test/event-grid-system-topic.spec.js +241 -0
  114. package/lib/azure-eventhub/index.d.ts +7 -0
  115. package/lib/azure-eventhub/index.js +24 -0
  116. package/lib/azure-eventhub/lib/event-hub-namespace.d.ts +204 -0
  117. package/lib/azure-eventhub/lib/event-hub-namespace.js +178 -0
  118. package/lib/azure-eventhub/lib/event-hub-schemas.d.ts +63 -0
  119. package/lib/azure-eventhub/lib/event-hub-schemas.js +370 -0
  120. package/lib/azure-eventhub/lib/event-hub.d.ts +153 -0
  121. package/lib/azure-eventhub/lib/event-hub.js +171 -0
  122. package/lib/azure-eventhub/lib/index.d.ts +6 -0
  123. package/lib/azure-eventhub/lib/index.js +23 -0
  124. package/lib/azure-eventhub/test/event-hub.integ.d.ts +9 -0
  125. package/lib/azure-eventhub/test/event-hub.integ.js +113 -0
  126. package/lib/azure-eventhub/test/event-hub.spec.d.ts +8 -0
  127. package/lib/azure-eventhub/test/event-hub.spec.js +438 -0
  128. package/lib/azure-functionapp/index.d.ts +1 -0
  129. package/lib/azure-functionapp/index.js +18 -0
  130. package/lib/azure-functionapp/lib/function-app-schemas.d.ts +32 -0
  131. package/lib/azure-functionapp/lib/function-app-schemas.js +303 -0
  132. package/lib/azure-functionapp/lib/function-app.d.ts +367 -0
  133. package/lib/azure-functionapp/lib/function-app.js +223 -0
  134. package/lib/azure-functionapp/lib/index.d.ts +2 -0
  135. package/lib/azure-functionapp/lib/index.js +19 -0
  136. package/lib/azure-functionapp/test/function-app.integ.d.ts +12 -0
  137. package/lib/azure-functionapp/test/function-app.integ.js +134 -0
  138. package/lib/azure-functionapp/test/function-app.spec.d.ts +4 -0
  139. package/lib/azure-functionapp/test/function-app.spec.js +566 -0
  140. package/lib/azure-keyvault/index.d.ts +1 -0
  141. package/lib/azure-keyvault/index.js +18 -0
  142. package/lib/azure-keyvault/lib/index.d.ts +2 -0
  143. package/lib/azure-keyvault/lib/index.js +19 -0
  144. package/lib/azure-keyvault/lib/key-vault-schemas.d.ts +40 -0
  145. package/lib/azure-keyvault/lib/key-vault-schemas.js +312 -0
  146. package/lib/azure-keyvault/lib/key-vault.d.ts +344 -0
  147. package/lib/azure-keyvault/lib/key-vault.js +243 -0
  148. package/lib/azure-keyvault/test/key-vault.integ.d.ts +9 -0
  149. package/lib/azure-keyvault/test/key-vault.integ.js +108 -0
  150. package/lib/azure-keyvault/test/key-vault.spec.d.ts +4 -0
  151. package/lib/azure-keyvault/test/key-vault.spec.js +264 -0
  152. package/lib/azure-loganalyticsworkspace/lib/log-analytics-workspace.js +1 -1
  153. package/lib/azure-metricalert/lib/metric-alert.js +1 -1
  154. package/lib/azure-networkinterface/lib/network-interface.js +1 -1
  155. package/lib/azure-networksecuritygroup/lib/network-security-group.js +1 -1
  156. package/lib/azure-networkwatcher/lib/network-watcher.js +1 -1
  157. package/lib/azure-policyassignment/lib/policy-assignment.js +1 -1
  158. package/lib/azure-policydefinition/lib/policy-definition.js +1 -1
  159. package/lib/azure-policysetdefinition/lib/policy-set-definition.js +1 -1
  160. package/lib/azure-privatednszone/lib/private-dns-zone.js +1 -1
  161. package/lib/azure-privatednszone/lib/records/private-dns-records.js +8 -8
  162. package/lib/azure-privatednszonelink/lib/private-dns-zone-link.js +1 -1
  163. package/lib/azure-publicipaddress/lib/public-ip-address.js +1 -1
  164. package/lib/azure-resourcegroup/lib/resource-group.js +1 -1
  165. package/lib/azure-roleassignment/lib/role-assignment.js +1 -1
  166. package/lib/azure-roledefinition/lib/role-definition.js +1 -1
  167. package/lib/azure-sreagent/index.d.ts +1 -0
  168. package/lib/azure-sreagent/index.js +18 -0
  169. package/lib/azure-sreagent/lib/index.d.ts +2 -0
  170. package/lib/azure-sreagent/lib/index.js +19 -0
  171. package/lib/azure-sreagent/lib/sre-agent-schemas.d.ts +29 -0
  172. package/lib/azure-sreagent/lib/sre-agent-schemas.js +296 -0
  173. package/lib/azure-sreagent/lib/sre-agent.d.ts +208 -0
  174. package/lib/azure-sreagent/lib/sre-agent.js +217 -0
  175. package/lib/azure-sreagent/test/sre-agent.integ.d.ts +9 -0
  176. package/lib/azure-sreagent/test/sre-agent.integ.js +78 -0
  177. package/lib/azure-sreagent/test/sre-agent.spec.d.ts +4 -0
  178. package/lib/azure-sreagent/test/sre-agent.spec.js +216 -0
  179. package/lib/azure-staticwebapp/index.d.ts +1 -0
  180. package/lib/azure-staticwebapp/index.js +18 -0
  181. package/lib/azure-staticwebapp/lib/index.d.ts +2 -0
  182. package/lib/azure-staticwebapp/lib/index.js +19 -0
  183. package/lib/azure-staticwebapp/lib/static-web-app-schemas.d.ts +40 -0
  184. package/lib/azure-staticwebapp/lib/static-web-app-schemas.js +236 -0
  185. package/lib/azure-staticwebapp/lib/static-web-app.d.ts +242 -0
  186. package/lib/azure-staticwebapp/lib/static-web-app.js +232 -0
  187. package/lib/azure-staticwebapp/test/static-web-app.integ.d.ts +9 -0
  188. package/lib/azure-staticwebapp/test/static-web-app.integ.js +76 -0
  189. package/lib/azure-staticwebapp/test/static-web-app.spec.d.ts +15 -0
  190. package/lib/azure-staticwebapp/test/static-web-app.spec.js +293 -0
  191. package/lib/azure-storageaccount/lib/storage-account.js +1 -1
  192. package/lib/azure-storageblobcontainer/index.d.ts +1 -0
  193. package/lib/azure-storageblobcontainer/index.js +18 -0
  194. package/lib/azure-storageblobcontainer/lib/index.d.ts +2 -0
  195. package/lib/azure-storageblobcontainer/lib/index.js +19 -0
  196. package/lib/azure-storageblobcontainer/lib/storage-blob-container-schemas.d.ts +5 -0
  197. package/lib/azure-storageblobcontainer/lib/storage-blob-container-schemas.js +108 -0
  198. package/lib/azure-storageblobcontainer/lib/storage-blob-container.d.ts +37 -0
  199. package/lib/azure-storageblobcontainer/lib/storage-blob-container.js +63 -0
  200. package/lib/azure-storageblobcontainer/test/storage-blob-container.integ.d.ts +1 -0
  201. package/lib/azure-storageblobcontainer/test/storage-blob-container.integ.js +60 -0
  202. package/lib/azure-storageblobcontainer/test/storage-blob-container.spec.d.ts +1 -0
  203. package/lib/azure-storageblobcontainer/test/storage-blob-container.spec.js +172 -0
  204. package/lib/azure-subnet/lib/subnet.js +1 -1
  205. package/lib/azure-userassignedidentity/index.d.ts +1 -0
  206. package/lib/azure-userassignedidentity/index.js +18 -0
  207. package/lib/azure-userassignedidentity/lib/index.d.ts +2 -0
  208. package/lib/azure-userassignedidentity/lib/index.js +19 -0
  209. package/lib/azure-userassignedidentity/lib/user-assigned-identity-schemas.d.ts +8 -0
  210. package/lib/azure-userassignedidentity/lib/user-assigned-identity-schemas.js +107 -0
  211. package/lib/azure-userassignedidentity/lib/user-assigned-identity.d.ts +37 -0
  212. package/lib/azure-userassignedidentity/lib/user-assigned-identity.js +85 -0
  213. package/lib/azure-userassignedidentity/test/user-assigned-identity.integ.d.ts +1 -0
  214. package/lib/azure-userassignedidentity/test/user-assigned-identity.integ.js +64 -0
  215. package/lib/azure-userassignedidentity/test/user-assigned-identity.spec.d.ts +1 -0
  216. package/lib/azure-userassignedidentity/test/user-assigned-identity.spec.js +241 -0
  217. package/lib/azure-virtualmachine/lib/virtual-machine.js +1 -1
  218. package/lib/azure-virtualnetwork/lib/virtual-network.js +1 -1
  219. package/lib/azure-virtualnetworkgateway/lib/virtual-network-gateway.js +1 -1
  220. package/lib/azure-virtualnetworkgatewayconnection/lib/virtual-network-gateway-connection.js +1 -1
  221. package/lib/azure-virtualnetworkmanager/lib/connectivity-configuration.js +1 -1
  222. package/lib/azure-virtualnetworkmanager/lib/ipam-pool-static-cidr.js +1 -1
  223. package/lib/azure-virtualnetworkmanager/lib/ipam-pool.js +1 -1
  224. package/lib/azure-virtualnetworkmanager/lib/network-group-static-member.js +1 -1
  225. package/lib/azure-virtualnetworkmanager/lib/network-group.js +1 -1
  226. package/lib/azure-virtualnetworkmanager/lib/security-admin-configuration.js +1 -1
  227. package/lib/azure-virtualnetworkmanager/lib/security-admin-rule-collection.js +1 -1
  228. package/lib/azure-virtualnetworkmanager/lib/security-admin-rule.js +1 -1
  229. package/lib/azure-virtualnetworkmanager/lib/virtual-network-manager.js +1 -1
  230. package/lib/azure-vmss/lib/virtual-machine-scale-set.d.ts +66 -1
  231. package/lib/azure-vmss/lib/virtual-machine-scale-set.js +141 -2
  232. package/lib/azure-vmss/lib/vmss-schemas.d.ts +195 -0
  233. package/lib/azure-vmss/lib/vmss-schemas.js +33 -1
  234. package/lib/azure-vmss/test/virtual-machine-scale-set.spec.js +463 -1
  235. package/lib/core-azure/lib/azapi/azapi-resource.js +2 -2
  236. package/lib/core-azure/lib/azapi/providers-azapi/data-azapi-client-config/index.js +4 -4
  237. package/lib/core-azure/lib/azapi/providers-azapi/data-azapi-resource/index.js +7 -7
  238. package/lib/core-azure/lib/azapi/providers-azapi/data-azapi-resource-action/index.js +2 -2
  239. package/lib/core-azure/lib/azapi/providers-azapi/data-azapi-resource-id/index.js +2 -2
  240. package/lib/core-azure/lib/azapi/providers-azapi/data-azapi-resource-list/index.js +2 -2
  241. package/lib/core-azure/lib/azapi/providers-azapi/data-plane-resource/index.js +2 -2
  242. package/lib/core-azure/lib/azapi/providers-azapi/provider/index.js +3 -3
  243. package/lib/core-azure/lib/azapi/providers-azapi/resource/index.js +7 -7
  244. package/lib/core-azure/lib/azapi/providers-azapi/resource-action/index.js +5 -5
  245. package/lib/core-azure/lib/azapi/providers-azapi/update-resource/index.js +5 -5
  246. package/lib/core-azure/lib/azapi/schema-mapper/schema-mapper.js +1 -1
  247. package/lib/core-azure/lib/version-manager/api-version-manager.js +1 -1
  248. package/lib/core-azure/lib/version-manager/interfaces/version-interfaces.js +7 -7
  249. package/lib/index.d.ts +39 -0
  250. package/lib/index.js +41 -2
  251. package/lib/testing/index.js +20 -3
  252. package/lib/testing/lib/cleanup.js +1 -1
  253. package/lib/testing/lib/metadata.js +12 -4
  254. package/lib/testing/lib/naming.js +57 -1
  255. package/package.json +1 -1
  256. package/scripts/azure-version-updater/create-issue.ts +189 -0
  257. package/scripts/azure-version-updater/discover.ts +382 -0
  258. package/scripts/azure-version-updater/spec-mapping.ts +164 -0
  259. package/scripts/azure-version-updater/tsconfig.json +11 -0
@@ -0,0 +1,189 @@
1
+ #!/usr/bin/env ts-node
2
+ /**
3
+ * Create Issue Body for GitHub Copilot Coding Agent
4
+ *
5
+ * Reads the version-manifest.json and generates a structured GitHub Issue body
6
+ * that provides the Copilot Coding Agent with all context needed to update
7
+ * the schema files, construct files, and tests.
8
+ *
9
+ * Usage:
10
+ * npx ts-node scripts/azure-version-updater/create-issue.ts version-manifest.json
11
+ *
12
+ * Outputs the issue body (markdown) to stdout for piping to `gh issue create --body-file -`.
13
+ */
14
+
15
+ /* eslint-disable @typescript-eslint/no-require-imports */
16
+ const fs = require("fs");
17
+
18
+ interface UpdateEntry {
19
+ schemaFile: string;
20
+ constructFile: string;
21
+ testFile: string;
22
+ resourceType: string;
23
+ namespace: string;
24
+ resourceTypeName: string;
25
+ prefix: string;
26
+ knownVersions: string[];
27
+ newVersions: string[];
28
+ specUrls: Record<string, string>;
29
+ }
30
+
31
+ interface VersionManifest {
32
+ updates: UpdateEntry[];
33
+ errors: Array<{ resourceType: string; error: string }>;
34
+ summary: {
35
+ totalConstructs: number;
36
+ constructsWithUpdates: number;
37
+ totalNewVersions: number;
38
+ discoveryDate: string;
39
+ };
40
+ }
41
+
42
+ function generateIssueBody(manifest: VersionManifest): string {
43
+ const lines: string[] = [];
44
+
45
+ lines.push("## Azure API Version Update\n");
46
+ lines.push(
47
+ `**Discovery date**: ${manifest.summary.discoveryDate}`,
48
+ );
49
+ lines.push(
50
+ `**Constructs with updates**: ${manifest.summary.constructsWithUpdates} of ${manifest.summary.totalConstructs}`,
51
+ );
52
+ lines.push(
53
+ `**Total new versions**: ${manifest.summary.totalNewVersions}\n`,
54
+ );
55
+
56
+ lines.push("---\n");
57
+ lines.push("## Instructions\n");
58
+ lines.push(
59
+ "For each construct listed below, add new API version support by following these steps:\n",
60
+ );
61
+ lines.push(
62
+ "1. **Read the existing schema file** to understand the pattern (property definitions, naming conventions, structure)",
63
+ );
64
+ lines.push(
65
+ "2. **Open the Azure REST API spec link** to check for property changes between the previous and new API version",
66
+ );
67
+ lines.push(
68
+ "3. **Create new `ApiSchema` and `VersionConfig` const exports** following the exact naming convention `{PREFIX}_SCHEMA_{VERSION_UNDERSCORED}` and `{PREFIX}_VERSION_{VERSION_UNDERSCORED}` (e.g., `RESOURCE_GROUP_SCHEMA_2025_05_01`)",
69
+ );
70
+ lines.push(
71
+ "4. **Add the new entries** to the `ALL_*_VERSIONS` array at the end",
72
+ );
73
+ lines.push(
74
+ "5. **Update `defaultVersion()`** in the construct file to return the newest version string",
75
+ );
76
+ lines.push(
77
+ "6. **Update unit tests** (`.spec.ts`) to include the new version in version list assertions and update the latest version expectation",
78
+ );
79
+ lines.push("7. **Run `npm test`** to verify all unit tests pass\n");
80
+
81
+ lines.push("### Key conventions\n");
82
+ lines.push(
83
+ "- New `ApiSchema` entries should spread `COMMON_PROPERTIES` (or the equivalent shared properties object in the file) and include any new properties from the API spec",
84
+ );
85
+ lines.push(
86
+ "- New `VersionConfig` entries should have `supportLevel: VersionSupportLevel.ACTIVE`",
87
+ );
88
+ lines.push(
89
+ "- Set `releaseDate` to today's date in `YYYY-MM-DD` format",
90
+ );
91
+ lines.push(
92
+ "- Add `changeLog` entries for any added, removed, or changed properties",
93
+ );
94
+ lines.push(
95
+ "- If the API spec shows no property changes, clone the previous version's schema exactly with only the version string updated\n",
96
+ );
97
+
98
+ lines.push("### Reference files\n");
99
+ lines.push(
100
+ "- **Schema pattern example**: `src/azure-resourcegroup/lib/resource-group-schemas.ts`",
101
+ );
102
+ lines.push(
103
+ "- **TypeScript interfaces**: `src/core-azure/lib/version-manager/interfaces/version-interfaces.ts`",
104
+ );
105
+ lines.push(
106
+ "- **Unit test pattern**: `src/azure-resourcegroup/test/resource-group.spec.ts`\n",
107
+ );
108
+
109
+ lines.push("---\n");
110
+ lines.push("## Constructs to Update\n");
111
+
112
+ for (let i = 0; i < manifest.updates.length; i++) {
113
+ const update = manifest.updates[i];
114
+ const latestKnown =
115
+ update.knownVersions[update.knownVersions.length - 1] || "none";
116
+
117
+ lines.push(
118
+ `### ${i + 1}. \`${update.resourceType}\` (prefix: \`${update.prefix}\`)\n`,
119
+ );
120
+ lines.push(`| Field | Value |`);
121
+ lines.push(`|-------|-------|`);
122
+ lines.push(`| Schema file | \`${update.schemaFile}\` |`);
123
+ if (update.constructFile) {
124
+ lines.push(`| Construct file | \`${update.constructFile}\` |`);
125
+ }
126
+ if (update.testFile) {
127
+ lines.push(`| Test file | \`${update.testFile}\` |`);
128
+ }
129
+ lines.push(
130
+ `| Known versions | ${update.knownVersions.map((v) => `\`${v}\``).join(", ")} |`,
131
+ );
132
+ lines.push(`| Current latest | \`${latestKnown}\` |`);
133
+ lines.push(
134
+ `| **New versions** | ${update.newVersions.map((v) => `**\`${v}\`**`).join(", ")} |`,
135
+ );
136
+ lines.push("");
137
+
138
+ // Spec links
139
+ if (Object.keys(update.specUrls).length > 0) {
140
+ lines.push("**Azure REST API Specs:**");
141
+ for (const [version, url] of Object.entries(update.specUrls)) {
142
+ lines.push(`- [${version}](${url})`);
143
+ }
144
+ lines.push("");
145
+ }
146
+ }
147
+
148
+ // Errors section
149
+ if (manifest.errors.length > 0) {
150
+ lines.push("---\n");
151
+ lines.push("## Discovery Errors\n");
152
+ lines.push(
153
+ "The following resource types could not be queried (may need manual review):\n",
154
+ );
155
+ for (const err of manifest.errors) {
156
+ lines.push(`- \`${err.resourceType}\`: ${err.error}`);
157
+ }
158
+ lines.push("");
159
+ }
160
+
161
+ lines.push("---\n");
162
+ lines.push(
163
+ "*This issue was automatically created by the [azure-version-update](.github/workflows/azure-version-update.yml) workflow.*",
164
+ );
165
+
166
+ return lines.join("\n");
167
+ }
168
+
169
+ function main(): void {
170
+ const manifestPath = process.argv[2];
171
+ if (!manifestPath) {
172
+ console.error("Usage: create-issue.ts <version-manifest.json>");
173
+ process.exit(1);
174
+ }
175
+
176
+ const manifest: VersionManifest = JSON.parse(
177
+ fs.readFileSync(manifestPath, "utf-8"),
178
+ );
179
+
180
+ if (manifest.updates.length === 0) {
181
+ console.error("No updates found in manifest. Nothing to do.");
182
+ process.exit(0);
183
+ }
184
+
185
+ const body = generateIssueBody(manifest);
186
+ console.log(body);
187
+ }
188
+
189
+ main();
@@ -0,0 +1,382 @@
1
+ #!/usr/bin/env ts-node
2
+ /**
3
+ * Azure API Version Discovery Script
4
+ *
5
+ * Scans all AZAPI construct schema files, queries the Azure ARM providers API
6
+ * for available API versions, and outputs a JSON manifest of new versions.
7
+ *
8
+ * Usage:
9
+ * npx ts-node scripts/azure-version-updater/discover.ts > version-manifest.json
10
+ *
11
+ * Prerequisites:
12
+ * - Must be authenticated with Azure (`az login` or OIDC in CI)
13
+ */
14
+
15
+ /* eslint-disable @typescript-eslint/no-require-imports */
16
+ const fs = require("fs");
17
+ const path = require("path");
18
+ const https = require("https");
19
+ const { execSync } = require("child_process");
20
+ const specMapping = require("./spec-mapping");
21
+
22
+ interface SchemaFileInfo {
23
+ schemaFile: string;
24
+ constructFile: string;
25
+ testFile: string;
26
+ resourceType: string;
27
+ namespace: string;
28
+ resourceTypeName: string;
29
+ prefix: string;
30
+ knownVersions: string[];
31
+ }
32
+
33
+ interface UpdateEntry extends SchemaFileInfo {
34
+ newVersions: string[];
35
+ specUrls: Record<string, string>;
36
+ }
37
+
38
+ interface VersionManifest {
39
+ updates: UpdateEntry[];
40
+ noUpdates: Array<{ resourceType: string; latestKnown: string }>;
41
+ errors: Array<{ resourceType: string; error: string }>;
42
+ summary: {
43
+ totalConstructs: number;
44
+ constructsWithUpdates: number;
45
+ totalNewVersions: number;
46
+ discoveryDate: string;
47
+ };
48
+ }
49
+
50
+ /**
51
+ * Scan all schema files and extract resource type info.
52
+ */
53
+ function scanSchemaFiles(): SchemaFileInfo[] {
54
+ const srcDir = path.resolve(__dirname, "../../src");
55
+ const results: SchemaFileInfo[] = [];
56
+
57
+ const azureDirs = fs
58
+ .readdirSync(srcDir)
59
+ .filter((d: string) => d.startsWith("azure-"))
60
+ .map((d: string) => path.join(srcDir, d));
61
+
62
+ for (const dir of azureDirs) {
63
+ const libDir = path.join(dir, "lib");
64
+ if (!fs.existsSync(libDir)) continue;
65
+
66
+ // Find all *-schemas.ts files recursively
67
+ const schemaFiles = findSchemaFiles(libDir);
68
+
69
+ for (const schemaFile of schemaFiles) {
70
+ const content = fs.readFileSync(schemaFile, "utf-8");
71
+ const infos = extractSchemaInfo(schemaFile, content, dir);
72
+ results.push(...infos);
73
+ }
74
+ }
75
+
76
+ return results;
77
+ }
78
+
79
+ function findSchemaFiles(dir: string): string[] {
80
+ const files: string[] = [];
81
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
82
+ const full = path.join(dir, entry.name);
83
+ if (entry.isDirectory()) {
84
+ files.push(...findSchemaFiles(full));
85
+ } else if (entry.name.endsWith("-schemas.ts")) {
86
+ files.push(full);
87
+ }
88
+ }
89
+ return files;
90
+ }
91
+
92
+ function extractSchemaInfo(
93
+ schemaFile: string,
94
+ content: string,
95
+ constructDir: string,
96
+ ): SchemaFileInfo[] {
97
+ const results: SchemaFileInfo[] = [];
98
+ const rootDir = path.resolve(__dirname, "../..");
99
+
100
+ // Extract all TYPE constants
101
+ const typeRegex = /export\s+const\s+(\w+)_TYPE\s*=\s*"([^"]+)"/g;
102
+ let match;
103
+ while ((match = typeRegex.exec(content)) !== null) {
104
+ const prefix = match[1];
105
+ const resourceType = match[2];
106
+ const parts = resourceType.split("/");
107
+ const namespace = parts[0];
108
+ const resourceTypeName = parts.slice(1).join("/");
109
+
110
+ // Extract known versions from this file for this resource type
111
+ // Match version strings in VersionConfig blocks
112
+ const versionRegex = /version:\s*"(\d{4}-\d{2}-\d{2})"/g;
113
+ const knownVersions = new Set<string>();
114
+ let vMatch;
115
+ while ((vMatch = versionRegex.exec(content)) !== null) {
116
+ knownVersions.add(vMatch[1]);
117
+ }
118
+
119
+ // Find corresponding construct and test files
120
+ const constructFile = findConstructFile(constructDir, prefix);
121
+ const testFile = findTestFile(constructDir, prefix);
122
+
123
+ results.push({
124
+ schemaFile: path.relative(rootDir, schemaFile),
125
+ constructFile: constructFile
126
+ ? path.relative(rootDir, constructFile)
127
+ : "",
128
+ testFile: testFile ? path.relative(rootDir, testFile) : "",
129
+ resourceType,
130
+ namespace,
131
+ resourceTypeName,
132
+ prefix,
133
+ knownVersions: Array.from(knownVersions.values()).sort(),
134
+ });
135
+ }
136
+
137
+ return results;
138
+ }
139
+
140
+ function findConstructFile(
141
+ constructDir: string,
142
+ _prefix: string,
143
+ ): string | null {
144
+ const libDir = path.join(constructDir, "lib");
145
+ if (!fs.existsSync(libDir)) return null;
146
+
147
+ // Look for .ts files (not -schemas.ts) that contain defaultVersion()
148
+ const tsFiles = fs
149
+ .readdirSync(libDir)
150
+ .filter((f: string) => f.endsWith(".ts") && !f.endsWith("-schemas.ts") && f !== "index.ts");
151
+
152
+ for (const f of tsFiles) {
153
+ const content = fs.readFileSync(path.join(libDir, f), "utf-8");
154
+ if (content.includes("defaultVersion()")) {
155
+ return path.join(libDir, f);
156
+ }
157
+ }
158
+ return null;
159
+ }
160
+
161
+ function findTestFile(constructDir: string, _prefix: string): string | null {
162
+ const testDir = path.join(constructDir, "test");
163
+ if (!fs.existsSync(testDir)) return null;
164
+
165
+ const specFiles = fs
166
+ .readdirSync(testDir)
167
+ .filter((f: string) => f.endsWith(".spec.ts"));
168
+ return specFiles.length > 0 ? path.join(testDir, specFiles[0]) : null;
169
+ }
170
+
171
+ /**
172
+ * Get an Azure access token using the CLI.
173
+ */
174
+ function getAccessToken(): string {
175
+ const result = execSync(
176
+ 'az account get-access-token --query accessToken -o tsv',
177
+ { encoding: "utf-8" },
178
+ );
179
+ return result.trim();
180
+ }
181
+
182
+ /**
183
+ * Fetch available API versions from the ARM providers endpoint.
184
+ */
185
+ async function fetchProviderVersions(
186
+ namespace: string,
187
+ token: string,
188
+ ): Promise<Record<string, string[]>> {
189
+ const url = `https://management.azure.com/providers/${namespace}?api-version=2024-11-01`;
190
+ const response = await httpGet(url, {
191
+ Authorization: `Bearer ${token}`,
192
+ });
193
+
194
+ const data = JSON.parse(response);
195
+ const result: Record<string, string[]> = {};
196
+
197
+ if (data.resourceTypes) {
198
+ for (const rt of data.resourceTypes) {
199
+ result[rt.resourceType] = rt.apiVersions || [];
200
+ }
201
+ }
202
+ return result;
203
+ }
204
+
205
+ function httpGet(
206
+ url: string,
207
+ headers: Record<string, string>,
208
+ ): Promise<string> {
209
+ return new Promise((resolve, reject) => {
210
+ const parsedUrl = new URL(url);
211
+ const options = {
212
+ hostname: parsedUrl.hostname,
213
+ path: parsedUrl.pathname + parsedUrl.search,
214
+ method: "GET",
215
+ headers: { ...headers, "Content-Type": "application/json" },
216
+ };
217
+ const req = https.request(options, (res: any) => {
218
+ let body = "";
219
+ res.on("data", (chunk: Buffer) => (body += chunk.toString()));
220
+ res.on("end", () => {
221
+ if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300) {
222
+ resolve(body);
223
+ } else {
224
+ reject(
225
+ new Error(
226
+ `HTTP ${res.statusCode} from ${url}: ${body.substring(0, 500)}`,
227
+ ),
228
+ );
229
+ }
230
+ });
231
+ });
232
+ req.on("error", reject);
233
+ req.end();
234
+ });
235
+ }
236
+
237
+ /**
238
+ * Case-insensitive lookup of resource type in provider data.
239
+ * ARM API may return "dnszones" when we expect "dnsZones", or
240
+ * child resources may not be listed separately -- fall back to parent.
241
+ */
242
+ function findVersionsCaseInsensitive(
243
+ providerData: Record<string, string[]>,
244
+ resourceTypeName: string,
245
+ ): string[] | undefined {
246
+ // Try exact match first
247
+ if (providerData[resourceTypeName]) {
248
+ return providerData[resourceTypeName];
249
+ }
250
+ // Case-insensitive match
251
+ const lowerTarget = resourceTypeName.toLowerCase();
252
+ for (const [key, value] of Object.entries(providerData)) {
253
+ if (key.toLowerCase() === lowerTarget) {
254
+ return value;
255
+ }
256
+ }
257
+ // For child resources like "virtualNetworks/subnets" or
258
+ // "networkManagers/connectivityConfigurations", try the top-level parent
259
+ if (resourceTypeName.includes("/")) {
260
+ const parent = resourceTypeName.split("/")[0];
261
+ return findVersionsCaseInsensitive(providerData, parent);
262
+ }
263
+ return undefined;
264
+ }
265
+
266
+ async function main(): Promise<void> {
267
+ const schemaInfos = scanSchemaFiles();
268
+ console.error(
269
+ `Found ${schemaInfos.length} resource types across schema files`,
270
+ );
271
+
272
+ // Get Azure access token
273
+ let token: string;
274
+ try {
275
+ token = getAccessToken();
276
+ } catch (e) {
277
+ console.error(
278
+ "Failed to get Azure access token. Ensure you are logged in with `az login`.",
279
+ );
280
+ process.exit(1);
281
+ }
282
+
283
+ // Dedupe namespaces and fetch provider info
284
+ const namespaces = [...new Set(schemaInfos.map((s) => s.namespace))];
285
+ console.error(`Querying ${namespaces.length} Azure namespaces...`);
286
+
287
+ const providerCache: Record<string, Record<string, string[]>> = {};
288
+ for (const ns of namespaces) {
289
+ try {
290
+ providerCache[ns] = await fetchProviderVersions(ns, token);
291
+ console.error(` ${ns}: OK (${Object.keys(providerCache[ns]).length} resource types)`);
292
+ } catch (e) {
293
+ console.error(` ${ns}: FAILED - ${(e as Error).message}`);
294
+ providerCache[ns] = {};
295
+ }
296
+ }
297
+
298
+ // Compare and find new versions
299
+ const manifest: VersionManifest = {
300
+ updates: [],
301
+ noUpdates: [],
302
+ errors: [],
303
+ summary: {
304
+ totalConstructs: schemaInfos.length,
305
+ constructsWithUpdates: 0,
306
+ totalNewVersions: 0,
307
+ discoveryDate: new Date().toISOString().split("T")[0],
308
+ },
309
+ };
310
+
311
+ for (const info of schemaInfos) {
312
+ const providerData = providerCache[info.namespace];
313
+ if (!providerData || Object.keys(providerData).length === 0) {
314
+ manifest.errors.push({
315
+ resourceType: info.resourceType,
316
+ error: `No provider data for namespace ${info.namespace}`,
317
+ });
318
+ continue;
319
+ }
320
+
321
+ // ARM API may return resource type names with different casing (e.g., "dnszones" vs "dnsZones").
322
+ // Do a case-insensitive lookup.
323
+ const rtName = info.resourceTypeName;
324
+ const armVersions = findVersionsCaseInsensitive(providerData, rtName);
325
+
326
+ if (!armVersions) {
327
+ manifest.errors.push({
328
+ resourceType: info.resourceType,
329
+ error: `Resource type "${rtName}" not found in provider ${info.namespace}. Available: ${Object.keys(providerData).slice(0, 10).join(", ")}...`,
330
+ });
331
+ continue;
332
+ }
333
+
334
+ // Filter to stable only (no -preview) and newer than our latest
335
+ const latestKnown =
336
+ info.knownVersions.length > 0
337
+ ? info.knownVersions[info.knownVersions.length - 1]
338
+ : "0000-00-00";
339
+
340
+ const newVersions = armVersions
341
+ .filter((v) => !v.includes("-preview") && v > latestKnown)
342
+ .sort();
343
+
344
+ if (newVersions.length === 0) {
345
+ manifest.noUpdates.push({
346
+ resourceType: info.resourceType,
347
+ latestKnown,
348
+ });
349
+ continue;
350
+ }
351
+
352
+ // Build spec URLs for each new version
353
+ const specUrls: Record<string, string> = {};
354
+ for (const v of newVersions) {
355
+ specUrls[v] = specMapping.getSpecTreeUrl(info.resourceType, v);
356
+ }
357
+
358
+ manifest.updates.push({
359
+ ...info,
360
+ newVersions,
361
+ specUrls,
362
+ });
363
+
364
+ manifest.summary.constructsWithUpdates++;
365
+ manifest.summary.totalNewVersions += newVersions.length;
366
+ }
367
+
368
+ // Output manifest to stdout (logs go to stderr)
369
+ console.log(JSON.stringify(manifest, null, 2));
370
+
371
+ console.error(
372
+ `\nSummary: ${manifest.summary.constructsWithUpdates}/${manifest.summary.totalConstructs} constructs have ${manifest.summary.totalNewVersions} new version(s)`,
373
+ );
374
+ if (manifest.errors.length > 0) {
375
+ console.error(`Errors: ${manifest.errors.length} resource types could not be queried`);
376
+ }
377
+ }
378
+
379
+ main().catch((e) => {
380
+ console.error("Fatal error:", e);
381
+ process.exit(1);
382
+ });