Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

### Other Changes

## 1.0.1 (2025-03-11)

- Fix polling for `begin_copy_model_to()` to stop on success response from the "Operation-Location" endpoint and correctly parse the result.

## 1.0.0 (2024-12-17)

### Features Added
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# pylint: disable=line-too-long,useless-suppression
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
Expand All @@ -13,7 +14,7 @@

from azure.core.pipeline import PipelineResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.polling.base_polling import LROBasePolling
from azure.core.polling.base_polling import LROBasePolling, OperationResourcePolling
from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
Expand All @@ -40,6 +41,17 @@ def _parse_operation_id(operation_location_header):
return re.match(regex, operation_location_header).group(1)


class DocumentModelAdministrationPolling(OperationResourcePolling):
"""Polling method overrides for administration endpoints."""

def get_final_get_url(self, pipeline_response: Any) -> None:
"""If a final GET is needed, returns the URL.

:param any pipeline_response: The pipeline response to get the final url.
:rtype: None
"""
return None

class AnalyzeDocumentLROPoller(LROPoller[PollingReturnType_co]):
@property
def details(self) -> Mapping[str, Any]:
Expand Down Expand Up @@ -283,7 +295,7 @@ def get_long_running_output(pipeline_response):
"str", response.headers.get("Operation-Location")
)

deserialized = _deserialize(_models.DocumentModelDetails, response.json())
deserialized = _deserialize(_models.DocumentModelDetails, response.json()["result"])
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
Expand All @@ -294,7 +306,7 @@ def get_long_running_output(pipeline_response):

if polling is True:
polling_method: PollingMethod = cast(
PollingMethod, LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs)
PollingMethod, LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, lro_algorithms=[DocumentModelAdministrationPolling()], **kwargs)
)
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
)
from ... import models as _models
from ..._model_base import _deserialize
from ..._operations._patch import PollingReturnType_co, _parse_operation_id
from ..._operations._patch import PollingReturnType_co, _parse_operation_id, DocumentModelAdministrationPolling

if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
Expand Down Expand Up @@ -265,7 +265,7 @@ def get_long_running_output(pipeline_response):
"str", response.headers.get("Operation-Location")
)

deserialized = _deserialize(_models.DocumentModelDetails, response.json())
deserialized = _deserialize(_models.DocumentModelDetails, response.json()["result"])
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
Expand All @@ -277,7 +277,12 @@ def get_long_running_output(pipeline_response):
if polling is True:
polling_method: AsyncPollingMethod = cast(
AsyncPollingMethod,
AsyncLROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs),
AsyncLROBasePolling(
lro_delay,
path_format_arguments=path_format_arguments,
lro_algorithms=[DocumentModelAdministrationPolling()],
**kwargs
),
)
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
Expand Down