@azure-tools/typespec-azure-resource-manager 0.27.0 → 0.28.0-dev.1

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.
@@ -7,6 +7,11 @@ using Azure.ResourceManager.Foundations;
7
7
  namespace Azure.ResourceManager;
8
8
 
9
9
  // OPERATION TEMPLATES
10
+
11
+ /**
12
+ * A resource list operation, at the subscription scope
13
+ * @param TResource the resource being patched
14
+ */
10
15
  @autoRoute
11
16
  @doc("List {name} resources by subscription ID", TResource)
12
17
  @list(TResource)
@@ -17,6 +22,10 @@ op ArmListBySubscription<TResource extends ArmResource>(
17
22
  ...SubscriptionScope<TResource>
18
23
  ): ArmResponse<ResourceListResult<TResource>> | ErrorResponse;
19
24
 
25
+ /**
26
+ * A resource list operation, at the scope of the resource's parent
27
+ * @param TResource the resource being patched
28
+ */
20
29
  @get
21
30
  @autoRoute
22
31
  @list(TResource)
@@ -32,6 +41,11 @@ op ArmResourceListByParent<
32
41
  ...ResourceParentParameters<TResource, TBaseParameters>
33
42
  ): ArmResponse<ResourceListResult<TResource>> | ErrorResponse;
34
43
 
44
+ /**
45
+ * A resource list operation, with scope determined by TBaseParameters
46
+ * @param TResource the resource being patched
47
+ * @param TBaseParameters Optional. Allows overriding the operation parameters
48
+ */
35
49
  @get
36
50
  @autoRoute
37
51
  @list(TResource)
@@ -45,6 +59,11 @@ op ArmResourceListAtScope<
45
59
  ...ResourceParentParameters<TResource, TBaseParameters>
46
60
  ): ArmResponse<ResourceListResult<TResource>> | ErrorResponse;
47
61
 
62
+ /**
63
+ * A resource GET operation
64
+ * @param TResource the resource being patched
65
+ * @param TBaseParameters Optional. Allows overriding the operation parameters
66
+ */
48
67
  @autoRoute
49
68
  @doc("Get a {name}", TResource)
50
69
  @get
@@ -53,6 +72,11 @@ op ArmResourceRead<TResource extends ArmResource, TBaseParameters = BaseParamete
53
72
  ...ResourceInstanceParameters<TResource, TBaseParameters>
54
73
  ): ArmResponse<TResource> | ErrorResponse;
55
74
 
75
+ /**
76
+ * A long-running resource CreateOrUpdate (PUT)
77
+ * @param TResource the resource being patched
78
+ * @param TBaseParameters Optional. Allows overriding the operation parameters
79
+ */
56
80
  @autoRoute
57
81
  @doc("Create a {name}", TResource)
58
82
  @extension("x-ms-long-running-operation", true)
@@ -75,6 +99,11 @@ op ArmResourceCreateOrUpdateAsync<
75
99
  resource: TResource
76
100
  ): ArmResponse<TResource> | ArmCreatedResponse<TResource> | ErrorResponse;
77
101
 
102
+ /**
103
+ * A resource CreateOrUpdate (PUT)
104
+ * @param TResource the resource being patched
105
+ * @param TBaseParameters Optional. Allows overriding the operation parameters
106
+ */
78
107
  @autoRoute
79
108
  @doc("Create a {name}", TResource)
80
109
  @armResourceCreateOrUpdate(TResource)
@@ -90,25 +119,42 @@ op ArmResourceCreateOrUpdateSync<
90
119
  resource: TResource
91
120
  ): ArmResponse<TResource> | ErrorResponse;
92
121
 
122
+ /**
123
+ * A long-running resource update that only allows updating resource tags (the minimum)
124
+ * @param TResource the resource being patched
125
+ * @param TBaseParameters Optional. Allows overriding the operation parameters
126
+ */
93
127
  alias ArmTagsPatchAsync<
94
128
  TResource extends ArmResource,
95
129
  TProperties extends object,
96
130
  TBaseParameters = BaseParameters<TResource>
