Skip to content

Commit

Permalink
[ServiceBus]remove topic parameter object settability (#14116)
Browse files Browse the repository at this point in the history
* Initial conversion to make mgmt operations be name-parameterized-only (instead of objects)

* Make administration client operations take only entity names, not full entity objects, for non-update functions.

Co-authored-by: Adam Ling (MSFT) <[email protected]>
  • Loading branch information
KieranBrantnerMagee and yunhaoling authored Oct 3, 2020
1 parent cf1672b commit 6e5caf2
Show file tree
Hide file tree
Showing 88 changed files with 3,015 additions and 3,125 deletions.
1 change: 1 addition & 0 deletions sdk/servicebus/azure-servicebus/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

**Breaking Changes**
* Passing any type other than `ReceiveMode` as parameter `receive_mode` now throws a `TypeError` instead of `AttributeError`.
* Administration Client calls now take only entity names, not `<Entity>Descriptions` as well to reduce ambiguity in which entity was being acted on. TypeError will now be thrown on improper parameter types (non-string).

## 7.0.0b6 (2020-09-10)

Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -241,3 +241,22 @@ def serialize_rule_key_values(entry_ele, rule_descripiton):
.find(constants.RULE_PARAMETERS_TAG)
if sql_action_parameters_ele:
serialize_key_values(sql_action_parameters_ele, rule_descripiton.action.parameters)


# Helper functions for common parameter validation errors in the client.
def _validate_entity_name_type(entity_name, display_name='entity name'):
# type: (str, str) -> None
if not isinstance(entity_name, str):
raise TypeError("{} must be a string, not {}".format(display_name, type(entity_name)))

def _validate_topic_and_subscription_types(topic_name, subscription_name):
# type: (str, str) -> None
if not isinstance(topic_name, str) or not isinstance(subscription_name, str):
raise TypeError("topic name and subscription name must be strings, not {} and {}".format(
type(topic_name), type(subscription_name)))

def _validate_topic_subscription_and_rule_types(topic_name, subscription_name, rule_name):
# type: (str, str, str) -> None
if not isinstance(topic_name, str) or not isinstance(subscription_name, str) or not isinstance(rule_name, str):
raise TypeError("topic name, subscription name and rule name must be strings, not {} {} and {}".format(
type(topic_name), type(subscription_name), type(rule_name)))
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ async def clear_queues(servicebus_management_client):
queues = await async_pageable_to_list(servicebus_management_client.list_queues())
for queue in queues:
try:
await servicebus_management_client.delete_queue(queue)
await servicebus_management_client.delete_queue(queue.name)
except:
pass

Expand All @@ -143,6 +143,6 @@ async def clear_topics(servicebus_management_client):
topics = await async_pageable_to_list(servicebus_management_client.list_topics())
for topic in topics:
try:
await servicebus_management_client.delete_topic(topic)
await servicebus_management_client.delete_topic(topic.name)
except:
pass
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ interactions:
uri: https://servicebustestsbname.servicebus.windows.net/$Resources/queues?$skip=0&$top=100&api-version=2017-04
response:
body:
string: <feed xmlns="http://www.w3.org/2005/Atom"><title type="text">Queues</title><id>https://servicebustest32ip2wgoaa.servicebus.windows.net/$Resources/queues?$skip=0&amp;$top=100&amp;api-version=2017-04</id><updated>2020-08-17T08:03:22Z</updated><link
rel="self" href="https://servicebustest32ip2wgoaa.servicebus.windows.net/$Resources/queues?$skip=0&amp;$top=100&amp;api-version=2017-04"/></feed>
string: <feed xmlns="http://www.w3.org/2005/Atom"><title type="text">Queues</title><id>https://servicebustestrm7a5oi5hk.servicebus.windows.net/$Resources/queues?$skip=0&amp;$top=100&amp;api-version=2017-04</id><updated>2020-09-29T08:32:21Z</updated><link
rel="self" href="https://servicebustestrm7a5oi5hk.servicebus.windows.net/$Resources/queues?$skip=0&amp;$top=100&amp;api-version=2017-04"/></feed>
headers:
content-type: application/atom+xml;type=feed;charset=utf-8
date: Mon, 17 Aug 2020 08:03:22 GMT
date: Tue, 29 Sep 2020 08:32:20 GMT
server: Microsoft-HTTPAPI/2.0
transfer-encoding: chunked
status:
code: 200
message: OK
url: https://servicebustest32ip2wgoaa.servicebus.windows.net/$Resources/queues?$skip=0&$top=100&api-version=2017-04
url: https://servicebustestrm7a5oi5hk.servicebus.windows.net/$Resources/queues?$skip=0&$top=100&api-version=2017-04
- request:
body: '<?xml version=''1.0'' encoding=''utf-8''?>
Expand All @@ -39,21 +39,21 @@ interactions:
uri: https://servicebustestsbname.servicebus.windows.net/eidk?api-version=2017-04
response:
body:
string: <entry xmlns="http://www.w3.org/2005/Atom"><id>https://servicebustest32ip2wgoaa.servicebus.windows.net/eidk?api-version=2017-04</id><title
type="text">eidk</title><published>2020-08-17T08:03:23Z</published><updated>2020-08-17T08:03:23Z</updated><author><name>servicebustest32ip2wgoaa</name></author><link
rel="self" href="https://servicebustest32ip2wgoaa.servicebus.windows.net/eidk?api-version=2017-04"/><content
string: <entry xmlns="http://www.w3.org/2005/Atom"><id>https://servicebustestrm7a5oi5hk.servicebus.windows.net/eidk?api-version=2017-04</id><title
type="text">eidk</title><published>2020-09-29T08:32:21Z</published><updated>2020-09-29T08:32:21Z</updated><author><name>servicebustestrm7a5oi5hk</name></author><link
rel="self" href="https://servicebustestrm7a5oi5hk.servicebus.windows.net/eidk?api-version=2017-04"/><content
type="application/xml"><QueueDescription xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><LockDuration>PT1M</LockDuration><MaxSizeInMegabytes>1024</MaxSizeInMegabytes><RequiresDuplicateDetection>false</RequiresDuplicateDetection><RequiresSession>false</RequiresSession><DefaultMessageTimeToLive>P10675199DT2H48M5.4775807S</DefaultMessageTimeToLive><DeadLetteringOnMessageExpiration>false</DeadLetteringOnMessageExpiration><DuplicateDetectionHistoryTimeWindow>PT10M</DuplicateDetectionHistoryTimeWindow><MaxDeliveryCount>10</MaxDeliveryCount><EnableBatchedOperations>true</EnableBatchedOperations><SizeInBytes>0</SizeInBytes><MessageCount>0</MessageCount><IsAnonymousAccessible>false</IsAnonymousAccessible><AuthorizationRules></AuthorizationRules><Status>Active</Status><CreatedAt>2020-08-17T08:03:23.383Z</CreatedAt><UpdatedAt>2020-08-17T08:03:23.493Z</UpdatedAt><SupportOrdering>true</SupportOrdering><AutoDeleteOnIdle>P10675199DT2H48M5.4775807S</AutoDeleteOnIdle><EnablePartitioning>false</EnablePartitioning><EntityAvailabilityStatus>Available</EntityAvailabilityStatus><EnableExpress>false</EnableExpress></QueueDescription></content></entry>
xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><LockDuration>PT1M</LockDuration><MaxSizeInMegabytes>1024</MaxSizeInMegabytes><RequiresDuplicateDetection>false</RequiresDuplicateDetection><RequiresSession>false</RequiresSession><DefaultMessageTimeToLive>P10675199DT2H48M5.4775807S</DefaultMessageTimeToLive><DeadLetteringOnMessageExpiration>false</DeadLetteringOnMessageExpiration><DuplicateDetectionHistoryTimeWindow>PT10M</DuplicateDetectionHistoryTimeWindow><MaxDeliveryCount>10</MaxDeliveryCount><EnableBatchedOperations>true</EnableBatchedOperations><SizeInBytes>0</SizeInBytes><MessageCount>0</MessageCount><IsAnonymousAccessible>false</IsAnonymousAccessible><AuthorizationRules></AuthorizationRules><Status>Active</Status><CreatedAt>2020-09-29T08:32:21.71Z</CreatedAt><UpdatedAt>2020-09-29T08:32:21.78Z</UpdatedAt><SupportOrdering>true</SupportOrdering><AutoDeleteOnIdle>P10675199DT2H48M5.4775807S</AutoDeleteOnIdle><EnablePartitioning>false</EnablePartitioning><EntityAvailabilityStatus>Available</EntityAvailabilityStatus><EnableExpress>false</EnableExpress></QueueDescription></content></entry>
headers:
content-type: application/atom+xml;type=entry;charset=utf-8
date: Mon, 17 Aug 2020 08:03:23 GMT
date: Tue, 29 Sep 2020 08:32:21 GMT
server: Microsoft-HTTPAPI/2.0
strict-transport-security: max-age=31536000
transfer-encoding: chunked
status:
code: 201
message: Created
url: https://servicebustest32ip2wgoaa.servicebus.windows.net/eidk?api-version=2017-04
url: https://servicebustestrm7a5oi5hk.servicebus.windows.net/eidk?api-version=2017-04
- request:
body: null
headers:
Expand All @@ -65,23 +65,23 @@ interactions:
uri: https://servicebustestsbname.servicebus.windows.net/eidk?enrich=false&api-version=2017-04
response:
body:
string: <entry xmlns="http://www.w3.org/2005/Atom"><id>https://servicebustest32ip2wgoaa.servicebus.windows.net/eidk?enrich=false&amp;api-version=2017-04</id><title
type="text">eidk</title><published>2020-08-17T08:03:23Z</published><updated>2020-08-17T08:03:23Z</updated><author><name>servicebustest32ip2wgoaa</name></author><link
rel="self" href="https://servicebustest32ip2wgoaa.servicebus.windows.net/eidk?enrich=false&amp;api-version=2017-04"/><content
string: <entry xmlns="http://www.w3.org/2005/Atom"><id>https://servicebustestrm7a5oi5hk.servicebus.windows.net/eidk?enrich=false&amp;api-version=2017-04</id><title
type="text">eidk</title><published>2020-09-29T08:32:21Z</published><updated>2020-09-29T08:32:21Z</updated><author><name>servicebustestrm7a5oi5hk</name></author><link
rel="self" href="https://servicebustestrm7a5oi5hk.servicebus.windows.net/eidk?enrich=false&amp;api-version=2017-04"/><content
type="application/xml"><QueueDescription xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><LockDuration>PT1M</LockDuration><MaxSizeInMegabytes>1024</MaxSizeInMegabytes><RequiresDuplicateDetection>false</RequiresDuplicateDetection><RequiresSession>false</RequiresSession><DefaultMessageTimeToLive>P10675199DT2H48M5.4775807S</DefaultMessageTimeToLive><DeadLetteringOnMessageExpiration>false</DeadLetteringOnMessageExpiration><DuplicateDetectionHistoryTimeWindow>PT10M</DuplicateDetectionHistoryTimeWindow><MaxDeliveryCount>10</MaxDeliveryCount><EnableBatchedOperations>true</EnableBatchedOperations><SizeInBytes>0</SizeInBytes><MessageCount>0</MessageCount><IsAnonymousAccessible>false</IsAnonymousAccessible><AuthorizationRules></AuthorizationRules><Status>Active</Status><CreatedAt>2020-08-17T08:03:23.383Z</CreatedAt><UpdatedAt>2020-08-17T08:03:23.493Z</UpdatedAt><AccessedAt>0001-01-01T00:00:00Z</AccessedAt><SupportOrdering>true</SupportOrdering><CountDetails
xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><LockDuration>PT1M</LockDuration><MaxSizeInMegabytes>1024</MaxSizeInMegabytes><RequiresDuplicateDetection>false</RequiresDuplicateDetection><RequiresSession>false</RequiresSession><DefaultMessageTimeToLive>P10675199DT2H48M5.4775807S</DefaultMessageTimeToLive><DeadLetteringOnMessageExpiration>false</DeadLetteringOnMessageExpiration><DuplicateDetectionHistoryTimeWindow>PT10M</DuplicateDetectionHistoryTimeWindow><MaxDeliveryCount>10</MaxDeliveryCount><EnableBatchedOperations>true</EnableBatchedOperations><SizeInBytes>0</SizeInBytes><MessageCount>0</MessageCount><IsAnonymousAccessible>false</IsAnonymousAccessible><AuthorizationRules></AuthorizationRules><Status>Active</Status><CreatedAt>2020-09-29T08:32:21.71Z</CreatedAt><UpdatedAt>2020-09-29T08:32:21.78Z</UpdatedAt><AccessedAt>0001-01-01T00:00:00Z</AccessedAt><SupportOrdering>true</SupportOrdering><CountDetails
xmlns:d2p1="http://schemas.microsoft.com/netservices/2011/06/servicebus"><d2p1:ActiveMessageCount>0</d2p1:ActiveMessageCount><d2p1:DeadLetterMessageCount>0</d2p1:DeadLetterMessageCount><d2p1:ScheduledMessageCount>0</d2p1:ScheduledMessageCount><d2p1:TransferMessageCount>0</d2p1:TransferMessageCount><d2p1:TransferDeadLetterMessageCount>0</d2p1:TransferDeadLetterMessageCount></CountDetails><AutoDeleteOnIdle>P10675199DT2H48M5.4775807S</AutoDeleteOnIdle><EnablePartitioning>false</EnablePartitioning><EntityAvailabilityStatus>Available</EntityAvailabilityStatus><EnableExpress>false</EnableExpress></QueueDescription></content></entry>
headers:
content-type: application/atom+xml;type=entry;charset=utf-8
date: Mon, 17 Aug 2020 08:03:24 GMT
etag: '637332482034930000'
date: Tue, 29 Sep 2020 08:32:21 GMT
etag: '637369651417800000'
server: Microsoft-HTTPAPI/2.0
strict-transport-security: max-age=31536000
transfer-encoding: chunked
status:
code: 200
message: OK
url: https://servicebustest32ip2wgoaa.servicebus.windows.net/eidk?enrich=false&api-version=2017-04
url: https://servicebustestrm7a5oi5hk.servicebus.windows.net/eidk?enrich=false&api-version=2017-04
- request:
body: null
headers:
Expand All @@ -96,12 +96,12 @@ interactions:
string: ''
headers:
content-length: '0'
date: Mon, 17 Aug 2020 08:03:24 GMT
etag: '637332482034930000'
date: Tue, 29 Sep 2020 08:32:22 GMT
etag: '637369651417800000'
server: Microsoft-HTTPAPI/2.0
strict-transport-security: max-age=31536000
status:
code: 200
message: OK
url: https://servicebustest32ip2wgoaa.servicebus.windows.net/eidk?api-version=2017-04
url: https://servicebustestrm7a5oi5hk.servicebus.windows.net/eidk?api-version=2017-04
version: 1
Loading

0 comments on commit 6e5caf2

Please sign in to comment.