Skip to content

Commit 949e5b8

Browse files
andrewmathew1Andrew Mathew
andauthored
Added response hook to replace throughput (#43243)
* added response hook to replace throughput * got rid of response hook logic replace_throughput method * got rid of extra list in doctring * pylint fixes --------- Co-authored-by: Andrew Mathew <[email protected]>
1 parent 65f6f1a commit 949e5b8

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

sdk/cosmos/azure-cosmos/azure/cosmos/aio/_container.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,9 +1444,11 @@ async def get_throughput(
14441444
return _deserialize_throughput(throughput=throughput_properties)
14451445

14461446
@distributed_trace_async
1447-
async def replace_throughput(
1447+
async def replace_throughput( # pylint: disable=unused-argument
14481448
self,
14491449
throughput: Union[int, ThroughputProperties],
1450+
*,
1451+
response_hook: Optional[Callable[[Mapping[str, Any], CosmosDict], None]] = None,
14501452
**kwargs: Any
14511453
) -> ThroughputProperties:
14521454
"""Replace the container's throughput.
@@ -1456,7 +1458,7 @@ async def replace_throughput(
14561458
:param throughput: The throughput to be set.
14571459
:type throughput: Union[int, ~azure.cosmos.ThroughputProperties]
14581460
:keyword response_hook: A callable invoked with the response metadata.
1459-
:paramtype response_hook: Callable[[Dict[str, str], Dict[str, Any]], None]
1461+
:paramtype response_hook: Callable[[Mapping[str, Any], CosmosDict], None]
14601462
:raises ~azure.cosmos.exceptions.CosmosHttpResponseError: No throughput properties exist for the container
14611463
or the throughput properties could not be updated.
14621464
:returns: ThroughputProperties for the container, updated with new throughput.

sdk/cosmos/azure-cosmos/azure/cosmos/container.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1625,9 +1625,11 @@ def get_throughput(
16251625
return _deserialize_throughput(throughput=throughput_properties)
16261626

16271627
@distributed_trace
1628-
def replace_throughput(
1628+
def replace_throughput( # pylint: disable=unused-argument
16291629
self,
16301630
throughput: Union[int, ThroughputProperties],
1631+
*,
1632+
response_hook: Optional[Callable[[Mapping[str, Any], CosmosDict], None]] = None,
16311633
**kwargs: Any
16321634
) -> ThroughputProperties:
16331635
"""Replace the container's throughput.
@@ -1636,6 +1638,8 @@ def replace_throughput(
16361638
16371639
:param throughput: The throughput to be set.
16381640
:type throughput: Union[int, ~azure.cosmos.ThroughputProperties]
1641+
:keyword response_hook: A callable invoked with the response metadata.
1642+
:paramtype response_hook: Callable[[Mapping[str, Any], CosmosDict], None]
16391643
:returns: ThroughputProperties for the container, updated with new throughput.
16401644
:raises ~azure.cosmos.exceptions.CosmosHttpResponseError: No throughput properties exist for the container
16411645
or the throughput properties could not be updated.

0 commit comments

Comments
 (0)