97
131
  > = ArmCustomPatchAsync<TResource, TagsUpdateModel<TResource>, TBaseParameters>;
98
132
 
133
+ /**
134
+ * A long-running resource update using the items from the resource marked with visibility "update"
135
+ * @param TResource the resource being patched
136
+ * @param TProperties The model type of the resource properties
137
+ * @param TBaseParameters Optional. Allows overriding the operation parameters
138
+ */
99
139
  alias ArmResourcePatchAsync<
100
140
  TResource extends ArmResource,
101
141
  TProperties extends object,
102
142
  TBaseParameters = BaseParameters<TResource>
103
143
  > = ArmCustomPatchAsync<TResource, ResourceUpdateModel<TResource, TProperties>, TBaseParameters>;
104
144
 
145
+ /**
146
+ * A long-running resource update using a custom PATCH payload (Asynchronous)
147
+ * @param TResource the resource being patched
148
+ * @param TPatchModel The input model for the PATCH request
149
+ * @param TBaseParameters Optional. Allows overriding the operation parameters
150
+ */
105
151
  @autoRoute
106
152
  @doc("Update a {name}", TResource)
107
153
  @extension("x-ms-long-running-operation", true)
108
154
  @extension(
109
155
  "x-ms-long-running-operation-options",
110
156
  {
111
- `final-state-via`: "azure-async-operation",
157
+ `final-state-via`: "location",
112
158
  }
113
159
  )
114
160
  @armResourceUpdate(TResource)
@@ -123,19 +169,36 @@ op ArmCustomPatchAsync<
123
169
  @doc("The resource properties to be updated.")
124
170
  @body
125
171
  properties: TPatchModel
126
- ): ArmResponse<TResource> | ArmAcceptedResponse<"Resource update request accepted."> | ErrorResponse;
172
+ ): ArmResponse<TResource> | ArmAcceptedLroResponse<"Resource update request accepted."> | ErrorResponse;
127
173
 
174
+ /**
175
+ * A resource update that only allows updating resource tags (the minimum)
176
+ * @param TResource the resource being patched
177
+ * @param TBaseParameters Optional. Allows overriding the operation parameters
178
+ */
128
179
  alias ArmTagsPatchSync<
129
180
  TResource extends ArmResource,
130
181
  TBaseParameters = BaseParameters<TResource>
131
182
  > = ArmCustomPatchSync<TResource, TagsUpdateModel<TResource>, TBaseParameters>;
132
183
 
184
+ /**
185
+ * A resource update using the items from the resource marked with visibility "update"
186
+ * @param TResource the resource being patched
187
+ * @param TProperties The model type of the resource properties
188
+ * @param TBaseParameters Optional. Allows overriding the operation parameters
189
+ */
133
190
  alias ArmResourcePatchSync<
134
191
  TResource extends ArmResource,
135
192
  TProperties extends object,
136
193
  TBaseParameters = BaseParameters<TResource>
137
194
  > = ArmCustomPatchSync<TResource, ResourceUpdateModel<TResource, TProperties>, TBaseParameters>;
138
195
 
196
+ /**
197
+ * A resource update using a custom PATCH payload (synchronous)
198
+ * @param TResource the resource being patched
199
+ * @param TPatchModel The input model for the PATCH request
200
+ * @param TBaseParameters Optional. Allows overriding the operation parameters
201
+ */
139
202
  @autoRoute
140
203
  @doc("Update a {name}", TResource)
141
204
  @armResourceUpdate(TResource)
@@ -152,13 +215,18 @@ op ArmCustomPatchSync<
152
215
  properties: TPatchModel
153
216
  ): ArmResponse<TResource> | ErrorResponse;
154
217
 
218
+ /**
219
+ * Delete a resource Asynchronously
220
+ * @param TResource The resource being deleted
221
+ * @param TBaseParameters Optional. Allows overriding the parameters for the operation
222
+ */
155
223
  @autoRoute
156
224
  @doc("Delete a {name}", TResource)
157
225
  @extension("x-ms-long-running-operation", true)
158
226
  @extension(
159
227
  "x-ms-long-running-operation-options",
160
228
  {
161
- `final-state-via`: "azure-async-operation",
229
+ `final-state-via`: "location",
162
230
  }
163
231
  )
