-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Expand file tree
/
Copy pathJob.tsp
More file actions
244 lines (187 loc) · 6.09 KB
/
Copy pathJob.tsp
File metadata and controls
244 lines (187 loc) · 6.09 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
import "@typespec/http";
import "@typespec/rest";
import "@typespec/versioning";
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "./ProvisioningState.tsp";
import "./Target.tsp";
using TypeSpec.Http;
using TypeSpec.Rest;
using TypeSpec.Versioning;
using Azure.Core;
using Azure.ResourceManager;
namespace Microsoft.Edge;
@doc("JobType for the job. Supports extensibility via string values.")
union JobType {
string,
@doc("A deployment job.")
Deploy: "deploy",
@doc("A publish job.")
@added(Versions.v2025_08_01)
Publish: "publish",
@doc("A staging job.")
Staging: "staging",
@doc("A validation job.")
ExternalValidation: "externalValidation",
@doc("An Uninstall job.")
@added(Versions.v2025_08_01)
Uninstall: "uninstall",
}
@doc("Status of a job or job step.")
union JobStatus {
string,
/** The job or step is not started. */
NotStarted: "NotStarted",
/** The job or step is in progress. */
InProgress: "InProgress",
/** The job or step succeeded. */
Succeeded: "Succeeded",
/** The job or step failed. */
Failed: "Failed",
}
// Base model for polymorphic job step statistics
@doc("Base Job Step Statistics")
@discriminator("statisticsType")
model JobStepStatisticsBase {
@doc("Statistics type discriminator value")
statisticsType: JobType;
}
@doc("Deploy statistics for a job step, including total, success, and failed counts.")
model DeployJobStepStatistics extends JobStepStatisticsBase {
@doc("Statistics type discriminator value")
statisticsType: JobType.Deploy;
@doc("Total count of items processed in this step")
totalCount?: int32;
@doc("Count of successful items in this step")
successCount?: int32;
@doc("Count of failed items in this step")
failedCount?: int32;
}
@doc("Publish statistics for a job step, including total, success, and failed counts.")
@added(Versions.v2025_08_01)
model PublishJobStepStatistics extends JobStepStatisticsBase {
@doc("Statistics type discriminator value")
statisticsType: JobType.Publish;
@doc("Total count of items processed in this step")
totalCount?: int32;
@doc("Count of successful items in this step")
successCount?: int32;
@doc("Count of failed items in this step")
failedCount?: int32;
}
@doc("Uninstall statistics for a job step, including total, success, and failed counts.")
@added(Versions.v2025_08_01)
model UninstallJobStepStatistics extends JobStepStatisticsBase {
@doc("Statistics type discriminator value")
statisticsType: JobType.Uninstall;
@doc("Total count of items processed in this step")
totalCount?: int32;
@doc("Count of successful items in this step")
successCount?: int32;
@doc("Count of failed items in this step")
failedCount?: int32;
}
// Not needed anymore as the statistics type will be of different model and for union we can only add same type of models
// Union for polymorphic statistics
@doc("Polymorphic statistics for a job step.")
union JobStepStatistics {
DeployJobStepStatistics,
// Add future statistics models here
}
// Base model for polymorphic job parameters
@doc("Base Job Parameter")
@discriminator("jobType")
model JobParameterBase {
@doc("Job type discriminator value")
jobType: JobType;
}
@doc("Parameters for a deployment job.")
model DeployJobParameter extends JobParameterBase {
@doc("Job type discriminator value")
jobType: JobType.Deploy;
parameter?: InstallSolutionParameter;
}
@doc("Parameters for a publish job.")
@added(Versions.v2025_08_01)
model PublishJobParameter extends JobParameterBase {
@doc("Job type discriminator value")
jobType: JobType.Publish;
parameter?: SolutionVersionParameter;
}
@doc("Parameters for an Uninstall job.")
@added(Versions.v2025_08_01)
model UninstallJobParameter extends JobParameterBase {
@doc("Job type discriminator value")
jobType: JobType.Uninstall;
parameter?: UninstallSolutionParameter;
}
@doc("Job Step")
model JobStep {
@doc("Name of the step")
name: string;
@doc("Status of the step")
status: JobStatus;
@doc("Start time of the step (ISO8601)")
startTime?: utcDateTime;
@doc("End time of the step (ISO8601)")
endTime?: utcDateTime;
@doc("Message for the step")
message?: string;
@doc("Statistics for the step")
statistics?: JobStepStatisticsBase;
@doc("Nested substeps for this step")
steps?: JobStep[];
@doc("Error Details if any failure is there")
@visibility(Lifecycle.Read)
errorDetails?: Azure.ResourceManager.Foundations.ErrorDetail;
}
@doc("Additional metadata or properties.")
@added(Versions.v2025_08_01)
model AdditionalData {
@doc("Id of the workflow.")
workflowId?: string;
}
@doc("Properties of a Job resource, including type, status, parameters, steps, and error details.")
model JobProperties {
@doc("The type of job.")
jobType: JobType;
@doc("Start time of the job (ISO8601).")
startTime?: utcDateTime;
@doc("End time of the job (ISO8601).")
endTime?: utcDateTime;
@doc("Status of the job.")
status: JobStatus;
@doc("Parameters for the job.")
jobParameter?: JobParameterBase;
@doc("Correlation ID for tracking.")
correlationId?: string;
@doc("Steps and substatuses for the job.")
steps?: JobStep[];
@doc("The OID or identity that triggered the job.")
triggeredBy?: string;
@doc("Provisioning state of the resource.")
@visibility(Lifecycle.Read)
provisioningState?: ProvisioningState;
@doc("Error Details if any failure is there")
@visibility(Lifecycle.Read)
errorDetails?: Azure.ResourceManager.Foundations.ErrorDetail;
@doc("Additional metadata or properties.")
@added(Versions.v2025_08_01)
additionalData?: AdditionalData;
}
@doc("Job extension resource for tracking job execution and substatuses.")
model Job is ExtensionResource<JobProperties> {
...ResourceNameParameter<
Job,
NamePattern = "^(?=.{3,60}$)[a-zA-Z0-9]([-a-zA-Z0-9]*[a-zA-Z0-9])?(\\.[a-zA-Z0-9]([-a-zA-Z0-9]*[a-zA-Z0-9])?)*$"
>;
...EntityTagProperty;
}
@armResourceOperations
interface Jobs {
@doc("Get a Job resource")
get is ArmResourceRead<Job>;
@doc("List Jobs by parent resource")
listByTarget is ArmResourceListByParent<Job>;
}