Skip to content

Commit

Permalink
Add registry delete operation (#26751)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
MilesHolland authored Oct 17, 2022
1 parent 9c473c8 commit e1b80cf
Show file tree
Hide file tree
Showing 11 changed files with 262 additions and 171 deletions.
1 change: 1 addition & 0 deletions sdk/ml/azure-ai-ml/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Features Added
- Registry list operation now accepts scope value to allow subscription-only based requests.
- Most configuration classes from the entity package now implement the standard mapping protocol.
- Add registry delete operation.

### Breaking Changes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
)
response = pipeline_response.http_response

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

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

deserialized = self._deserialize('Registry', pipeline_response)
if response.status_code == 200:
deserialized = self._deserialize('Registry', pipeline_response)

if response.status_code == 202:
deserialized = self._deserialize('Registry', pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ def delete( # pylint: disable=inconsistent-return-statements
)
response = pipeline_response.http_response

if response.status_code not in [200, 204]:
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
Expand Down Expand Up @@ -626,12 +626,16 @@ def update(
)
response = pipeline_response.http_response

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

deserialized = self._deserialize('Registry', pipeline_response)
if response.status_code == 200:
deserialized = self._deserialize('Registry', pipeline_response)

if response.status_code == 202:
deserialized = self._deserialize('Registry', pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {})
Expand Down
15 changes: 15 additions & 0 deletions sdk/ml/azure-ai-ml/azure/ai/ml/operations/_registry_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,18 @@ def begin_create(
)

return poller


# @monitor_with_activity(logger, "Registry.Delete", ActivityType.PUBLICAPI)
def delete(self, *, name: str, **kwargs: Dict) -> None:
"""Delete a registry. Returns nothing on a successful operation.
:param name: Name of the registry
:type name: str
"""
resource_group = kwargs.get("resource_group") or self._resource_group_name
return self._operation.delete(
resource_group_name=resource_group,
registry_name=name,
**self._init_kwargs,
)
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@
"200": {
"description": "Success"
},
"202": {
"description": "Success"
},
"204": {
"description": "No Content"
}
Expand Down Expand Up @@ -255,6 +258,12 @@
"schema": {
"$ref": "#/definitions/RegistryTrackedResource"
}
},
"202": {
"description": "Success",
"schema": {
"$ref": "#/definitions/RegistryTrackedResource"
}
}
},
"x-ms-examples": {
Expand Down Expand Up @@ -328,6 +337,12 @@
"schema": {
"$ref": "#/definitions/RegistryTrackedResource"
}
},
"202": {
"description": "Created",
"schema": {
"$ref": "#/definitions/RegistryTrackedResource"
}
}
},
"x-ms-examples": {
Expand Down
Loading

0 comments on commit e1b80cf

Please sign in to comment.