164
232
  @armResourceDelete(TResource)
@@ -168,7 +236,7 @@ op ArmResourceDeleteAsync<
168
236
  TBaseParameters = BaseParameters<TResource>
169
237
  >(...ResourceInstanceParameters<TResource, TBaseParameters>):
170
238
  | ArmDeletedResponse
171
- | ArmDeleteAcceptedResponse
239
+ | ArmDeleteAcceptedLroResponse
172
240
  | ArmDeletedNoContentResponse
173
241
  | ErrorResponse;
174
242
 
@@ -188,7 +256,7 @@ op ArmResourceDeleteSync<
188
256
  @extension(
189
257
  "x-ms-long-running-operation-options",
190
258
  {
191
- `final-state-via`: "azure-async-operation",
259
+ `final-state-via`: "location",
192
260
  }
193
261
  )
194
262
  @armResourceAction(TResource)
@@ -204,7 +272,7 @@ op ArmResourceActionAsync<
204
272
  @doc("The content of the action request")
205
273
  @body
206
274
  body: TRequest
207
- ): ArmResponse<TResponse> | ArmAcceptedResponse | ErrorResponse;
275
+ ): ArmAcceptedLroResponse | ArmResponse<TResponse> | ErrorResponse;
208
276
 
209
277
  @autoRoute
210
278
  @armResourceAction(TResource)
@@ -227,7 +295,7 @@ op ArmResourceActionSync<
227
295
  @extension(
228
296
  "x-ms-long-running-operation-options",
229
297
  {
230
- `final-state-via`: "azure-async-operation",
298
+ `final-state-via`: "location",
231
299
  }
232
300
  )
233
301
  @armResourceAction(TResource)
@@ -242,7 +310,7 @@ op ArmResourceActionNoContentAsync<
242
310
  @doc("The content of the action request")
243
311
  @body
244
312
  body: TRequest
245
- ): ArmNoContentResponse<"Action completed successfully."> | ArmAcceptedResponse | ErrorResponse;
313
+ ): ArmAcceptedLroResponse | ArmNoContentResponse<"Action completed successfully."> | ErrorResponse;
246
314
 
247
315
  @autoRoute
248
316
  @armResourceAction(TResource)
package/lib/responses.tsp CHANGED
@@ -5,12 +5,18 @@ using Azure.ResourceManager.Foundations;
5
5
 
6
6
  namespace Azure.ResourceManager;
7
7
 
8
+ /**
9
+ * The ARM synchronous OK response
10
+ */
8
11
  @doc("ARM operation completed successfully.")
9
12
  model ArmResponse<T> {
10
13
  ...OkResponse;
11
14
  ...Body<T>;
12
15
  }
13
16
 
17
+ /**
18
+ * The ARM 201 response for a resource
19
+ */
14
20
  @doc("ARM create operation completed successfully.")
15
21
  model ArmCreatedResponse<T> {
16
22
  ...CreatedResponse;
@@ -18,11 +24,19 @@ model ArmCreatedResponse<T> {
18
24
  ...Body<T>;
19
25
  }
20
26
 
27
+ /**
28
+ * The response for synchronous delete of a resource
29
+ */
21
30
  @doc("Resource deleted successfully.")
22
31
  model ArmDeletedResponse {
23
32
  ...OkResponse;
24
33
  }
25
34
 
35
+ /**
36
+ * The response for asynchronous ARM delete ACCEPTED
37
+ */
38
+ model ArmDeleteAcceptedLroResponse is ArmAcceptedLroResponse<"Resource deletion accepted.">;
39
+
26
40
  model ArmDeleteAcceptedResponse is ArmAcceptedResponse<"Resource deletion accepted.">;
27
41
 
28
42
  @doc(TMessage)
@@ -31,13 +45,32 @@ model ArmAcceptedResponse<TMessage extends string = "Resource operation accepted
31
45
  ...Azure.Core.Foundations.RetryAfterHeader;
32
46
  }
33
47
 
