Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ServiceBus] add keyword override support to update_ methods in mgmt module #18210

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
pr review feedback
  • Loading branch information
yunhaoling committed Apr 22, 2021
commit ae831d1b29134dc2dd44a63336d6c79a7136408e
3 changes: 2 additions & 1 deletion sdk/servicebus/azure-servicebus/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

**Bug Fixes**

* Fixed a bug that `update_queue` and `update_subscription` mutating the properties `forward_to` and `forward_dead_lettered_messages_to` of the model instance when those properties are entities instead of full paths.
* Fixed a bug where `update_queue` and `update_subscription` methods were mutating the properties `forward_to` and `forward_dead_lettered_messages_to` of
the model instance when those properties are entities instead of full paths.
yunhaoling marked this conversation as resolved.
Show resolved Hide resolved

## 7.1.1 (2021-04-07)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,9 @@ async def update_queue(
Before calling this method, you should use `get_queue`, `create_queue` or `list_queues` to get a
`QueueProperties` instance, then update the properties. Only a portion of properties can
be updated. Refer to https://docs.microsoft.com/en-us/rest/api/servicebus/update-queue.
You could also pass keyword arguments for updating properties in the form of
`<property_name>=<property_value>` which will override whatever was specified in
the `QueueProperties` instance. Refer to ~azure.servicebus.management.QueueProperties for names of properties.

