Skip to content

Commit e1b80cf

Browse files
authored
Add registry delete operation (#26751)
* initial delete files * delete swagger and autorest corrections * change delete param name * update recordings and e2e test * add changelog line * fix op return comments, make test require error on last op * remove unneeded variable declaration
1 parent 9c473c8 commit e1b80cf

File tree

11 files changed

+262
-171
lines changed

11 files changed

+262
-171
lines changed

sdk/ml/azure-ai-ml/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Features Added
66
- Registry list operation now accepts scope value to allow subscription-only based requests.
77
- Most configuration classes from the entity package now implement the standard mapping protocol.
8+
- Add registry delete operation.
89

910
### Breaking Changes
1011

sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_10_01_preview/aio/operations/_registries_operations.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
260260
)
261261
response = pipeline_response.http_response
262262

263-
if response.status_code not in [200, 204]:
263+
if response.status_code not in [200, 202, 204]:
264264
map_error(status_code=response.status_code, response=response, error_map=error_map)
265265
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
266266
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
@@ -385,12 +385,16 @@ async def update(
385385
)
386386
response = pipeline_response.http_response
387387

388-
if response.status_code not in [200]:
388+
if response.status_code not in [200, 202]:
389389
map_error(status_code=response.status_code, response=response, error_map=error_map)
390390
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
391391
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
392392

393-
deserialized = self._deserialize('Registry', pipeline_response)
393+
if response.status_code == 200:
394+
deserialized = self._deserialize('Registry', pipeline_response)
395+
396+
if response.status_code == 202:
397+
deserialized = self._deserialize('Registry', pipeline_response)
394398

395399
if cls:
396400
return cls(pipeline_response, deserialized, {})

sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_10_01_preview/operations/_registries_operations.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ def delete( # pylint: disable=inconsistent-return-statements
499499
)
500500
response = pipeline_response.http_response
501501

502-
if response.status_code not in [200, 204]:
502+
if response.status_code not in [200, 202, 204]:
503503
map_error(status_code=response.status_code, response=response, error_map=error_map)
504504
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
505505
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
@@ -626,12 +626,16 @@ def update(
626626
)
627627
response = pipeline_response.http_response
628628

629-
if response.status_code not in [200]:
629+
if response.status_code not in [200, 202]:
630630
map_error(status_code=response.status_code, response=response, error_map=error_map)
631631
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
632632
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
633633

634-
deserialized = self._deserialize('Registry', pipeline_response)
634+
if response.status_code == 200:
635+
deserialized = self._deserialize('Registry', pipeline_response)
636+
637+
if response.status_code == 202:
638+
deserialized = self._deserialize('Registry', pipeline_response)
635639

636640
if cls:
637641
return cls(pipeline_response, deserialized, {})

sdk/ml/azure-ai-ml/azure/ai/ml/operations/_registry_operations.py

+15
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,18 @@ def begin_create(
134134
)
135135

136136
return poller
137+
138+
139+
# @monitor_with_activity(logger, "Registry.Delete", ActivityType.PUBLICAPI)
140+
def delete(self, *, name: str, **kwargs: Dict) -> None:
141+
"""Delete a registry. Returns nothing on a successful operation.
142+
143+
:param name: Name of the registry
144+
:type name: str
145+
"""
146+
resource_group = kwargs.get("resource_group") or self._resource_group_name
147+
return self._operation.delete(
148+
resource_group_name=resource_group,
149+
registry_name=name,
150+
**self._init_kwargs,
151+
)

sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-10-01-preview/registries.json

+15
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@
143143
"200": {
144144
"description": "Success"
145145
},
146+
"202": {
147+
"description": "Success"
148+
},
146149
"204": {
147150
"description": "No Content"
148151
}
@@ -255,6 +258,12 @@
255258
"schema": {
256259
"$ref": "#/definitions/RegistryTrackedResource"
257260
}
261+
},
262+
"202": {
263+
"description": "Success",
264+
"schema": {
265+
"$ref": "#/definitions/RegistryTrackedResource"
266+
}
258267
}
259268
},
260269
"x-ms-examples": {
@@ -328,6 +337,12 @@
328337
"schema": {
329338
"$ref": "#/definitions/RegistryTrackedResource"
330339
}
340+
},
341+
"202": {
342+
"description": "Created",
343+
"schema": {
344+
"$ref": "#/definitions/RegistryTrackedResource"
345+
}
331346
}
332347
},
333348
"x-ms-examples": {

0 commit comments

Comments
 (0)