48
+ /**
49
+ * The standard ARM response for asynchronous PATCH, POST, and DELETE operations
50
+ */
51
+ model ArmAcceptedLroResponse<TMessage extends string = "Resource operation accepted.">
52
+ is ArmAcceptedResponse<TMessage> {
53
+ @doc("The Location header contains the URL where the status of the long running operation can be checked.")
54
+ @header("Location")
55
+ location?: string;
56
+ }
57
+
58
+ /**
59
+ * ARM response for a properly formed delete request, with no resource found
60
+ */
34
61
  model ArmDeletedNoContentResponse is ArmNoContentResponse<"Resource deleted successfully.">;
35
62
 
63
+ /**
64
+ * Standard ARM NoContent (204) response
65
+ */
36
66
  @doc(TMessage)
37
67
  model ArmNoContentResponse<TMessage extends string = "Operation completed successfully."> {
38
68
  ...NoContentResponse;
39
69
  }
40
70
 
71
+ /**
72
+ * The standard ARM error response
73
+ */
41
74
  @error
42
75
  @armCommonDefinition
43
76
  @doc("Common error response for all Azure Resource Manager APIs to return error details for failed operations.")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure-tools/typespec-azure-resource-manager",
3
- "version": "0.27.0",
3
+ "version": "0.28.0-dev.1",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec Azure Resource Manager library",
6
6
  "homepage": "https://azure.github.io/typespec-azure",
@@ -42,30 +42,30 @@
42
42
  "!dist/test/**"
43
43
  ],
44
44
  "peerDependencies": {
45
- "@typespec/compiler": "~0.41.0",
46
- "@azure-tools/typespec-azure-core": "~0.27.0",
47
- "@azure-tools/typespec-autorest": "~0.27.0",
48
- "@typespec/openapi": "~0.41.0",
49
- "@typespec/rest": "~0.41.0",
50
- "@typespec/http": "~0.41.0",
51
- "@typespec/versioning": "~0.41.0"
45
+ "@typespec/compiler": ">=0.41.0",
46
+ "@azure-tools/typespec-azure-core": ">=0.27.0",
47
+ "@azure-tools/typespec-autorest": ">=0.27.0",
48
+ "@typespec/openapi": ">=0.41.0",
49
+ "@typespec/rest": ">=0.41.0",
50
+ "@typespec/http": ">=0.41.0",
51
+ "@typespec/versioning": ">=0.41.0"
52
52
  },
53
53
  "dependencies": {
54
- "@typespec/lint": "~0.41.0"
54
+ "@typespec/lint": ">=0.41.0"
55
55
  },
56
56
  "devDependencies": {
57
- "@typespec/compiler": "~0.41.0",
58
- "@typespec/openapi": "~0.41.0",
59
- "@azure-tools/typespec-azure-core": "~0.27.0",
60
- "@azure-tools/typespec-autorest": "~0.27.0",
61
- "@typespec/rest": "~0.41.0",
62
- "@typespec/http": "~0.41.0",
63
- "@typespec/versioning": "~0.41.0",
57
+ "@typespec/compiler": ">=0.41.0",
58
+ "@typespec/openapi": ">=0.41.0",
59
+ "@azure-tools/typespec-azure-core": ">=0.27.0",
60
+ "@azure-tools/typespec-autorest": ">=0.27.0",
61
+ "@typespec/rest": ">=0.41.0",
62
+ "@typespec/http": ">=0.41.0",
63
+ "@typespec/versioning": ">=0.41.0",
64
64
  "@types/mocha": "~10.0.0",
65
65
  "@types/node": "~18.11.9",
66
- "@typespec/eslint-config-typespec": "~0.6.0",
67
- "@typespec/library-linter": "~0.41.0",
68
- "@typespec/eslint-plugin": "~0.41.0",
66
+ "@typespec/eslint-config-typespec": ">=0.6.0",
67
+ "@typespec/library-linter": ">=0.41.0",
68
+ "@typespec/eslint-plugin": ">=0.41.0",
69
69
  "eslint": "^8.12.0",
70
70
  "mocha": "~10.1.0",
71
71
  "c8": "~7.12.0",