Setting the file. One moment. Prepare Schemas · Prepare · microsoft/azure-skills · Skills Docs — line 71
This file
- Number
- 7.4
- Position
- 4 of 12
- Type
- TypeScript
- Size
- 7 KB
- Lines
- 196
references/prepare-schemas.ts
TypeScript·196 lines·7 KB
12 services?: string[];
13}
14
15// ─── Healing types (prepare phase) ───────────────────────────────────────────
16
17export type PrepareHealingTrigger = "quota" | "policy" | "rubric" | "region";
18export type PrepareIssueClassification = "AUTO_FIXABLE" | "NEEDS_USER_INPUT";
19export type PrepareHealingResult = "fixed" | "needs-input" | "still-failing";
20
21export interface PrepareHealingIssue {
22 dimension: string;
23 detail: string;
24 classification: PrepareIssueClassification;
25}
26
27export interface PrepareHealingFix {
28 service: string;
29 change: string;
30 reason: string;
31}
32
33export interface PrepareHealingAttempt {
34 attempt: number;
35 trigger: PrepareHealingTrigger;
36 issues: PrepareHealingIssue[];
37 fixes: PrepareHealingFix[];
38 result: PrepareHealingResult;
39}
40
41// ─── prepare-plan.json ───────────────────────────────────────────────────────
42
43export interface PlannedService {
44 name: string;
45 sku: string;
46 purpose: string;
47 component: string;
48 region: string;
49 resourceName: string;
50 /** Exact engine version for managed database services (MySQL/PostgreSQL Flexible Server),
51 * sourced from the provider capabilities API during quota validation — NOT guessed.
52 * ARM rejects major-only strings (e.g. MySQL '8.0'); use the exact supported patch
53 * (e.g. '8.0.21'). Omit for non-DB services. */
54 version?: string;
55}
56
57export interface CostBreakdownItem {
58 service: string;
59 sku: string;
60 monthlyUsd: number;
61 note?: string;
62}
63
64export interface CostEstimate {
65 monthlyUsd: number;
66 currency: "USD";
67 breakdown: CostBreakdownItem[];
68 disclaimer: string;
69}
70
71export interface RejectedAlternative {
72 service: string;
73 reason: string;
74}
75
76export interface NamingResource {
77 type: string;
78 name: string;
79}
80
81export interface NamingConfig {
82 pattern: string;
83 /** The computed prefix used for all resource names: {project}-{env}-{suffix}.
84 * deploymentVariables.environmentName MUST equal this value. */
85 resourcePrefix: string;
86 resources: NamingResource[];
87}
88
89export type QuotaSource = "cli" | "fallback";
90
91export interface QuotaCheck {
92 resource: string;
93 region: string;
94 required: number;
95 available: number;
96 sufficient: boolean;
97 provider: string;
98 currentUsage: number;
99 currentLimit: number;
100 adjustable: boolean;
101 source: QuotaSource;
102}
103
104export interface DeployStrategy {
105 /** Deploy pattern — see deploy-strategy.md for the three patterns.
106 * "oryx-auto": Oryx handles build + run (Pattern A — default for most apps).
107 * "startup-install": native module compilation at startup (Pattern B).
108 * "container-only": Dockerfile-based deploy via ACR (Pattern C).
109 * Omit when Oryx auto-build is sufficient and no special startup is needed. */
110 codeDeployPattern?: "oryx-auto" | "startup-install" | "container-only";
111 /** Startup command for native module compilation (goes into appCommandLine) */
112 startupCommand?: string;
113 /** Required app settings for the deploy strategy (e.g., SCM_DO_BUILD_DURING_DEPLOYMENT) */
114 requiredAppSettings?: Record<string, string>;
115 /** Human-readable reason for choosing this strategy */
116 reason: string;
117}
118
119export interface InstrumentationConfig {
120 appInsightsEnabled: boolean;
121 reason: string;
122}
123
124export interface DeploymentVariables {
125 /** MUST equal naming.resourcePrefix (e.g., "myapp-dev-a1d5"), NOT the env label ("dev") */
126 environmentName: string;
127 location: string;
128 sessionId: string;
129 deployedBy: string;
130 /** Variable names that could not be resolved at prepare time — deploy reads, not asks */
131 deferred?: string[];
132}
133
134export interface OfferRestriction {
135 /** Azure provider namespace (e.g., "Microsoft.DBforPostgreSQL") */
136 provider: string;
137 /** Region checked */
138 region: string;
139 /** Whether the offer is restricted in this region */
140 restricted: boolean;
141 /** Reason string from capabilities API, if any */
142 reason?: string;
143}
144
145export interface QuotaValidation {
146 /** True when all planned services had quota confirmed */
147 verified: boolean;
148 /** How quota was verified — persists in session artifact, survives context compaction */
149 method?: "cli" | "what-if" | "unverifiable";
150 /** The specific region that passed validation */
151 verifiedRegion?: string;
152 /** The specific SKU that was validated (e.g., "B1", "F1") */
153 verifiedSku?: string;
154 /** Regions checked during validation */
155 checkedRegions?: string[];
156 /** Resources that failed quota checks */
157 failedResources?: string[];
158 /** Reason when verified is false (e.g., "quota CLI unavailable", "all regions zero") */
159 reason?: string;
160 /** Offer restriction results for database services (PostgreSQL, MySQL).
161 * Populated by prepare Step 5 when database services are in the plan.
162 * `LocationIsOfferRestricted` is NOT caught by what-if — this is the only pre-deploy check. */
163 offerRestrictions?: readonly OfferRestriction[];
164 /** Derived from offerRestrictions[]: true when every database service in services[]
165 * has at least one entry in offerRestrictions[]. Set this based on the array contents,
166 * not independently. Deploy gate halts if false/missing when services include PostgreSQL/MySQL. */
167 offerRestrictionsVerified?: boolean;
168}
169
170export interface PreparePlan {
171 services: PlannedService[];
172 costEstimate: CostEstimate;
173 rejectedAlternatives: RejectedAlternative[];
174 naming: NamingConfig;
175 quotas: readonly QuotaCheck[];
176 assumptions: string[];
177 /** IaC format for scaffold — "bicep" (default) or "terraform" */
178 iacFormat: "bicep" | "terraform";
179 /** Application database name the app expects to exist (from compose env such as
180 * MYSQL_DATABASE / MYSQLDB_DATABASE / POSTGRES_DB, a connection string, or ORM config).
181 * Scaffold emits a `flexibleServers/databases` child resource for this so the schema DB
182 * exists in IaC before the container starts; the conformance gate's DB-NAME-PRESENT check
183 * asserts it. Omit only when no managed database is in the plan. */
184 appDbName?: string;
185 postDeployRecommendations?: PostDeployRecommendation[];
186 /** Instrumentation decision — object with boolean + reason, NOT a bare boolean */
187 instrumentation?: InstrumentationConfig;
188 /** Deployment variables resolved at prepare time — scaffold/deploy read, not re-ask */
189 deploymentVariables?: DeploymentVariables;
190 /** Quota validation result from proactive capacity check */
191 quotaValidation?: QuotaValidation;
192 /** Code deploy strategy for native module apps — see deploy-strategy.md.
193 * Only populated when Pattern B (startup-install) is needed. */
194 deployStrategy?: DeployStrategy;
195 healingAttempts?: readonly PrepareHealingAttempt[];
196}