-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Expand file tree
/
Copy pathmodels.tsp
More file actions
480 lines (372 loc) · 13.4 KB
/
Copy pathmodels.tsp
File metadata and controls
480 lines (372 loc) · 13.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
import "@typespec/rest";
import "@typespec/http";
import "@azure-tools/typespec-azure-core";
import "../shared/models.tsp";
using TypeSpec.Versioning;
using TypeSpec.Rest;
using TypeSpec.Http;
namespace DevCenterService;
@doc("Type of the output value.")
@added(APIVersions.v2024_02_01)
union EnvironmentOutputType {
@doc("The output is an array of values.")
array: "array",
@doc("The output is a boolean value.")
boolean: "boolean",
@doc("The output is a number value.")
number: "number",
@doc("The output is an object value.")
object: "object",
@doc("The output is a string value.")
string: "string",
string,
}
@doc("The type of environment operation.")
@added(APIVersions.v2024_02_01)
union EnvironmentOperationKind {
@doc("The operation represents a deployment.")
Deploy: "Deploy",
@doc("The operation represents a delete.")
Delete: "Delete",
string,
}
@doc("The scheduled action types.")
@added(APIVersions.v2024_02_01)
union EnvironmentActionType {
@doc("The action will delete the environment and associated resources.")
Delete: "Delete",
string,
}
@doc("The type of data a parameter accepts.")
union ParameterType {
@doc("The parameter accepts an array of values.") array: "array",
@doc("The parameter accepts a boolean value.") boolean: "boolean",
@doc("The parameter accepts an integer value.") integer: "integer",
@doc("The parameter accepts a number value.") number: "number",
@doc("The parameter accepts an object value.") object: "object",
@doc("The parameter accepts a string value.") string: "string",
string,
}
@doc("Indicates whether an environment type is enabled for use in a project.")
union EnvironmentTypeEnableStatus {
@doc("The environment type is enabled for use in the project.")
Enabled: "Enabled",
@doc("The environment type is not enabled for use in the project.")
Disabled: "Disabled",
string,
}
@doc("An ability the user has to perform an action on the environment type as an admin.")
@added(APIVersions.v2024_05_01_preview)
union EnvironmentTypeAbilityAsAdmin {
@doc("User can delete environments.")
DeleteEnvironments: "DeleteEnvironments",
@doc("User can delay and skip actions on environments.")
ManageEnvironmentActions: "ManageEnvironmentActions",
@doc("User can read actions on environments.")
ReadEnvironmentActions: "ReadEnvironmentActions",
@doc("User can read outputs on environments.")
ReadEnvironmentOutputs: "ReadEnvironmentOutputs",
@doc("User can read environments.")
ReadEnvironments: "ReadEnvironments",
@doc("User can create new environments or replace and update existing ones.")
WriteEnvironments: "WriteEnvironments",
string,
}
@doc("An ability the user has to perform an action on the environment type as a developer.")
@added(APIVersions.v2024_05_01_preview)
union EnvironmentTypeAbilityAsDeveloper {
@doc("User can delete environments.")
DeleteEnvironments: "DeleteEnvironments",
@doc("User can delay and skip actions on environments.")
ManageEnvironmentActions: "ManageEnvironmentActions",
@doc("User can read actions on environments.")
ReadEnvironmentActions: "ReadEnvironmentActions",
@doc("User can read outputs on environments.")
ReadEnvironmentOutputs: "ReadEnvironmentOutputs",
@doc("User can read environments.")
ReadEnvironments: "ReadEnvironments",
@doc("User can create new environments or replace and update existing ones.")
WriteEnvironments: "WriteEnvironments",
string,
}
@doc("The provisioning state of the environment.")
union EnvironmentProvisioningState {
@doc("The environment was successfully provisioned.")
Succeeded: "Succeeded",
@doc("The environment failed to provision.")
Failed: "Failed",
@doc("The environment provisioning was canceled.")
Canceled: "Canceled",
@doc("The environment is creating.")
Creating: "Creating",
@doc("The environment was accepted.")
Accepted: "Accepted",
@doc("The environment is deleting.")
Deleting: "Deleting",
@doc("The environment is updating.")
Updating: "Updating",
@doc("The environment is preparing.")
Preparing: "Preparing",
@doc("The environment is running.")
Running: "Running",
@doc("The environment is Syncing.")
Syncing: "Syncing",
@doc("The environment is moving resources.")
MovingResources: "MovingResources",
@doc("The environment has a transient failure.")
TransientFailure: "TransientFailure",
@doc("The environment storage provisioning failed.")
StorageProvisioningFailed: "StorageProvisioningFailed",
string,
}
alias EnvironmentListResult = Azure.Core.Page<Environment>;
@doc("Properties of an environment.")
@resource("environments")
@parentResource(User)
model Environment {
...EnvironmentUpdateProperties;
@doc("The unique URI of the environment.")
@visibility(Lifecycle.Read)
@added(APIVersions.v2024_02_01)
uri: url;
@doc("Environment name.")
@key("environmentName")
@minLength(3)
@maxLength(63)
@pattern("^[a-zA-Z0-9][a-zA-Z0-9-_.]{2,62}$")
@visibility(Lifecycle.Read)
name: string;
@doc("Environment type.")
@visibility(Lifecycle.Read, Lifecycle.Create)
environmentType: string;
@doc("The AAD object id of the owner of this Environment.")
@visibility(Lifecycle.Read)
user?: Azure.Core.uuid;
@doc("The provisioning state of the environment.")
@visibility(Lifecycle.Read)
provisioningState?: EnvironmentProvisioningState;
@doc("The identifier of the resource group containing the environment's resources.")
@visibility(Lifecycle.Read)
resourceGroupId?: string;
@doc("Name of the catalog.")
@visibility(Lifecycle.Read, Lifecycle.Create)
catalogName: string;
@doc("Name of the environment definition.")
@visibility(Lifecycle.Read, Lifecycle.Create)
environmentDefinitionName: string;
@doc("Provisioning error details. Populated only for error states.")
@visibility(Lifecycle.Read)
error?: Azure.Core.Foundations.Error;
}
alias EnvironmentUpdateProperties = {
...EnvironmentPatchProperties;
#suppress "@azure-tools/typespec-azure-core/bad-record-type" "there is no build in type to describe object"
@doc("Parameters object for the environment.")
parameters?: Record<unknown>;
};
@doc("Properties of an environment. These properties can be updated via PATCH after the resource has been created.")
@added(APIVersions.v2024_02_01)
model EnvironmentPatchProperties {
@doc("""
The time the expiration date will be triggered (UTC), after which the
environment and associated resources will be deleted.
""")
@added(APIVersions.v2024_02_01)
expirationDate?: utcDateTime;
}
@doc("Outputs from environment deployment.")
@added(APIVersions.v2024_02_01)
model EnvironmentOutputs {
@doc("The outputs Names and Values.")
outputs?: Record<EnvironmentOutput>;
}
@doc("Output from environment deployment.")
@added(APIVersions.v2024_02_01)
model EnvironmentOutput {
@doc("Type of the output value.")
type?: EnvironmentOutputType;
#suppress "@azure-tools/typespec-azure-core/no-unknown" "There is no built in type to describe object."
@doc("The output value.")
value?: unknown;
@doc("Indicates if the value is sensitive.")
sensitive?: boolean;
}
@doc("Information about an operation on an environment.")
@discriminator("kind")
@resource("operations")
@parentResource(Environment)
@added(APIVersions.v2024_02_01)
model EnvironmentOperation {
@doc("The unique URI for the environment operation.")
uri: url;
@doc("Unique identifier for the environment operation.")
@minLength(36)
@maxLength(36)
@pattern("^[a-zA-Z0-9]{8}-([a-zA-Z0-9]{4}-){3}[a-zA-Z0-9]{12}$")
@visibility(Lifecycle.Read)
@key("operationId")
operationId: Azure.Core.uuid;
@doc("The kind of operation that occurred.")
kind: EnvironmentOperationKind;
@doc("The operation status.")
status: Azure.Core.Foundations.OperationState;
@doc("The object ID of the actor which initiated the operation.")
createdByObjectId?: Azure.Core.uuid;
@doc("The time the operation started, in RFC3339 format.")
startTime?: utcDateTime;
@doc("The time the operation finished, in RFC3339 format.")
endTime?: utcDateTime;
#suppress "@azure-tools/typespec-azure-core/bad-record-type" "there is no build in type to describe object"
@doc("Parameters object for the environment at the time of the operation.")
environmentParameters?: Record<unknown>;
@doc("Provisioning or operation error details. Populated only for error states.")
error?: Azure.Core.Foundations.Error;
}
@doc("An upcoming Environment Action.")
@resource("actions")
@parentResource(Environment)
@added(APIVersions.v2024_02_01)
model EnvironmentAction {
@doc("Uniquely identifies the action.")
@minLength(3)
@maxLength(63)
@pattern("^[a-zA-Z0-9][a-zA-Z0-9-_.]{2,62}$")
@visibility(Lifecycle.Read)
@key("actionName")
name: string;
@doc("Uri of the action resource.")
@visibility(Lifecycle.Read)
uri: url;
@doc("The action that will be taken.")
actionType: EnvironmentActionType;
@doc("Details about the next run of this action.")
next?: EnvironmentNextAction;
@doc("Object Id of the user who last modified the action.")
@visibility(Lifecycle.Read)
lastModifiedBy?: Azure.Core.uuid;
@doc("Time the object was last modified, in RFC3339 format.")
lastModifiedAt?: utcDateTime;
}
@doc("Details about the next run of an action.")
@added(APIVersions.v2024_02_01)
model EnvironmentNextAction {
@doc("The time the action will be triggered (UTC), in RFC3339 format.")
scheduledTime?: utcDateTime;
}
@doc("A catalog.")
@resource("catalogs")
@parentResource(Project)
model Catalog {
@doc("The unique URI of the catalog.")
@added(APIVersions.v2024_02_01)
uri: url;
@doc("Name of the catalog.")
@key("catalogName")
@minLength(3)
@maxLength(63)
@pattern("^[a-zA-Z0-9][a-zA-Z0-9-_.]{2,62}$")
@visibility(Lifecycle.Read)
name: string;
}
alias EnvironmentDefinitionListResult = Azure.Core.Page<EnvironmentDefinition>;
@doc("An environment definition.")
@resource("environmentDefinitions")
@parentResource(Catalog)
model EnvironmentDefinition {
@doc("The unique URI of the environment definition.")
@added(APIVersions.v2024_02_01)
uri: url;
@doc("The ID of the environment definition.")
id: string;
@doc("Name of the environment definition.")
@key("definitionName")
@minLength(3)
@maxLength(63)
@pattern("^[a-zA-Z0-9][a-zA-Z0-9-_.]{2,62}$")
@visibility(Lifecycle.Read)
name: string;
@doc("Name of the catalog.")
catalogName: string;
@doc("A short description of the environment definition.")
description?: string;
@doc("Input parameters passed to an environment.")
parameters?: EnvironmentDefinitionParameter[];
//typespec does not have a way to represent this. Issue https://github.com/microsoft/typespec/issues/3005
@doc("JSON schema defining the parameters object passed to an environment.")
parametersSchema?: string;
@doc("Path to the Environment Definition entrypoint file.")
templatePath?: string;
}
@doc("Properties of an Environment Definition parameter")
model EnvironmentDefinitionParameter {
@doc("Unique ID of the parameter.")
id: string;
@doc("Display name of the parameter.")
name?: string;
@doc("Description of the parameter.")
description?: string;
@doc("Default value of the parameter.")
default?: string;
@doc("""
A string of one of the basic JSON types (number, integer, array, object,
boolean, string).
""")
type: ParameterType;
@doc("""
Whether or not this parameter is read-only. If true, default should have a
value.
""")
readOnly?: boolean;
@doc("Whether or not this parameter is required.")
required: boolean;
@doc("An array of allowed values.")
@minItems(1)
allowed?: string[];
}
alias EnvironmentTypeListResult = Azure.Core.Page<EnvironmentType>;
@doc("Properties of an environment type.")
@resource("environmentTypes")
@parentResource(Project)
model EnvironmentType {
@doc("The unique URI of the environment type.")
@added(APIVersions.v2024_02_01)
uri: url;
@doc("Name of the environment type.")
@key("environmentTypeName")
@minLength(3)
@maxLength(63)
@pattern("^[a-zA-Z0-9][a-zA-Z0-9-_.]{2,62}$")
@visibility(Lifecycle.Read)
name: string;
@doc("""
Id of a subscription or management group that the environment type will be
mapped to. The environment's resources will be deployed into this subscription
or management group.
""")
deploymentTargetId: string;
@doc("Indicates whether this environment type is enabled for use in this project.")
status: EnvironmentTypeEnableStatus;
@doc("Display name of the environment type.")
@added(APIVersions.v2024_02_01)
displayName?: string;
}
@doc("Abilities a user has on an environment type.")
@added(APIVersions.v2024_05_01_preview)
model EnvironmentTypeAbilities {
@doc("The abilities the user has to perform actions on the environment type as an admin.")
abilitiesAsAdmin: EnvironmentTypeAbilityAsAdmin[];
@doc("The abilities the user has to perform actions on the environment type as a developer.")
abilitiesAsDeveloper: EnvironmentTypeAbilityAsDeveloper[];
}
@doc("Information about a deploy operation on an environment.")
@added(APIVersions.v2024_02_01)
model EnvironmentDeployOperation extends EnvironmentOperation {
@doc("The kind of operation that occurred.")
kind: EnvironmentOperationKind.Deploy;
}
@doc("Information about a delete operation on an environment.")
@added(APIVersions.v2024_02_01)
model EnvironmentDeleteOperation extends EnvironmentOperation {
@doc("The kind of operation that occurred.")
kind: EnvironmentOperationKind.Delete;
}