@azure-tools/typespec-azure-resource-manager 0.43.0-dev.7 → 0.43.0-dev.9
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/models.tsp +7 -2
- package/lib/operations.tsp +5 -31
- package/lib/responses.tsp +7 -4
- package/package.json +1 -1
package/lib/models.tsp
CHANGED
|
@@ -11,22 +11,27 @@ namespace Azure.ResourceManager;
|
|
|
11
11
|
* Spread this model into ARM resource models to specify resource name parameter for its operations. If `Resource` parameter
|
|
12
12
|
* is specified, the resource name will be properly camel cased and pluralized for `@key` and `@segment`
|
|
13
13
|
* automatically. You can also apply explicit override with `KeyName` and `SegmentName` template parameters.
|
|
14
|
+
*
|
|
15
|
+
* For additional decorators such as @minLength, you can use either augment decorator on `[Resource].name` or passing in a scalar string type with decorators.
|
|
16
|
+
*
|
|
14
17
|
* @template Resource The ARM resource this name parameter is applying to.
|
|
15
18
|
* @template KeyName Override default key name of the resource.
|
|
16
19
|
* @template SegmentName Override default segment name of the resource.
|
|
17
20
|
* @template NamePattern The RegEx pattern of the name. Default is `^[a-zA-Z0-9-]{3,24}$`.
|
|
21
|
+
* @template Type The type of the name property. Default type is string. However you can pass an union with string values.
|
|
18
22
|
*/
|
|
19
23
|
model ResourceNameParameter<
|
|
20
24
|
Resource extends Foundations.Resource,
|
|
21
25
|
KeyName extends valueof string = "",
|
|
22
26
|
SegmentName extends valueof string = "",
|
|
23
|
-
NamePattern extends valueof string = "^[a-zA-Z0-9-]{3,24}$"
|
|
27
|
+
NamePattern extends valueof string = "^[a-zA-Z0-9-]{3,24}$",
|
|
28
|
+
Type extends string = string
|
|
24
29
|
> {
|
|
25
30
|
@doc("The name of the {name}", Resource)
|
|
26
31
|
@pattern(NamePattern)
|
|
27
32
|
@defaultResourceKeySegmentName(Resource, KeyName, SegmentName)
|
|
28
33
|
@path
|
|
29
|
-
name:
|
|
34
|
+
name: Type;
|
|
30
35
|
}
|
|
31
36
|
|
|
32
37
|
//#region Standard Resource Operation Interfaces
|
package/lib/operations.tsp
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
using TypeSpec.Http;
|
|
2
2
|
using TypeSpec.Rest;
|
|
3
|
-
using TypeSpec.OpenAPI;
|
|
4
3
|
using Azure.ResourceManager.Foundations;
|
|
5
4
|
|
|
6
5
|
namespace Azure.ResourceManager;
|
|
@@ -144,20 +143,15 @@ op ArmResourceCheckExistence<
|
|
|
144
143
|
*/
|
|
145
144
|
@autoRoute
|
|
146
145
|
@doc("Create a {name}", Resource)
|
|
147
|
-
@extension("x-ms-long-running-operation", true)
|
|
148
|
-
@extension(
|
|
149
|
-
"x-ms-long-running-operation-options",
|
|
150
|
-
{
|
|
151
|
-
`final-state-via`: "azure-async-operation",
|
|
152
|
-
}
|
|
153
|
-
)
|
|
154
146
|
@armResourceCreateOrUpdate(Resource)
|
|
155
147
|
@Private.enforceConstraint(Resource, Foundations.Resource)
|
|
148
|
+
@Azure.Core.Foundations.Private.defaultFinalStateVia(#["location", "azure-async-operation"])
|
|
156
149
|
@put
|
|
157
150
|
op ArmResourceCreateOrUpdateAsync<
|
|
158
151
|
Resource extends Foundations.Resource,
|
|
159
152
|
BaseParameters = DefaultBaseParameters<Resource>,
|
|
160
|
-
LroHeaders extends TypeSpec.Reflection.Model =
|
|
153
|
+
LroHeaders extends TypeSpec.Reflection.Model = ArmAsyncOperationHeader<FinalResult = Resource> &
|
|
154
|
+
Azure.Core.Foundations.RetryAfterHeader,
|
|
161
155
|
Parameters extends {} = {},
|
|
162
156
|
Response extends {} = ArmResourceUpdatedResponse<Resource> | ArmResourceCreatedResponse<
|
|
163
157
|
Resource,
|
|
@@ -237,7 +231,8 @@ op ArmResourceCreateOrReplaceSync<
|
|
|
237
231
|
op ArmResourceCreateOrReplaceAsync<
|
|
238
232
|
Resource extends Foundations.Resource,
|
|
239
233
|
BaseParameters = DefaultBaseParameters<Resource>,
|
|
240
|
-
LroHeaders extends TypeSpec.Reflection.Model =
|
|
234
|
+
LroHeaders extends TypeSpec.Reflection.Model = ArmAsyncOperationHeader<FinalResult = Resource> &
|
|
235
|
+
Azure.Core.Foundations.RetryAfterHeader,
|
|
241
236
|
Parameters extends {} = {},
|
|
242
237
|
Response extends {} = ArmResourceUpdatedResponse<Resource> | ArmResourceCreatedResponse<
|
|
243
238
|
Resource,
|
|
@@ -320,13 +315,6 @@ op ArmResourcePatchAsync<
|
|
|
320
315
|
*/
|
|
321
316
|
@autoRoute
|
|
322
317
|
@doc("Update a {name}", Resource)
|
|
323
|
-
@extension("x-ms-long-running-operation", true)
|
|
324
|
-
@extension(
|
|
325
|
-
"x-ms-long-running-operation-options",
|
|
326
|
-
{
|
|
327
|
-
`final-state-via`: "location",
|
|
328
|
-
}
|
|
329
|
-
)
|
|
330
318
|
@armResourceUpdate(Resource)
|
|
331
319
|
@Private.enforceConstraint(Resource, Foundations.Resource)
|
|
332
320
|
@patch
|
|
@@ -424,13 +412,6 @@ op ArmCustomPatchSync<
|
|
|
424
412
|
*/
|
|
425
413
|
@autoRoute
|
|
426
414
|
@doc("Delete a {name}", Resource)
|
|
427
|
-
@extension("x-ms-long-running-operation", true)
|
|
428
|
-
@extension(
|
|
429
|
-
"x-ms-long-running-operation-options",
|
|
430
|
-
{
|
|
431
|
-
`final-state-via`: "location",
|
|
432
|
-
}
|
|
433
|
-
)
|
|
434
415
|
@armResourceDelete(Resource)
|
|
435
416
|
@Private.enforceConstraint(Resource, Foundations.Resource)
|
|
436
417
|
@delete
|
|
@@ -514,13 +495,6 @@ op ArmResourceDeleteSync<
|
|
|
514
495
|
* @template Error Optional. The error response, if non-standard.
|
|
515
496
|
*/
|
|
516
497
|
@autoRoute
|
|
517
|
-
@extension("x-ms-long-running-operation", true)
|
|
518
|
-
@extension(
|
|
519
|
-
"x-ms-long-running-operation-options",
|
|
520
|
-
{
|
|
521
|
-
`final-state-via`: "location",
|
|
522
|
-
}
|
|
523
|
-
)
|
|
524
498
|
@armResourceAction(Resource)
|
|
525
499
|
@Private.enforceConstraint(Resource, Foundations.Resource)
|
|
526
500
|
@post
|
package/lib/responses.tsp
CHANGED
|
@@ -131,15 +131,18 @@ model ArmOperationStatus<
|
|
|
131
131
|
/**
|
|
132
132
|
* The standard header for asynchronous operation polling
|
|
133
133
|
* @template StatusMonitor The status monitor type for lro polling
|
|
134
|
-
* @template UrlValue The value type of the Azure-AsyncOperation
|
|
134
|
+
* @template UrlValue The value type of the Azure-AsyncOperation header
|
|
135
|
+
* @template FinalResult The logical final result of the operation
|
|
135
136
|
*/
|
|
136
137
|
model ArmAsyncOperationHeader<
|
|
137
138
|
StatusMonitor extends {} = ArmOperationStatus,
|
|
138
|
-
UrlValue extends string = string
|
|
139
|
+
UrlValue extends string = string,
|
|
140
|
+
FinalResult extends {} = never
|
|
139
141
|
> {
|
|
140
142
|
/** A link to the status monitor */
|
|
141
143
|
@header("Azure-AsyncOperation")
|
|
142
|
-
@Azure.Core.pollingLocation(Azure.Core.StatusMonitorPollingOptions<StatusMonitor>)
|
|
144
|
+
@Azure.Core.pollingLocation(Azure.Core.StatusMonitorPollingOptions<PollingModel = StatusMonitor>)
|
|
145
|
+
@Azure.Core.finalLocation(FinalResult)
|
|
143
146
|
azureAsyncOperation?: UrlValue;
|
|
144
147
|
}
|
|
145
148
|
|
|
@@ -150,7 +153,7 @@ model ArmAsyncOperationHeader<
|
|
|
150
153
|
* @template UrlValue The value type for the location header
|
|
151
154
|
*/
|
|
152
155
|
model ArmLroLocationHeader<
|
|
153
|
-
LroPollingOptions extends Azure.Core.PollingOptions = Azure.Core.StatusMonitorPollingOptions<ArmOperationStatus>,
|
|
156
|
+
LroPollingOptions extends Azure.Core.PollingOptions = Azure.Core.StatusMonitorPollingOptions<PollingModel = ArmOperationStatus>,
|
|
154
157
|
FinalResult extends {} | void = void,
|
|
155
158
|
UrlValue extends string = string
|
|
156
159
|
> {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure-tools/typespec-azure-resource-manager",
|
|
3
|
-
"version": "0.43.0-dev.
|
|
3
|
+
"version": "0.43.0-dev.9",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "TypeSpec Azure Resource Manager library",
|
|
6
6
|
"homepage": "https://azure.github.io/typespec-azure",
|