/** * Azure Resource Manager schema fetching. * * Downloads the azure-resource-manager-schemas repo tarball, * extracts provider JSON schemas, deduplicates by latest API version, * and "explodes" multi-resource files into one entry per resource. */ /** * Top-level ARM JSON Schema for a provider file. * * Besides the resource-group-scope `resourceDefinitions`, provider files * carry parallel sections for the other deployment scopes. Org-hierarchy and * policy resources (management groups, subscription aliases, policy * definitions) exist ONLY in those sections (#1545). */ export interface ArmProviderSchema { id?: string; $schema?: string; title?: string; description?: string; resourceDefinitions?: Record; subscription_resourceDefinitions?: Record; managementGroup_resourceDefinitions?: Record; tenant_resourceDefinitions?: Record; definitions?: Record; } /** ARM deployment scopes a resource definition can target. */ export type DeployScope = "resourceGroup" | "subscription" | "managementGroup" | "tenant"; /** * A single resource definition within a provider schema. */ export interface ArmResourceDefinition { type?: string; description?: string; properties?: Record; required?: string[]; } /** * A property in an ARM schema. */ export interface ArmSchemaProperty { type?: string | string[]; description?: string; enum?: string[]; $ref?: string; items?: ArmSchemaProperty; properties?: Record; oneOf?: unknown[]; anyOf?: unknown[]; required?: string[]; pattern?: string; minLength?: number; maxLength?: number; minimum?: number; maximum?: number; format?: string; const?: unknown; default?: unknown; readOnly?: boolean; } /** * A named type within the definitions section. */ export interface ArmSchemaDefinition { type?: string | string[]; description?: string; enum?: string[]; properties?: Record; required?: string[]; items?: ArmSchemaProperty; } /** * Pinned commit of Azure/azure-resource-manager-schemas (#1144). * * The repo has no tagged releases, so unlike gcp (`KCC_VERSION`) or k8s * (`K8S_SCHEMA_VERSION`) there is no version tag to pin against — codegen * used to fetch `refs/heads/main` directly. That meant a cold cache picked * up whatever upstream state had landed since the cache last expired, while * a warm cache kept serving whatever was current when it was last filled. * Azure republishes per-provider schema files under new dates constantly, * and a later date can drop resources an earlier one defined (see * PROVIDER_VERSION_OVERRIDES in ./api-versions.ts) — so which resources * even exist to generate depends on exactly when you fetch, not just what * the fetch URL happens to be. That broke composites/vm-linux.ts at tsc * nondeterministically, depending on which runner's cache was warm. * * Pinning to a commit SHA makes generation reproducible regardless of cache * state. Bump policy: #523's scheduled lexicon-upgrade cron (rolling-spec * bucket, sub-issue #526) is meant to propose bumps to this constant as a * reviewable PR once built. Until then, bump by hand: take the current * `main` HEAD sha from * https://github.com/Azure/azure-resource-manager-schemas/commits/main, * regenerate, fix up any composite left referencing a renamed or vanished * export (adding a PROVIDER_VERSION_OVERRIDES entry if a resource dropped * out of the naive "latest by date" pick), and update this constant + * comment. */ export declare const AZURE_SCHEMA_COMMIT = "0085cb6f3a98e735359807143bcb1667aeec930f"; /** * Explode one provider schema file into per-resource schema entries, * writing into `out` keyed by resource type. Resource types already present * in `out` are left untouched (first file wins across a multi-version pin). * * For providers in {@link SCOPED_SECTION_PROVIDERS} all deployment-scope * sections are read; the definition comes from the highest-priority section * that has it, and `deployScopes` unions every section that defines it. */ export declare function explodeProviderSchema(provider: string, apiVersion: string, providerSchema: ArmProviderSchema, out: Map): void; /** * Fetch ARM schemas and return a Map keyed by resource type * (e.g. "Microsoft.Storage/storageAccounts") to raw JSON bytes. * * Each provider file is "exploded" so that every resourceDefinition * becomes its own entry with the shared definitions included. */ export declare function fetchArmSchemas(force?: boolean): Promise>; /** * Get the cache file path (for testing). */ export declare function getCachePath(): string; /** * Clear the cache (for testing). */ export declare function clearCache(): void; //# sourceMappingURL=fetch.d.ts.map