@azure-tools/typespec-azure-core 0.30.0-dev.18 → 0.30.0-dev.19
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.
- package/lib/azure-core.tsp +3 -0
- package/lib/foundations.tsp +126 -0
- package/lib/models.tsp +18 -0
- package/lib/operations.tsp +104 -1
- package/lib/traits.tsp +37 -3
- package/package.json +1 -1
package/lib/azure-core.tsp
CHANGED
package/lib/foundations.tsp
CHANGED
|
@@ -11,6 +11,9 @@ using Azure.Core.Traits.Private;
|
|
|
11
11
|
|
|
12
12
|
namespace Azure.Core.Foundations;
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Enum describing allowed operation states.
|
|
16
|
+
*/
|
|
14
17
|
@lroStatus
|
|
15
18
|
enum OperationState {
|
|
16
19
|
InProgress,
|
|
@@ -19,6 +22,11 @@ enum OperationState {
|
|
|
19
22
|
Canceled,
|
|
20
23
|
}
|
|
21
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Provides status details for long running operations.
|
|
27
|
+
* @template TStatusResult The type of the operation status result.
|
|
28
|
+
* @template TStatusError The type of the operation status error. If not provided, the default error is used.
|
|
29
|
+
*/
|
|
22
30
|
@doc("Provides status details for long running operations.")
|
|
23
31
|
model OperationStatus<TStatusResult = never, TStatusError = Foundations.Error> {
|
|
24
32
|
@key("operationId")
|
|
@@ -35,6 +43,10 @@ model OperationStatus<TStatusResult = never, TStatusError = Foundations.Error> {
|
|
|
35
43
|
result?: TStatusResult;
|
|
36
44
|
}
|
|
37
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Conveys the resource instance to an operation as a request body.
|
|
48
|
+
* @template T The type of the resource instance.
|
|
49
|
+
*/
|
|
38
50
|
@added(Azure.Core.Versions.v1_0_Preview_2)
|
|
39
51
|
@doc("Conveys the resource instance to an operation as a request body.")
|
|
40
52
|
model ResourceBody<T> {
|
|
@@ -52,12 +64,20 @@ alias ResourceOkResponse<T> = TypeSpec.Http.Response<200> & T;
|
|
|
52
64
|
|
|
53
65
|
alias ResourceCreatedOrOkResponse<T extends object> = ResourceCreatedResponse<T> | ResourceOkResponse<T>;
|
|
54
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Response describing the location of a created resource.
|
|
69
|
+
* @template T The type of the created resource.
|
|
70
|
+
*/
|
|
55
71
|
model LocationOfCreatedResourceResponse<T extends object> is TypeSpec.Http.CreatedResponse {
|
|
56
72
|
@finalLocation
|
|
57
73
|
@TypeSpec.Http.header("Location")
|
|
58
74
|
location: ResourceLocation<T>;
|
|
59
75
|
}
|
|
60
76
|
|
|
77
|
+
/**
|
|
78
|
+
* Response describing the location of a resource created with a service-provided name.
|
|
79
|
+
* @template T The type of the created resource.
|
|
80
|
+
*/
|
|
61
81
|
model LocationOfCreatedResourceWithServiceProvidedNameResponse<T extends object>
|
|
62
82
|
is TypeSpec.Http.AcceptedResponse {
|
|
63
83
|
@finalLocation
|
|
@@ -65,6 +85,10 @@ model LocationOfCreatedResourceWithServiceProvidedNameResponse<T extends object>
|
|
|
65
85
|
location: ResourceLocation<T>;
|
|
66
86
|
}
|
|
67
87
|
|
|
88
|
+
/**
|
|
89
|
+
* Metadata for long running operation status monitor locations.
|
|
90
|
+
* @template TStatusResult The type of the operation status result.
|
|
91
|
+
*/
|
|
68
92
|
@doc("Metadata for long running operation status monitor locations")
|
|
69
93
|
model LongRunningStatusLocation<TStatusResult = never> {
|
|
70
94
|
@pollingLocation
|
|
@@ -75,6 +99,10 @@ model LongRunningStatusLocation<TStatusResult = never> {
|
|
|
75
99
|
|
|
76
100
|
alias AcceptedResponse<T = {}> = TypeSpec.Http.AcceptedResponse & T;
|
|
77
101
|
|
|
102
|
+
/**
|
|
103
|
+
* A response containing error details.
|
|
104
|
+
* @template TError The type of the error object.
|
|
105
|
+
*/
|
|
78
106
|
@error
|
|
79
107
|
@doc("A response containing error details.")
|
|
80
108
|
model ErrorResponseBase<TError> {
|
|
@@ -132,35 +160,72 @@ model InnerError {
|
|
|
132
160
|
innererror?: InnerError;
|
|
133
161
|
}
|
|
134
162
|
|
|
163
|
+
/**
|
|
164
|
+
* Version of a model for a create or replace operation which only includes updateable properties.
|
|
165
|
+
* @template TResource The type of the resource.
|
|
166
|
+
*/
|
|
135
167
|
@omitKeyProperties
|
|
136
168
|
model ResourceCreateOrReplaceModel<TResource extends object>
|
|
137
169
|
is UpdateableProperties<DefaultKeyVisibility<TResource, "read">>;
|
|
138
170
|
|
|
171
|
+
/**
|
|
172
|
+
* Collection of properties from a resource that are visible to create or update scopes.
|
|
173
|
+
* @template TResource The type of the resource.
|
|
174
|
+
*/
|
|
139
175
|
@withVisibility("create", "update")
|
|
140
176
|
model CreateableAndUpdateableProperties<TResource> {
|
|
141
177
|
...TResource;
|
|
142
178
|
}
|
|
143
179
|
|
|
180
|
+
/**
|
|
181
|
+
* Version of a model for a create or update operation which only includes updateable properties.
|
|
182
|
+
* @template TResource The type of the resource.
|
|
183
|
+
*/
|
|
144
184
|
@omitKeyProperties
|
|
145
185
|
model ResourceCreateOrUpdateModel<TResource>
|
|
146
186
|
is OptionalProperties<CreateableAndUpdateableProperties<DefaultKeyVisibility<TResource, "read">>>;
|
|
147
187
|
|
|
188
|
+
/**
|
|
189
|
+
* Version of a model for an update operation which only includes updateable properties.
|
|
190
|
+
* @template TResource The type of the resource.
|
|
191
|
+
*/
|
|
148
192
|
@omitKeyProperties
|
|
149
193
|
model ResourceUpdateModel<TResource>
|
|
150
194
|
is OptionalProperties<UpdateableProperties<DefaultKeyVisibility<TResource, "read">>>;
|
|
151
195
|
|
|
196
|
+
/**
|
|
197
|
+
* A model containing the keys of the provided resource.
|
|
198
|
+
* @template TResource The type of the resource.
|
|
199
|
+
*/
|
|
152
200
|
@copyResourceKeyParameters
|
|
153
201
|
model ItemKeysOf<TResource> {}
|
|
154
202
|
|
|
203
|
+
/**
|
|
204
|
+
* A model containing the collection keys of the provided resource's parent resource.
|
|
205
|
+
* @template TResource The type of the resource.
|
|
206
|
+
*/
|
|
155
207
|
@copyResourceKeyParameters("parent")
|
|
156
208
|
model CollectionKeysOf<TResource> {}
|
|
157
209
|
|
|
210
|
+
/**
|
|
211
|
+
* A model describing a set of custom request parameters.
|
|
212
|
+
* @template TCustom An object describing custom request parameters.
|
|
213
|
+
*/
|
|
158
214
|
@Private.spreadCustomParameters(TCustom)
|
|
159
215
|
model CustomParameters<TCustom extends object> {}
|
|
160
216
|
|
|
217
|
+
/**
|
|
218
|
+
* A model describing a set of custom response properties.
|
|
219
|
+
* @template TCustom An object describing custom response properties.
|
|
220
|
+
*/
|
|
161
221
|
@Private.spreadCustomResponseProperties(TCustom)
|
|
162
222
|
model CustomResponseFields<TCustom extends object> {}
|
|
163
223
|
|
|
224
|
+
/**
|
|
225
|
+
* A model describing a customized page of resources.
|
|
226
|
+
* @template TResource The type of the resource.
|
|
227
|
+
* @template Traits Traits which apply to the page.
|
|
228
|
+
*/
|
|
164
229
|
@pagedResult
|
|
165
230
|
@doc("Paged collection of {name} items", TResource)
|
|
166
231
|
model CustomPage<TResource extends object, Traits extends object = {}> {
|
|
@@ -175,6 +240,9 @@ model CustomPage<TResource extends object, Traits extends object = {}> {
|
|
|
175
240
|
...TraitProperties<Traits, TraitLocation.Response, TraitContext.List>;
|
|
176
241
|
}
|
|
177
242
|
|
|
243
|
+
/**
|
|
244
|
+
* The expected shape of model types passed to the TCustom parameter of operation signatures.
|
|
245
|
+
*/
|
|
178
246
|
@doc("The expected shape of model types passed to the TCustom parameter of operation signatures.")
|
|
179
247
|
model CustomizationFields {
|
|
180
248
|
@doc("An object containing custom parameters that will be included in the operation.")
|
|
@@ -186,6 +254,13 @@ model CustomizationFields {
|
|
|
186
254
|
|
|
187
255
|
// Basic Operation Shapes
|
|
188
256
|
|
|
257
|
+
/**
|
|
258
|
+
* The most basic operation.
|
|
259
|
+
* @template TParams Object describing the request parameters of the operation.
|
|
260
|
+
* @template TResponse Object describing the response properties of the operation.
|
|
261
|
+
* @template Traits Traits which apply to the operation.
|
|
262
|
+
* @template TErrorResponse The type of the error response. If not provided, the default error response type will be used.
|
|
263
|
+
*/
|
|
189
264
|
#suppress "@azure-tools/typespec-providerhub/operation-requires-documentation" "This is a library operation."
|
|
190
265
|
op Operation<
|
|
191
266
|
TParams,
|
|
@@ -200,6 +275,13 @@ op Operation<
|
|
|
200
275
|
...TParams
|
|
201
276
|
): TResponse | TErrorResponse;
|
|
202
277
|
|
|
278
|
+
/**
|
|
279
|
+
* Long-running operation.
|
|
280
|
+
* @template TParams Object describing the request parameters of the operation.
|
|
281
|
+
* @template TResponse Object describing the response properties of the operation. If not provided, the AcceptedResponse type will be used.
|
|
282
|
+
* @template Traits Traits which apply to the operation.
|
|
283
|
+
* @template TErrorResponse The type of the error response. If not provided, the default error response type will be used.
|
|
284
|
+
*/
|
|
203
285
|
#suppress "@azure-tools/typespec-providerhub/no-inline-model" "This operation signature is not used in Azure Resource Manager operations (yet)"
|
|
204
286
|
op LongRunningOperation<
|
|
205
287
|
TParams,
|
|
@@ -208,6 +290,14 @@ op LongRunningOperation<
|
|
|
208
290
|
TErrorResponse = Azure.Core.Foundations.ErrorResponse
|
|
209
291
|
> is Operation<TParams, TResponse & Foundations.LongRunningStatusLocation, Traits, TErrorResponse>;
|
|
210
292
|
|
|
293
|
+
/**
|
|
294
|
+
* Operation that returns the status of another operation.
|
|
295
|
+
* @template TParams Object describing the request parameters of the operation.
|
|
296
|
+
* @template TStatusResult The type of the operation status result.
|
|
297
|
+
* @template TStatusError The type of the operation status error.
|
|
298
|
+
* @template Traits Traits which apply to the operation.
|
|
299
|
+
* @template TErrorResponse The type of the error response. If not provided, the default error response type will be used.
|
|
300
|
+
*/
|
|
211
301
|
op GetOperationStatus<
|
|
212
302
|
TParams = {},
|
|
213
303
|
TStatusResult = never,
|
|
@@ -227,6 +317,14 @@ op GetOperationStatus<
|
|
|
227
317
|
|
|
228
318
|
// Fundamental Resource Operation Shapes
|
|
229
319
|
|
|
320
|
+
/**
|
|
321
|
+
* The most basic operation that applies to a resource.
|
|
322
|
+
* @template TResource The type of the resource.
|
|
323
|
+
* @template TParams Object describing the request parameters of the operation.
|
|
324
|
+
* @template TResponse Object describing the response properties of the operation.
|
|
325
|
+
* @template Traits Traits which apply to the operation.
|
|
326
|
+
* @template TErrorResponse The type of the error response. If not provided, the default error response type will be used.
|
|
327
|
+
*/
|
|
230
328
|
#suppress "@azure-tools/typespec-azure-resource-manager/no-response-body" "This operation must return a status monitor in its response."
|
|
231
329
|
@autoRoute
|
|
232
330
|
@Private.ensureResourceType(TResource)
|
|
@@ -238,6 +336,14 @@ op ResourceOperation<
|
|
|
238
336
|
TErrorResponse = Azure.Core.Foundations.ErrorResponse
|
|
239
337
|
> is Operation<Foundations.ItemKeysOf<TResource> & TParams, TResponse, Traits, TErrorResponse>;
|
|
240
338
|
|
|
339
|
+
/**
|
|
340
|
+
* Operation that applies to a collection of resources.
|
|
341
|
+
* @template TResource The type of the resource.
|
|
342
|
+
* @template TParams Object describing the request parameters of the operation.
|
|
343
|
+
* @template TResponse Object describing the response properties of the operation.
|
|
344
|
+
* @template Traits Traits which apply to the operation.
|
|
345
|
+
* @template TErrorResponse The type of the error response. If not provided, the default error response type will be used.
|
|
346
|
+
*/
|
|
241
347
|
#suppress "@azure-tools/typespec-azure-resource-manager/no-response-body" "This operation must return a status monitor in its response."
|
|
242
348
|
@autoRoute
|
|
243
349
|
@Private.ensureResourceType(TResource)
|
|
@@ -254,6 +360,14 @@ op ResourceCollectionOperation<
|
|
|
254
360
|
TErrorResponse
|
|
255
361
|
>;
|
|
256
362
|
|
|
363
|
+
/**
|
|
364
|
+
* Operation that lists resources in a paginated way.
|
|
365
|
+
* @template TResource The type of the resource.
|
|
366
|
+
* @template TParams Object describing the request parameters of the operation.
|
|
367
|
+
* @template TResponse Object describing the response properties of the operation.
|
|
368
|
+
* @template Traits Traits which apply to the operation.
|
|
369
|
+
* @template TErrorResponse The type of the error response. If not provided, the default error response type will be used.
|
|
370
|
+
*/
|
|
257
371
|
@listsResource(TResource)
|
|
258
372
|
@Private.ensureResourceType(TResource)
|
|
259
373
|
op ResourceList<
|
|
@@ -264,6 +378,12 @@ op ResourceList<
|
|
|
264
378
|
TErrorResponse = Azure.Core.Foundations.ErrorResponse
|
|
265
379
|
> is ResourceCollectionOperation<TResource, TParams, TResponse, Traits, TErrorResponse>;
|
|
266
380
|
|
|
381
|
+
/**
|
|
382
|
+
* Operation that lists resources in a non-paginated way.
|
|
383
|
+
* @template TResource The type of the resource.
|
|
384
|
+
* @template Traits Traits which apply to the operation.
|
|
385
|
+
* @template TErrorResponse The type of the error response. If not provided, the default error response type will be used.
|
|
386
|
+
*/
|
|
267
387
|
#suppress "@azure-tools/typespec-providerhub/no-inline-model" "This operation signature is not used in Azure Resource Manager operations (yet)"
|
|
268
388
|
@autoRoute
|
|
269
389
|
op NonPagedResourceList<
|
|
@@ -278,6 +398,12 @@ op NonPagedResourceList<
|
|
|
278
398
|
TErrorResponse
|
|
279
399
|
>;
|
|
280
400
|
|
|
401
|
+
/**
|
|
402
|
+
* Long-running operation that updates a resource.
|
|
403
|
+
* @template TResource The type of the resource.
|
|
404
|
+
* @template Traits Traits which apply to the operation.
|
|
405
|
+
* @template TErrorResponse The type of the error response. If not provided, the default error response type will be used.
|
|
406
|
+
*/
|
|
281
407
|
@updatesResource(TResource)
|
|
282
408
|
op LongRunningResourceUpdate<
|
|
283
409
|
TResource extends object,
|
package/lib/models.tsp
CHANGED
|
@@ -7,6 +7,10 @@ using TypeSpec.Rest;
|
|
|
7
7
|
|
|
8
8
|
namespace Azure.Core;
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Describes a page of resource object.
|
|
12
|
+
* @template TResource The resource type.
|
|
13
|
+
*/
|
|
10
14
|
@pagedResult
|
|
11
15
|
@friendlyName("Paged{name}", TResource)
|
|
12
16
|
@doc("Paged collection of {name} items", TResource)
|
|
@@ -20,12 +24,26 @@ model Page<TResource extends object> {
|
|
|
20
24
|
nextLink?: ResourceLocation<TResource>;
|
|
21
25
|
}
|
|
22
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Defines a property as a request parameter.
|
|
29
|
+
* @template T The parameter name.
|
|
30
|
+
*/
|
|
23
31
|
@Foundations.requestParameter(T)
|
|
24
32
|
model RequestParameter<T extends string> {}
|
|
25
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Defines a property as a response header.
|
|
36
|
+
* @template T The header name.
|
|
37
|
+
*/
|
|
26
38
|
@Foundations.responseProperty(T)
|
|
27
39
|
model ResponseProperty<T extends string> {}
|
|
28
40
|
|
|
41
|
+
/**
|
|
42
|
+
* Provides the status of a resource operation.
|
|
43
|
+
* @template TResource The resource type.
|
|
44
|
+
* @template TStatusResult Model describing the status result object. If not specified, the default is the resource type.
|
|
45
|
+
* @template TStatusError Model describing the status error object. If not specified, the default is the Foundations.Error.
|
|
46
|
+
*/
|
|
29
47
|
@resource("operations")
|
|
30
48
|
@parentResource(TResource)
|
|
31
49
|
model ResourceOperationStatus<
|
package/lib/operations.tsp
CHANGED
|
@@ -14,6 +14,13 @@ using Azure.Core.Traits.Private;
|
|
|
14
14
|
|
|
15
15
|
// RPC Operations
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* A remote procedure call (RPC) operation.
|
|
19
|
+
* @template TParams Object describing the parameters of the operation.
|
|
20
|
+
* @template TResponse Object describing the response of the operation.
|
|
21
|
+
* @template Traits Object describing the traits of the operation.
|
|
22
|
+
* @template TErrorResponse Error response of the operation. If not specified, the default error response is used.
|
|
23
|
+
*/
|
|
17
24
|
@Foundations.Private.needsRoute
|
|
18
25
|
op RpcOperation<
|
|
19
26
|
TParams,
|
|
@@ -39,6 +46,11 @@ alias ExpectedResourceOperationTraits = [
|
|
|
39
46
|
}
|
|
40
47
|
];
|
|
41
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Interface containing common resource operations.
|
|
51
|
+
* @template InterfaceTraits Traits applicable to the operations.
|
|
52
|
+
* @template TErrorResponse Error response of the operations. If not specified, the default error response is used.
|
|
53
|
+
*/
|
|
42
54
|
@added(Azure.Core.Versions.v1_0_Preview_2)
|
|
43
55
|
@ensureTraitsPresent(InterfaceTraits, ExpectedResourceOperationTraits)
|
|
44
56
|
interface ResourceOperations<
|
|
@@ -343,73 +355,134 @@ alias StandardResourceOperations = ResourceOperations<NoConditionalRequests &
|
|
|
343
355
|
NoRepeatableRequests &
|
|
344
356
|
NoClientRequestId>;
|
|
345
357
|
|
|
358
|
+
/**
|
|
359
|
+
* Operation signature to create or replace a resource.
|
|
360
|
+
* @template TResource The type of the resource.
|
|
361
|
+
* @template Traits Traits to apply to the operation.
|
|
362
|
+
*/
|
|
346
363
|
@removed(Azure.Core.Versions.v1_0_Preview_2)
|
|
347
364
|
op ResourceCreateOrReplace<
|
|
348
365
|
TResource extends object,
|
|
349
366
|
Traits extends object = {}
|
|
350
367
|
> is StandardResourceOperations.ResourceCreateOrReplace<TResource, Traits>;
|
|
351
368
|
|
|
369
|
+
/**
|
|
370
|
+
* Long-running operation signature to create or replace a resource.
|
|
371
|
+
* @template TResource The type of the resource.
|
|
372
|
+
* @template Traits Traits to apply to the operation.
|
|
373
|
+
*/
|
|
352
374
|
@removed(Azure.Core.Versions.v1_0_Preview_2)
|
|
353
375
|
op LongRunningResourceCreateOrReplace<
|
|
354
376
|
TResource extends object,
|
|
355
377
|
Traits extends object = {}
|
|
356
378
|
> is StandardResourceOperations.LongRunningResourceCreateOrReplace<TResource, Traits>;
|
|
357
379
|
|
|
380
|
+
/**
|
|
381
|
+
* Operation signature to create or update a resource.
|
|
382
|
+
* @template TResource The type of the resource.
|
|
383
|
+
* @template Traits Traits to apply to the operation.
|
|
384
|
+
*/
|
|
358
385
|
@removed(Azure.Core.Versions.v1_0_Preview_2)
|
|
359
386
|
op ResourceCreateOrUpdate<
|
|
360
387
|
TResource extends object,
|
|
361
388
|
Traits extends object = {}
|
|
362
389
|
> is StandardResourceOperations.ResourceCreateOrUpdate<TResource, Traits>;
|
|
363
390
|
|
|
391
|
+
/**
|
|
392
|
+
* Long-running operation signature to create or update a resource.
|
|
393
|
+
* @template TResource The type of the resource.
|
|
394
|
+
* @template Traits Traits to apply to the operation.
|
|
395
|
+
*/
|
|
364
396
|
@removed(Azure.Core.Versions.v1_0_Preview_2)
|
|
365
397
|
op LongRunningResourceCreateOrUpdate<
|
|
366
398
|
TResource extends object,
|
|
367
399
|
Traits extends object = {}
|
|
368
400
|
> is StandardResourceOperations.LongRunningResourceCreateOrUpdate<TResource, Traits>;
|
|
369
401
|
|
|
402
|
+
/**
|
|
403
|
+
* Operation signature to update a resource.
|
|
404
|
+
* @template TResource The type of the resource.
|
|
405
|
+
* @template Traits Traits to apply to the operation.
|
|
406
|
+
*/
|
|
370
407
|
@removed(Azure.Core.Versions.v1_0_Preview_2)
|
|
371
408
|
op ResourceUpdate<
|
|
372
409
|
TResource extends object,
|
|
373
410
|
Traits extends object = {}
|
|
374
411
|
> is StandardResourceOperations.ResourceUpdate<TResource, Traits>;
|
|
375
412
|
|
|
413
|
+
/**
|
|
414
|
+
* Long-running operation signature to create a resource with a service-provided name.
|
|
415
|
+
* @template TResource The type of the resource.
|
|
416
|
+
* @template Traits Traits to apply to the operation.
|
|
417
|
+
*/
|
|
376
418
|
@removed(Azure.Core.Versions.v1_0_Preview_2)
|
|
377
419
|
op ResourceCreateWithServiceProvidedName<
|
|
378
420
|
TResource extends object,
|
|
379
421
|
Traits extends object = {}
|
|
380
422
|
> is StandardResourceOperations.ResourceCreateWithServiceProvidedName<TResource, Traits>;
|
|
381
423
|
|
|
424
|
+
/**
|
|
425
|
+
* Long-running operation signature to create a resource with a service-provided name.
|
|
426
|
+
* @template TResource The type of the resource.
|
|
427
|
+
* @template Traits Traits to apply to the operation.
|
|
428
|
+
*/
|
|
382
429
|
@removed(Azure.Core.Versions.v1_0_Preview_2)
|
|
383
430
|
op LongRunningResourceCreateWithServiceProvidedName<
|
|
384
431
|
TResource extends object,
|
|
385
432
|
Traits extends object = {}
|
|
386
433
|
> is StandardResourceOperations.LongRunningResourceCreateWithServiceProvidedName<TResource, Traits>;
|
|
387
434
|
|
|
435
|
+
/**
|
|
436
|
+
* Long-running operation signature to retrieve a resource.
|
|
437
|
+
* @template TResource The type of the resource.
|
|
438
|
+
* @template Traits Traits to apply to the operation.
|
|
439
|
+
*/
|
|
388
440
|
@removed(Azure.Core.Versions.v1_0_Preview_2)
|
|
389
441
|
op ResourceRead<
|
|
390
442
|
TResource extends object,
|
|
391
443
|
Traits extends object = {}
|
|
392
444
|
> is StandardResourceOperations.ResourceRead<TResource, Traits>;
|
|
393
445
|
|
|
446
|
+
/**
|
|
447
|
+
* Long-running operation signature to delete a resource.
|
|
448
|
+
* @template TResource The type of the resource.
|
|
449
|
+
* @template Traits Traits to apply to the operation.
|
|
450
|
+
*/
|
|
394
451
|
@removed(Azure.Core.Versions.v1_0_Preview_2)
|
|
395
452
|
op ResourceDelete<
|
|
396
453
|
TResource extends object,
|
|
397
454
|
Traits extends object = {}
|
|
398
455
|
> is StandardResourceOperations.ResourceDelete<TResource, Traits>;
|
|
399
456
|
|
|
457
|
+
/**
|
|
458
|
+
* Long-running operation signature to delete a resource.
|
|
459
|
+
* @template TResource The type of the resource.
|
|
460
|
+
* @template Traits Traits to apply to the operation.
|
|
461
|
+
*/
|
|
400
462
|
@removed(Azure.Core.Versions.v1_0_Preview_2)
|
|
401
463
|
op LongRunningResourceDelete<
|
|
402
464
|
TResource extends object,
|
|
403
465
|
Traits extends object = {}
|
|
404
466
|
> is StandardResourceOperations.LongRunningResourceDelete<TResource, Traits>;
|
|
405
467
|
|
|
468
|
+
/**
|
|
469
|
+
* Operation signature to list resources in a paginated way.
|
|
470
|
+
* @template TResource The type of the resource.
|
|
471
|
+
* @template Traits Traits to apply to the operation.
|
|
472
|
+
*/
|
|
406
473
|
@removed(Azure.Core.Versions.v1_0_Preview_2)
|
|
407
474
|
op ResourceList<
|
|
408
475
|
TResource extends object,
|
|
409
476
|
Traits extends object = {}
|
|
410
477
|
> is StandardResourceOperations.ResourceList<TResource, Traits>;
|
|
411
478
|
|
|
412
|
-
|
|
479
|
+
/**
|
|
480
|
+
* Operation signature for a resource action.
|
|
481
|
+
* @template TResource The type of the resource.
|
|
482
|
+
* @template TParams Object describing the request parameters.
|
|
483
|
+
* @template TResponse Object describing the response parameters.
|
|
484
|
+
* @template Traits Traits to apply to the operation.
|
|
485
|
+
*/
|
|
413
486
|
@removed(Azure.Core.Versions.v1_0_Preview_2)
|
|
414
487
|
op ResourceAction<
|
|
415
488
|
TResource extends object,
|
|
@@ -418,6 +491,13 @@ op ResourceAction<
|
|
|
418
491
|
Traits extends object = {}
|
|
419
492
|
> is StandardResourceOperations.ResourceAction<TResource, TParams, TResponse, Traits>;
|
|
420
493
|
|
|
494
|
+
/**
|
|
495
|
+
* Operation signature for an action that applies to a collection of resources.
|
|
496
|
+
* @template TResource The type of the resource.
|
|
497
|
+
* @template TParams Object describing the request parameters.
|
|
498
|
+
* @template TResponse Object describing the response parameters.
|
|
499
|
+
* @template Traits Traits to apply to the operation.
|
|
500
|
+
*/
|
|
421
501
|
@removed(Azure.Core.Versions.v1_0_Preview_2)
|
|
422
502
|
op ResourceCollectionAction<
|
|
423
503
|
TResource extends object,
|
|
@@ -426,6 +506,14 @@ op ResourceCollectionAction<
|
|
|
426
506
|
Traits extends object = {}
|
|
427
507
|
> is StandardResourceOperations.ResourceCollectionAction<TResource, TParams, TResponse, Traits>;
|
|
428
508
|
|
|
509
|
+
/**
|
|
510
|
+
* Long-running operation signature for a resource action.
|
|
511
|
+
* @template TResource The type of the resource.
|
|
512
|
+
* @template TParams Object describing the request parameters.
|
|
513
|
+
* @template TStatusResult Object describing the result of the status operation.
|
|
514
|
+
* @template TStatusError Object describing the error of the status operation. If not provided, the default error type is used.
|
|
515
|
+
* @template Traits Traits to apply to the operation.
|
|
516
|
+
*/
|
|
429
517
|
@removed(Azure.Core.Versions.v1_0_Preview_2)
|
|
430
518
|
op LongRunningResourceAction<
|
|
431
519
|
TResource extends object,
|
|
@@ -441,6 +529,14 @@ op LongRunningResourceAction<
|
|
|
441
529
|
Traits
|
|
442
530
|
>;
|
|
443
531
|
|
|
532
|
+
/**
|
|
533
|
+
* Long-running operation signature for an action that applies to a collection of resources.
|
|
534
|
+
* @template TResource The type of the resource.
|
|
535
|
+
* @template TParams Object describing the request parameters.
|
|
536
|
+
* @template TStatusResult Object describing the result of the status operation.
|
|
537
|
+
* @template TStatusError Object describing the error of the status operation. If not provided, the default error type is used.
|
|
538
|
+
* @template Traits Traits to apply to the operation.
|
|
539
|
+
*/
|
|
444
540
|
@removed(Azure.Core.Versions.v1_0_Preview_2)
|
|
445
541
|
op LongRunningResourceCollectionAction<
|
|
446
542
|
TResource extends object,
|
|
@@ -458,6 +554,13 @@ op LongRunningResourceCollectionAction<
|
|
|
458
554
|
|
|
459
555
|
// Resource Status Monitoring
|
|
460
556
|
|
|
557
|
+
/**
|
|
558
|
+
* Operation signature to retrieve a resource operation status.
|
|
559
|
+
* @template TResource The type of the resource.
|
|
560
|
+
* @template TStatusResult Object describing the result of the status operation.
|
|
561
|
+
* @template TStatusError Object describing the error of the status operation. If not provided, the default error type is used.
|
|
562
|
+
* @template Traits Traits to apply to the operation.
|
|
563
|
+
*/
|
|
461
564
|
@readsResource(ResourceOperationStatus<TResource>)
|
|
462
565
|
@Foundations.Private.ensureResourceType(TResource)
|
|
463
566
|
op GetResourceOperationStatus<
|
package/lib/traits.tsp
CHANGED
|
@@ -5,6 +5,9 @@ namespace Azure.Core.Traits;
|
|
|
5
5
|
using TypeSpec.Reflection;
|
|
6
6
|
using TypeSpec.Versioning;
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Enumerates the standard trait locations for Azure.Core operations.
|
|
10
|
+
*/
|
|
8
11
|
@added(Azure.Core.Versions.v1_0_Preview_2)
|
|
9
12
|
@doc("Enumerates the standard trait locations for Azure.Core operations.")
|
|
10
13
|
enum TraitLocation {
|
|
@@ -18,8 +21,11 @@ enum TraitLocation {
|
|
|
18
21
|
ApiVersionParameter,
|
|
19
22
|
}
|
|
20
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Enumerates the standard trait contexts for Azure.Core operations.
|
|
26
|
+
*/
|
|
21
27
|
@added(Azure.Core.Versions.v1_0_Preview_2)
|
|
22
|
-
@doc("
|
|
28
|
+
@doc("")
|
|
23
29
|
enum TraitContext {
|
|
24
30
|
@doc("Trait is applicable for resource 'read' operations.")
|
|
25
31
|
Read,
|
|
@@ -40,10 +46,19 @@ enum TraitContext {
|
|
|
40
46
|
Action,
|
|
41
47
|
}
|
|
42
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Used to override a trait.
|
|
51
|
+
* @template Trait The trait to override.
|
|
52
|
+
*/
|
|
43
53
|
@added(Azure.Core.Versions.v1_0_Preview_2)
|
|
44
54
|
@Private.applyTraitOverride(Trait)
|
|
45
55
|
model TraitOverride<Trait> {}
|
|
46
56
|
|
|
57
|
+
/**
|
|
58
|
+
* Declares a trait that is applied as a query parameter.
|
|
59
|
+
* @template TParams The name of the query parameter.
|
|
60
|
+
* @template Contexts The contexts in which the trait is applicable.
|
|
61
|
+
*/
|
|
47
62
|
@trait
|
|
48
63
|
@added(Azure.Core.Versions.v1_0_Preview_2)
|
|
49
64
|
@Private.ensureAllQueryParams(TParams)
|
|
@@ -55,10 +70,19 @@ model QueryParametersTrait<TParams, Contexts = unknown> {
|
|
|
55
70
|
};
|
|
56
71
|
}
|
|
57
72
|
|
|
73
|
+
/**
|
|
74
|
+
* Declares a trait that is applied as a query parameter for list operations.
|
|
75
|
+
* @template TParams Object describing the query parameters.
|
|
76
|
+
*/
|
|
58
77
|
@trait
|
|
59
78
|
@added(Azure.Core.Versions.v1_0_Preview_2)
|
|
60
79
|
model ListQueryParametersTrait<TParams> is QueryParametersTrait<TParams, TraitContext.List>;
|
|
61
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Declares a trait that is applied as a request header parameter.
|
|
83
|
+
* @template THeaders Object describing the request header parameters.
|
|
84
|
+
* @template Contexts The contexts in which the trait is applicable.
|
|
85
|
+
*/
|
|
62
86
|
@trait
|
|
63
87
|
@added(Azure.Core.Versions.v1_0_Preview_2)
|
|
64
88
|
@Private.ensureAllHeaderParams(THeaders)
|
|
@@ -70,6 +94,11 @@ model RequestHeadersTrait<THeaders, Contexts = unknown> {
|
|
|
70
94
|
};
|
|
71
95
|
}
|
|
72
96
|
|
|
97
|
+
/**
|
|
98
|
+
* Declares a trait that is applied as a response header parameter.
|
|
99
|
+
* @template THeaders Object describing the response header parameters.
|
|
100
|
+
* @template Contexts The contexts in which the trait is applicable.
|
|
101
|
+
*/
|
|
73
102
|
@trait
|
|
74
103
|
@added(Azure.Core.Versions.v1_0_Preview_2)
|
|
75
104
|
@Private.ensureAllHeaderParams(THeaders)
|
|
@@ -81,6 +110,10 @@ model ResponseHeadersTrait<THeaders, Contexts = unknown> {
|
|
|
81
110
|
};
|
|
82
111
|
}
|
|
83
112
|
|
|
113
|
+
/**
|
|
114
|
+
* Declares a version parameter trait.
|
|
115
|
+
* @template TVersionParameter The type of the version parameter.
|
|
116
|
+
*/
|
|
84
117
|
@trait("VersionParameter")
|
|
85
118
|
@added(Azure.Core.Versions.v1_0_Preview_2)
|
|
86
119
|
model VersionParameterTrait<TVersionParameter> {
|
|
@@ -186,7 +219,7 @@ extern dec trait(target: unknown, traitName?: string);
|
|
|
186
219
|
* `@traitContext` sets the applicable context for a trait on its envelope property.
|
|
187
220
|
*
|
|
188
221
|
* @param target The trait envelope property where the context will be applied.
|
|
189
|
-
* @param
|
|
222
|
+
* @param contexts An enum member or union of enum members representing the trait's
|
|
190
223
|
* applicable contexts.
|
|
191
224
|
*/
|
|
192
225
|
extern dec traitContext(target: ModelProperty, contexts: EnumMember | Union | unknown);
|
|
@@ -195,7 +228,8 @@ extern dec traitContext(target: ModelProperty, contexts: EnumMember | Union | un
|
|
|
195
228
|
* `@traitLocation` sets the applicable location for a trait on its envelope property.
|
|
196
229
|
*
|
|
197
230
|
* @param target The trait envelope property where the context will be applied.
|
|
198
|
-
* @param
|
|
231
|
+
* @param contexts An enum member or union of enum members representing the trait's
|
|
232
|
+
* applicable contexts.
|
|
199
233
|
*/
|
|
200
234
|
extern dec traitLocation(target: ModelProperty, contexts: EnumMember);
|
|
201
235
|
|
package/package.json
CHANGED