:param queue: The queue that is returned from `get_queue`, `create_queue` or `list_queues` and
has the updated properties.
Expand Down Expand Up @@ -666,6 +669,9 @@ async def update_topic(
Before calling this method, you should use `get_topic`, `create_topic` or `list_topics` to get a
`TopicProperties` instance, then update the properties. Only a portion of properties can be updated.
Refer to https://docs.microsoft.com/en-us/rest/api/servicebus/update-topic.
You could also pass keyword arguments for updating properties in the form of
`<property_name>=<property_value>` which will override whatever was specified in
the `TopicProperties` instance. Refer to ~azure.servicebus.management.TopicProperties for names of properties.

:param topic: The topic that is returned from `get_topic`, `create_topic`, or `list_topics`
and has the updated properties.
Expand Down Expand Up @@ -927,6 +933,10 @@ async def update_subscription(

Before calling this method, you should use `get_subscription`, `update_subscription` or `list_subscription`
to get a `SubscriptionProperties` instance, then update the properties.
You could also pass keyword arguments for updating properties in the form of
`<property_name>=<property_value>` which will override whatever was specified in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should these keywords be documeneted?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to be vague here -- I'm not sure whether those keywords should be documented.
as once documented, then it feels like we're promoting using keyword arguments to do updates -- two ways to do the same thing.

@annatisch , do you think we'd better document those keyword arguments?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm I don't feel strongly either way.... documentation can always be updated as needed.
You could add an example in the code snippet to show their use rather than call them all out explicitly.

Copy link
Contributor Author

@yunhaoling yunhaoling May 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code snippets updated! @rakshith91 are you good with updating the docs later?

the `SubscriptionProperties` instance.
Refer to ~azure.servicebus.management.SubscriptionProperties for names of properties.

:param str topic_name: The topic that owns the subscription.
:param ~azure.servicebus.management.SubscriptionProperties subscription: The subscription that is returned
Expand Down Expand Up @@ -1139,6 +1149,9 @@ async def update_rule(

Before calling this method, you should use `get_rule`, `create_rule` or `list_rules` to get a `RuleProperties`
instance, then update the properties.
You could also pass keyword arguments for updating properties in the form of
`<property_name>=<property_value>` which will override whatever was specified in
the `RuleProperties` instance. Refer to ~azure.servicebus.management.RuleProperties for names of properties.

:param str topic_name: The topic that owns the subscription.
:param str subscription_name: The subscription that
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,9 @@ def update_queue(self, queue, **kwargs):
Before calling this method, you should use `get_queue`, `create_queue` or `list_queues` to get a
`QueueProperties` instance, then update the properties. Only a portion of properties can
be updated. Refer to https://docs.microsoft.com/en-us/rest/api/servicebus/update-queue.
You could also pass keyword arguments for updating properties in the form of
`<property_name>=<property_value>` which will override whatever was specified in
the `QueueProperties` instance. Refer to ~azure.servicebus.management.QueueProperties for names of properties.

:param queue: The queue that is returned from `get_queue`, `create_queue` or `list_queues` and
has the updated properties.
Expand Down Expand Up @@ -656,6 +659,9 @@ def update_topic(self, topic, **kwargs):
Before calling this method, you should use `get_topic`, `create_topic` or `list_topics` to get a
`TopicProperties` instance, then update the properties. Only a portion of properties can be updated.
Refer to https://docs.microsoft.com/en-us/rest/api/servicebus/update-topic.
You could also pass keyword arguments for updating properties in the form of
`<property_name>=<property_value>` which will override whatever was specified in
the `TopicProperties` instance. Refer to ~azure.servicebus.management.TopicProperties for names of properties.

:param topic: The topic that is returned from `get_topic`, `create_topic`, or `list_topics`
and has the updated properties.
Expand Down Expand Up @@ -913,6 +919,10 @@ def update_subscription(self, topic_name, subscription, **kwargs):

Before calling this method, you should use `get_subscription`, `update_subscription` or `list_subscription`
to get a `SubscriptionProperties` instance, then update the properties.
You could also pass keyword arguments for updating properties in the form of
`<property_name>=<property_value>` which will override whatever was specified in
the `SubscriptionProperties` instance.
Refer to ~azure.servicebus.management.SubscriptionProperties for names of properties.

:param str topic_name: The topic that owns the subscription.
:param ~azure.servicebus.management.SubscriptionProperties subscription: The subscription that is returned
Expand Down Expand Up @@ -1114,6 +1124,9 @@ def update_rule(self, topic_name, subscription_name, rule, **kwargs):

Before calling this method, you should use `get_rule`, `create_rule` or `list_rules` to get a `RuleProperties`
instance, then update the properties.
You could also pass keyword arguments for updating properties in the form of
`<property_name>=<property_value>` which will override whatever was specified in
the `RuleProperties` instance. Refer to ~azure.servicebus.management.RuleProperties for names of properties.

:param str topic_name: The topic that owns the subscription.
:param str subscription_name: The subscription that
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@ async def test_mgmt_queue_async_update_dict_success(self, servicebus_namespace_c

finally:
await mgmt_service.delete_queue(queue_name)
yunhaoling marked this conversation as resolved.
Show resolved Hide resolved
await mgmt_service.close()

@pytest.mark.liveTest
@CachedResourceGroupPreparer(name_prefix='servicebustest')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ async def test_async_mgmt_rule_update_success(self, servicebus_namespace_connect
await mgmt_service.delete_rule(topic_name, subscription_name, rule_name)
await mgmt_service.delete_subscription(topic_name, subscription_name)
yunhaoling marked this conversation as resolved.
Show resolved Hide resolved
await mgmt_service.delete_topic(topic_name)
await mgmt_service.close()

@CachedResourceGroupPreparer(name_prefix='servicebustest')
@CachedServiceBusNamespacePreparer(name_prefix='servicebustest')
Expand Down Expand Up @@ -310,6 +311,7 @@ async def test_mgmt_rule_async_update_dict_success(self, servicebus_namespace_co
await mgmt_service.delete_rule(topic_name, subscription_name, rule_name)
await mgmt_service.delete_subscription(topic_name, subscription_name)
yunhaoling marked this conversation as resolved.
Show resolved Hide resolved
await mgmt_service.delete_topic(topic_name)
await mgmt_service.close()

@CachedResourceGroupPreparer(name_prefix='servicebustest')
@CachedServiceBusNamespacePreparer(name_prefix='servicebustest')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ async def test_mgmt_subscription_async_update_dict_success(self, servicebus_name
finally:
await mgmt_service.delete_subscription(topic_name, subscription_name)
await mgmt_service.delete_topic(topic_name)
yunhaoling marked this conversation as resolved.
Show resolved Hide resolved
await mgmt_service.close()

@CachedResourceGroupPreparer(name_prefix='servicebustest')
@CachedServiceBusNamespacePreparer(name_prefix='servicebustest')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ async def test_async_mgmt_topic_update_success(self, servicebus_namespace_connec

finally:
await mgmt_service.delete_topic(topic_name)
yunhaoling marked this conversation as resolved.
Show resolved Hide resolved
await mgmt_service.close()

@CachedResourceGroupPreparer(name_prefix='servicebustest')
@CachedServiceBusNamespacePreparer(name_prefix='servicebustest')
Expand Down Expand Up @@ -383,6 +384,7 @@ async def test_mgmt_topic_async_update_dict_success(self, servicebus_namespace_c
assert topic_description.support_ordering == False
finally:
await mgmt_service.delete_topic(topic_name)
yunhaoling marked this conversation as resolved.
Show resolved Hide resolved
await mgmt_service.close()

@pytest.mark.liveTest
@CachedResourceGroupPreparer(name_prefix='servicebustest')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ def test_mgmt_queue_update_success(self, servicebus_namespace_connection_string,
finally:
mgmt_service.delete_queue(queue_name)
mgmt_service.delete_topic(topic_name)
mgmt_service.close()

@pytest.mark.liveTest
@CachedResourceGroupPreparer(name_prefix='servicebustest')
Expand Down Expand Up @@ -671,6 +672,7 @@ def test_mgmt_queue_update_dict_success(self, servicebus_namespace_connection_st

finally:
mgmt_service.delete_queue(queue_name)
mgmt_service.close()

@pytest.mark.liveTest
@CachedResourceGroupPreparer(name_prefix='servicebustest')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ def test_mgmt_rule_update_success(self, servicebus_namespace_connection_string,
mgmt_service.delete_rule(topic_name, subscription_name, rule_name)
mgmt_service.delete_subscription(topic_name, subscription_name)
mgmt_service.delete_topic(topic_name)
mgmt_service.close()

@CachedResourceGroupPreparer(name_prefix='servicebustest')
@CachedServiceBusNamespacePreparer(name_prefix='servicebustest')
Expand Down Expand Up @@ -331,6 +332,7 @@ def test_mgmt_rule_update_dict_success(self, servicebus_namespace_connection_str
mgmt_service.delete_rule(topic_name, subscription_name, rule_name)
mgmt_service.delete_subscription(topic_name, subscription_name)
mgmt_service.delete_topic(topic_name)
mgmt_service.close()

@CachedResourceGroupPreparer(name_prefix='servicebustest')
@CachedServiceBusNamespacePreparer(name_prefix='servicebustest')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ def test_mgmt_subscription_update_success(self, servicebus_namespace_connection_
mgmt_service.delete_subscription(topic_name, subscription_name)
mgmt_service.delete_topic(topic_name)
mgmt_service.delete_queue(queue_name)
mgmt_service.close()

@CachedResourceGroupPreparer(name_prefix='servicebustest')
@CachedServiceBusNamespacePreparer(name_prefix='servicebustest')
Expand Down Expand Up @@ -486,6 +487,7 @@ def test_mgmt_subscription_update_dict_success(self, servicebus_namespace_connec
finally:
mgmt_service.delete_subscription(topic_name, subscription_name)
mgmt_service.delete_topic(topic_name)
mgmt_service.close()

@CachedResourceGroupPreparer(name_prefix='servicebustest')
@CachedServiceBusNamespacePreparer(name_prefix='servicebustest')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ def test_mgmt_topic_update_success(self, servicebus_namespace_connection_string,
assert topic_description.support_ordering == False
finally:
mgmt_service.delete_topic(topic_name)
mgmt_service.close()

@CachedResourceGroupPreparer(name_prefix='servicebustest')
@CachedServiceBusNamespacePreparer(name_prefix='servicebustest')
Expand Down Expand Up @@ -387,6 +388,7 @@ def test_mgmt_topic_update_dict_success(self, servicebus_namespace_connection_st

finally:
mgmt_service.delete_topic(topic_name)
mgmt_service.close()

@CachedResourceGroupPreparer(name_prefix='servicebustest')
@CachedServiceBusNamespacePreparer(name_prefix='servicebustest')
Expand Down