From 80fd92fe683898af0884224d8e0cc9508aef9c8d Mon Sep 17 00:00:00 2001 From: Yijun Xie <48257664+YijunXieMS@users.noreply.github.com> Date: Wed, 8 Jul 2020 16:54:31 -0700 Subject: [PATCH 01/22] Add sql rule and action parameters --- .../azure/servicebus/management/_constants.py | 2 + .../management/_generated/models/_models.py | 141 ++++++++++----- .../_generated/models/_models_py3.py | 165 ++++++++++++------ .../_service_bus_management_client_enums.py | 2 +- .../azure/servicebus/management/_models.py | 42 ++++- 5 files changed, 244 insertions(+), 108 deletions(-) diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_constants.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_constants.py index 8762bd46eca9..16cd35d39df8 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_constants.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_constants.py @@ -16,3 +16,5 @@ LIST_OP_SKIP = "$skip" LIST_OP_TOP = "$top" + +SQL_COMPATIBILITY_LEVEL = "20" diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_generated/models/_models.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_generated/models/_models.py index e3077351e58e..e9a0d4b5c6ac 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_generated/models/_models.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_generated/models/_models.py @@ -13,11 +13,11 @@ class AuthorizationRule(msrest.serialization.Model): """Authorization rule of an entity. - :param type: + :param type: The authorization type. :type type: str - :param claim_type: + :param claim_type: The claim type. :type claim_type: str - :param claim_value: + :param claim_value: The claim value. :type claim_value: str :param rights: Access rights of the entity. Values are 'Send', 'Listen', or 'Manage'. :type rights: list[str] @@ -68,7 +68,7 @@ class RuleFilter(msrest.serialization.Model): """RuleFilter. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: CorrelationFilter, FalseFilter, SqlFilter, TrueFilter. + sub-classes are: CorrelationFilter, SqlFilter. :param type: Constant filled by server. :type type: str @@ -79,7 +79,7 @@ class RuleFilter(msrest.serialization.Model): } _subtype_map = { - 'type': {'CorrelationFilter': 'CorrelationFilter', 'FalseFilter': 'FalseFilter', 'SqlFilter': 'SqlFilter', 'TrueFilter': 'TrueFilter'} + 'type': {'CorrelationFilter': 'CorrelationFilter', 'SqlFilter': 'SqlFilter'} } _xml_map = { 'name': 'Filter', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect' @@ -197,7 +197,7 @@ def __init__( class CreateRuleBody(msrest.serialization.Model): - """The request body for creating a topic. + """The request body for creating a rule. :param content: RuleDescription for the new Rule. :type content: ~azure.servicebus.management._generated.models.CreateRuleBodyContent @@ -245,9 +245,9 @@ def __init__( class CreateSubscriptionBody(msrest.serialization.Model): - """The request body for creating a topic. + """The request body for creating a subscription. - :param content: TopicDescription for the new topic. + :param content: SubscriptionDescription for the new subscription. :type content: ~azure.servicebus.management._generated.models.CreateSubscriptionBodyContent """ @@ -267,11 +267,11 @@ def __init__( class CreateSubscriptionBodyContent(msrest.serialization.Model): - """TopicDescription for the new topic. + """SubscriptionDescription for the new subscription. :param type: MIME type of content. :type type: str - :param subscription_description: Topic information to create. + :param subscription_description: Subscription information to create. :type subscription_description: ~azure.servicebus.management._generated.models.SubscriptionDescription """ @@ -389,18 +389,69 @@ def __init__( self.type = 'EmptyRuleAction' -class FalseFilter(RuleFilter): +class SqlFilter(RuleFilter): + """SqlFilter. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: FalseFilter, TrueFilter. + + :param type: Constant filled by server. + :type type: str + :param sql_expression: + :type sql_expression: str + :param compatibility_level: + :type compatibility_level: str + :param parameters: + :type parameters: list[~azure.servicebus.management._generated.models.KeyValue] + :param requires_preprocessing: + :type requires_preprocessing: bool + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True, 'prefix': 'xsi', 'ns': 'http://www.w3.org/2001/XMLSchema-instance'}}, + 'sql_expression': {'key': 'SqlExpression', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'compatibility_level': {'key': 'CompatibilityLevel', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'parameters': {'key': 'Parameters', 'type': '[KeyValue]', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'KeyValueOfstringanyType', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'requires_preprocessing': {'key': 'RequiresPreprocessing', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + } + + _subtype_map = { + 'type': {'FalseFilter': 'FalseFilter', 'TrueFilter': 'TrueFilter'} + } + + def __init__( + self, + **kwargs + ): + super(SqlFilter, self).__init__(**kwargs) + self.type = 'SqlFilter' + self.sql_expression = kwargs.get('sql_expression', None) + self.compatibility_level = kwargs.get('compatibility_level', "20") + self.parameters = kwargs.get('parameters', None) + self.requires_preprocessing = kwargs.get('requires_preprocessing', None) + + +class FalseFilter(SqlFilter): """FalseFilter. :param type: Constant filled by server. :type type: str :param sql_expression: :type sql_expression: str + :param compatibility_level: + :type compatibility_level: str + :param parameters: + :type parameters: list[~azure.servicebus.management._generated.models.KeyValue] + :param requires_preprocessing: + :type requires_preprocessing: bool """ _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True, 'prefix': 'xsi', 'ns': 'http://www.w3.org/2001/XMLSchema-instance'}}, 'sql_expression': {'key': 'SqlExpression', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'compatibility_level': {'key': 'CompatibilityLevel', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'parameters': {'key': 'Parameters', 'type': '[KeyValue]', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'KeyValueOfstringanyType', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'requires_preprocessing': {'key': 'RequiresPreprocessing', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, } def __init__( @@ -409,11 +460,10 @@ def __init__( ): super(FalseFilter, self).__init__(**kwargs) self.type = 'FalseFilter' - self.sql_expression = kwargs.get('sql_expression', "1 != 1") class KeyValue(msrest.serialization.Model): - """KeyValue. + """Key Values of custom properties. :param key: :type key: str @@ -602,7 +652,7 @@ class QueueDescription(msrest.serialization.Model): :type lock_duration: ~datetime.timedelta :param max_size_in_megabytes: The maximum size of the queue in megabytes, which is the size of memory allocated for the queue. - :type max_size_in_megabytes: int + :type max_size_in_megabytes: long :param requires_duplicate_detection: A value indicating if this queue requires duplicate detection. :type requires_duplicate_detection: bool @@ -646,7 +696,7 @@ class QueueDescription(msrest.serialization.Model): :type user_metadata: str :param created_at: The exact time the queue was created. :type created_at: ~datetime.datetime - :param updated_at: The exact time a message was updated in the queue. + :param updated_at: The exact time the entity description was last updated. :type updated_at: ~datetime.datetime :param accessed_at: Last time a message was sent, or the last time there was a receive request to this queue. @@ -675,7 +725,7 @@ class QueueDescription(msrest.serialization.Model): _attribute_map = { 'lock_duration': {'key': 'LockDuration', 'type': 'duration', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'max_size_in_megabytes': {'key': 'MaxSizeInMegabytes', 'type': 'int', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'max_size_in_megabytes': {'key': 'MaxSizeInMegabytes', 'type': 'long', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, 'requires_duplicate_detection': {'key': 'RequiresDuplicateDetection', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, 'requires_session': {'key': 'RequiresSession', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, 'default_message_time_to_live': {'key': 'DefaultMessageTimeToLive', 'type': 'duration', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, @@ -979,7 +1029,7 @@ def __init__( class RuleDescriptionEntryContent(msrest.serialization.Model): """The RuleDescription. - :param type: Type of content in queue response. + :param type: Type of content in rule response. :type type: str :param rule_description: :type rule_description: ~azure.servicebus.management._generated.models.RuleDescription @@ -1063,29 +1113,6 @@ def __init__( self.detail = kwargs.get('detail', None) -class SqlFilter(RuleFilter): - """SqlFilter. - - :param type: Constant filled by server. - :type type: str - :param sql_expression: - :type sql_expression: str - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True, 'prefix': 'xsi', 'ns': 'http://www.w3.org/2001/XMLSchema-instance'}}, - 'sql_expression': {'key': 'SqlExpression', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - } - - def __init__( - self, - **kwargs - ): - super(SqlFilter, self).__init__(**kwargs) - self.type = 'SqlFilter' - self.sql_expression = kwargs.get('sql_expression', None) - - class SqlRuleAction(RuleAction): """SqlRuleAction. @@ -1093,11 +1120,20 @@ class SqlRuleAction(RuleAction): :type type: str :param sql_expression: :type sql_expression: str + :param compatibility_level: + :type compatibility_level: str + :param parameters: + :type parameters: list[~azure.servicebus.management._generated.models.KeyValue] + :param requires_preprocessing: + :type requires_preprocessing: bool """ _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True, 'prefix': 'xsi', 'ns': 'http://www.w3.org/2001/XMLSchema-instance'}}, 'sql_expression': {'key': 'SqlExpression', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'compatibility_level': {'key': 'CompatibilityLevel', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'parameters': {'key': 'Parameters', 'type': '[KeyValue]', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'KeyValueOfstringanyType', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'requires_preprocessing': {'key': 'RequiresPreprocessing', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, } def __init__( @@ -1107,6 +1143,9 @@ def __init__( super(SqlRuleAction, self).__init__(**kwargs) self.type = 'SqlRuleAction' self.sql_expression = kwargs.get('sql_expression', None) + self.compatibility_level = kwargs.get('compatibility_level', "20") + self.parameters = kwargs.get('parameters', None) + self.requires_preprocessing = kwargs.get('requires_preprocessing', None) class SubscriptionDescription(msrest.serialization.Model): @@ -1116,8 +1155,8 @@ class SubscriptionDescription(msrest.serialization.Model): that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute. :type lock_duration: ~datetime.timedelta - :param requires_session: A value that indicates whether the queue supports the concept of - sessions. + :param requires_session: A value that indicates whether the subscription supports the concept + of sessions. :type requires_session: bool :param default_message_time_to_live: ISO 8601 default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service @@ -1262,7 +1301,7 @@ def __init__( class SubscriptionDescriptionEntryContent(msrest.serialization.Model): """The SubscriptionDescription. - :param type: Type of content in queue response. + :param type: Type of content in subscription response. :type type: str :param subscription_description: Description of a Service Bus subscription resource. :type subscription_description: @@ -1383,7 +1422,7 @@ class TopicDescription(msrest.serialization.Model): subscription is to be partitioned. :type enable_subscription_partitioning: bool :param enable_express: A value that indicates whether Express Entities are enabled. An express - queue holds a message in memory temporarily before writing it to persistent storage. + topic holds a message in memory temporarily before writing it to persistent storage. :type enable_express: bool :param user_metadata: Metadata associated with the topic. :type user_metadata: str @@ -1499,7 +1538,7 @@ def __init__( class TopicDescriptionEntryContent(msrest.serialization.Model): """The TopicDescription. - :param type: Type of content in queue response. + :param type: Type of content in topic response. :type type: str :param topic_description: Description of a Service Bus topic resource. :type topic_description: ~azure.servicebus.management._generated.models.TopicDescription @@ -1560,18 +1599,27 @@ def __init__( self.entry = kwargs.get('entry', None) -class TrueFilter(RuleFilter): +class TrueFilter(SqlFilter): """TrueFilter. :param type: Constant filled by server. :type type: str :param sql_expression: :type sql_expression: str + :param compatibility_level: + :type compatibility_level: str + :param parameters: + :type parameters: list[~azure.servicebus.management._generated.models.KeyValue] + :param requires_preprocessing: + :type requires_preprocessing: bool """ _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True, 'prefix': 'xsi', 'ns': 'http://www.w3.org/2001/XMLSchema-instance'}}, 'sql_expression': {'key': 'SqlExpression', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'compatibility_level': {'key': 'CompatibilityLevel', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'parameters': {'key': 'Parameters', 'type': '[KeyValue]', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'KeyValueOfstringanyType', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'requires_preprocessing': {'key': 'RequiresPreprocessing', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, } def __init__( @@ -1580,4 +1628,3 @@ def __init__( ): super(TrueFilter, self).__init__(**kwargs) self.type = 'TrueFilter' - self.sql_expression = kwargs.get('sql_expression', "1 = 1") diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_generated/models/_models_py3.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_generated/models/_models_py3.py index f2fce56d1769..923e3eeede0a 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_generated/models/_models_py3.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_generated/models/_models_py3.py @@ -18,11 +18,11 @@ class AuthorizationRule(msrest.serialization.Model): """Authorization rule of an entity. - :param type: + :param type: The authorization type. :type type: str - :param claim_type: + :param claim_type: The claim type. :type claim_type: str - :param claim_value: + :param claim_value: The claim value. :type claim_value: str :param rights: Access rights of the entity. Values are 'Send', 'Listen', or 'Manage'. :type rights: list[str] @@ -83,7 +83,7 @@ class RuleFilter(msrest.serialization.Model): """RuleFilter. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: CorrelationFilter, FalseFilter, SqlFilter, TrueFilter. + sub-classes are: CorrelationFilter, SqlFilter. :param type: Constant filled by server. :type type: str @@ -94,7 +94,7 @@ class RuleFilter(msrest.serialization.Model): } _subtype_map = { - 'type': {'CorrelationFilter': 'CorrelationFilter', 'FalseFilter': 'FalseFilter', 'SqlFilter': 'SqlFilter', 'TrueFilter': 'TrueFilter'} + 'type': {'CorrelationFilter': 'CorrelationFilter', 'SqlFilter': 'SqlFilter'} } _xml_map = { 'name': 'Filter', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect' @@ -227,7 +227,7 @@ def __init__( class CreateRuleBody(msrest.serialization.Model): - """The request body for creating a topic. + """The request body for creating a rule. :param content: RuleDescription for the new Rule. :type content: ~azure.servicebus.management._generated.models.CreateRuleBodyContent @@ -280,9 +280,9 @@ def __init__( class CreateSubscriptionBody(msrest.serialization.Model): - """The request body for creating a topic. + """The request body for creating a subscription. - :param content: TopicDescription for the new topic. + :param content: SubscriptionDescription for the new subscription. :type content: ~azure.servicebus.management._generated.models.CreateSubscriptionBodyContent """ @@ -304,11 +304,11 @@ def __init__( class CreateSubscriptionBodyContent(msrest.serialization.Model): - """TopicDescription for the new topic. + """SubscriptionDescription for the new subscription. :param type: MIME type of content. :type type: str - :param subscription_description: Topic information to create. + :param subscription_description: Subscription information to create. :type subscription_description: ~azure.servicebus.management._generated.models.SubscriptionDescription """ @@ -434,33 +434,91 @@ def __init__( self.type: str = 'EmptyRuleAction' -class FalseFilter(RuleFilter): +class SqlFilter(RuleFilter): + """SqlFilter. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: FalseFilter, TrueFilter. + + :param type: Constant filled by server. + :type type: str + :param sql_expression: + :type sql_expression: str + :param compatibility_level: + :type compatibility_level: str + :param parameters: + :type parameters: list[~azure.servicebus.management._generated.models.KeyValue] + :param requires_preprocessing: + :type requires_preprocessing: bool + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True, 'prefix': 'xsi', 'ns': 'http://www.w3.org/2001/XMLSchema-instance'}}, + 'sql_expression': {'key': 'SqlExpression', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'compatibility_level': {'key': 'CompatibilityLevel', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'parameters': {'key': 'Parameters', 'type': '[KeyValue]', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'KeyValueOfstringanyType', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'requires_preprocessing': {'key': 'RequiresPreprocessing', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + } + + _subtype_map = { + 'type': {'FalseFilter': 'FalseFilter', 'TrueFilter': 'TrueFilter'} + } + + def __init__( + self, + *, + sql_expression: Optional[str] = None, + compatibility_level: Optional[str] = "20", + parameters: Optional[List["KeyValue"]] = None, + requires_preprocessing: Optional[bool] = None, + **kwargs + ): + super(SqlFilter, self).__init__(**kwargs) + self.type: str = 'SqlFilter' + self.sql_expression = sql_expression + self.compatibility_level = compatibility_level + self.parameters = parameters + self.requires_preprocessing = requires_preprocessing + + +class FalseFilter(SqlFilter): """FalseFilter. :param type: Constant filled by server. :type type: str :param sql_expression: :type sql_expression: str + :param compatibility_level: + :type compatibility_level: str + :param parameters: + :type parameters: list[~azure.servicebus.management._generated.models.KeyValue] + :param requires_preprocessing: + :type requires_preprocessing: bool """ _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True, 'prefix': 'xsi', 'ns': 'http://www.w3.org/2001/XMLSchema-instance'}}, 'sql_expression': {'key': 'SqlExpression', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'compatibility_level': {'key': 'CompatibilityLevel', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'parameters': {'key': 'Parameters', 'type': '[KeyValue]', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'KeyValueOfstringanyType', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'requires_preprocessing': {'key': 'RequiresPreprocessing', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, } def __init__( self, *, - sql_expression: Optional[str] = "1 != 1", + sql_expression: Optional[str] = None, + compatibility_level: Optional[str] = "20", + parameters: Optional[List["KeyValue"]] = None, + requires_preprocessing: Optional[bool] = None, **kwargs ): - super(FalseFilter, self).__init__(**kwargs) + super(FalseFilter, self).__init__(sql_expression=sql_expression, compatibility_level=compatibility_level, parameters=parameters, requires_preprocessing=requires_preprocessing, **kwargs) self.type: str = 'FalseFilter' - self.sql_expression = sql_expression class KeyValue(msrest.serialization.Model): - """KeyValue. + """Key Values of custom properties. :param key: :type key: str @@ -676,7 +734,7 @@ class QueueDescription(msrest.serialization.Model): :type lock_duration: ~datetime.timedelta :param max_size_in_megabytes: The maximum size of the queue in megabytes, which is the size of memory allocated for the queue. - :type max_size_in_megabytes: int + :type max_size_in_megabytes: long :param requires_duplicate_detection: A value indicating if this queue requires duplicate detection. :type requires_duplicate_detection: bool @@ -720,7 +778,7 @@ class QueueDescription(msrest.serialization.Model): :type user_metadata: str :param created_at: The exact time the queue was created. :type created_at: ~datetime.datetime - :param updated_at: The exact time a message was updated in the queue. + :param updated_at: The exact time the entity description was last updated. :type updated_at: ~datetime.datetime :param accessed_at: Last time a message was sent, or the last time there was a receive request to this queue. @@ -749,7 +807,7 @@ class QueueDescription(msrest.serialization.Model): _attribute_map = { 'lock_duration': {'key': 'LockDuration', 'type': 'duration', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'max_size_in_megabytes': {'key': 'MaxSizeInMegabytes', 'type': 'int', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'max_size_in_megabytes': {'key': 'MaxSizeInMegabytes', 'type': 'long', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, 'requires_duplicate_detection': {'key': 'RequiresDuplicateDetection', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, 'requires_session': {'key': 'RequiresSession', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, 'default_message_time_to_live': {'key': 'DefaultMessageTimeToLive', 'type': 'duration', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, @@ -1115,7 +1173,7 @@ def __init__( class RuleDescriptionEntryContent(msrest.serialization.Model): """The RuleDescription. - :param type: Type of content in queue response. + :param type: Type of content in rule response. :type type: str :param rule_description: :type rule_description: ~azure.servicebus.management._generated.models.RuleDescription @@ -1211,31 +1269,6 @@ def __init__( self.detail = detail -class SqlFilter(RuleFilter): - """SqlFilter. - - :param type: Constant filled by server. - :type type: str - :param sql_expression: - :type sql_expression: str - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True, 'prefix': 'xsi', 'ns': 'http://www.w3.org/2001/XMLSchema-instance'}}, - 'sql_expression': {'key': 'SqlExpression', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - } - - def __init__( - self, - *, - sql_expression: Optional[str] = None, - **kwargs - ): - super(SqlFilter, self).__init__(**kwargs) - self.type: str = 'SqlFilter' - self.sql_expression = sql_expression - - class SqlRuleAction(RuleAction): """SqlRuleAction. @@ -1243,22 +1276,37 @@ class SqlRuleAction(RuleAction): :type type: str :param sql_expression: :type sql_expression: str + :param compatibility_level: + :type compatibility_level: str + :param parameters: + :type parameters: list[~azure.servicebus.management._generated.models.KeyValue] + :param requires_preprocessing: + :type requires_preprocessing: bool """ _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True, 'prefix': 'xsi', 'ns': 'http://www.w3.org/2001/XMLSchema-instance'}}, 'sql_expression': {'key': 'SqlExpression', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'compatibility_level': {'key': 'CompatibilityLevel', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'parameters': {'key': 'Parameters', 'type': '[KeyValue]', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'KeyValueOfstringanyType', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'requires_preprocessing': {'key': 'RequiresPreprocessing', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, } def __init__( self, *, sql_expression: Optional[str] = None, + compatibility_level: Optional[str] = "20", + parameters: Optional[List["KeyValue"]] = None, + requires_preprocessing: Optional[bool] = None, **kwargs ): super(SqlRuleAction, self).__init__(**kwargs) self.type: str = 'SqlRuleAction' self.sql_expression = sql_expression + self.compatibility_level = compatibility_level + self.parameters = parameters + self.requires_preprocessing = requires_preprocessing class SubscriptionDescription(msrest.serialization.Model): @@ -1268,8 +1316,8 @@ class SubscriptionDescription(msrest.serialization.Model): that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute. :type lock_duration: ~datetime.timedelta - :param requires_session: A value that indicates whether the queue supports the concept of - sessions. + :param requires_session: A value that indicates whether the subscription supports the concept + of sessions. :type requires_session: bool :param default_message_time_to_live: ISO 8601 default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service @@ -1440,7 +1488,7 @@ def __init__( class SubscriptionDescriptionEntryContent(msrest.serialization.Model): """The SubscriptionDescription. - :param type: Type of content in queue response. + :param type: Type of content in subscription response. :type type: str :param subscription_description: Description of a Service Bus subscription resource. :type subscription_description: @@ -1570,7 +1618,7 @@ class TopicDescription(msrest.serialization.Model): subscription is to be partitioned. :type enable_subscription_partitioning: bool :param enable_express: A value that indicates whether Express Entities are enabled. An express - queue holds a message in memory temporarily before writing it to persistent storage. + topic holds a message in memory temporarily before writing it to persistent storage. :type enable_express: bool :param user_metadata: Metadata associated with the topic. :type user_metadata: str @@ -1718,7 +1766,7 @@ def __init__( class TopicDescriptionEntryContent(msrest.serialization.Model): """The TopicDescription. - :param type: Type of content in queue response. + :param type: Type of content in topic response. :type type: str :param topic_description: Description of a Service Bus topic resource. :type topic_description: ~azure.servicebus.management._generated.models.TopicDescription @@ -1788,26 +1836,37 @@ def __init__( self.entry = entry -class TrueFilter(RuleFilter): +class TrueFilter(SqlFilter): """TrueFilter. :param type: Constant filled by server. :type type: str :param sql_expression: :type sql_expression: str + :param compatibility_level: + :type compatibility_level: str + :param parameters: + :type parameters: list[~azure.servicebus.management._generated.models.KeyValue] + :param requires_preprocessing: + :type requires_preprocessing: bool """ _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True, 'prefix': 'xsi', 'ns': 'http://www.w3.org/2001/XMLSchema-instance'}}, 'sql_expression': {'key': 'SqlExpression', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'compatibility_level': {'key': 'CompatibilityLevel', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'parameters': {'key': 'Parameters', 'type': '[KeyValue]', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'KeyValueOfstringanyType', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'requires_preprocessing': {'key': 'RequiresPreprocessing', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, } def __init__( self, *, - sql_expression: Optional[str] = "1 = 1", + sql_expression: Optional[str] = None, + compatibility_level: Optional[str] = "20", + parameters: Optional[List["KeyValue"]] = None, + requires_preprocessing: Optional[bool] = None, **kwargs ): - super(TrueFilter, self).__init__(**kwargs) + super(TrueFilter, self).__init__(sql_expression=sql_expression, compatibility_level=compatibility_level, parameters=parameters, requires_preprocessing=requires_preprocessing, **kwargs) self.type: str = 'TrueFilter' - self.sql_expression = sql_expression diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_generated/models/_service_bus_management_client_enums.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_generated/models/_service_bus_management_client_enums.py index faeb59e91e48..e021a09eb502 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_generated/models/_service_bus_management_client_enums.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_generated/models/_service_bus_management_client_enums.py @@ -9,7 +9,7 @@ from enum import Enum class AccessRights(str, Enum): - """Access rights of the entity + """Access rights of an authorization """ manage = "Manage" diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_models.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_models.py index 1f8b8afa6287..830549178456 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_models.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_models.py @@ -19,6 +19,7 @@ KeyValue from ._model_workaround import adjust_attribute_map +from ._constants import SQL_COMPATIBILITY_LEVEL adjust_attribute_map() @@ -652,49 +653,76 @@ def _to_internal_entity(self): class SqlRuleFilter(object): - def __init__(self, sql_expression=None): + def __init__(self, sql_expression=None, parameters=None, requires_preprocessing=None): self.sql_expression = sql_expression + self.parameters = parameters + self.requires_preprocessing = requires_preprocessing @classmethod def _from_internal_entity(cls, internal_sql_rule_filter): sql_rule_filter = cls() sql_rule_filter.sql_expression = internal_sql_rule_filter.sql_expression + sql_rule_filter.parameters = OrderedDict((kv.key, kv.value) for kv in internal_sql_rule_filter.parameters) \ + if internal_sql_rule_filter.parameters else OrderedDict() + sql_rule_filter.requires_preprocessing = internal_sql_rule_filter.requires_preprocessing return sql_rule_filter def _to_internal_entity(self): internal_entity = InternalSqlFilter(sql_expression=self.sql_expression) + internal_entity.parameters = [KeyValue(key=key, value=value) for key, value in self.parameters.items()] \ + if self.parameters else None + internal_entity.compatibility_level = SQL_COMPATIBILITY_LEVEL + internal_entity.requires_preprocessing = self.requires_preprocessing return internal_entity class TrueRuleFilter(SqlRuleFilter): def __init__(self): - super(TrueRuleFilter, self).__init__("1=1") + super(TrueRuleFilter, self).__init__("1=1", None, True) def _to_internal_entity(self): internal_entity = InternalTrueFilter() + internal_entity.sql_expression = self.sql_expression + internal_entity.requires_preprocessing = True + internal_entity.compatibility_level = SQL_COMPATIBILITY_LEVEL + return internal_entity class FalseRuleFilter(SqlRuleFilter): def __init__(self): - super(FalseRuleFilter, self).__init__("1>1") + super(FalseRuleFilter, self).__init__("1>1", None, True) def _to_internal_entity(self): internal_entity = InternalFalseFilter() + internal_entity.sql_expression = self.sql_expression + internal_entity.requires_preprocessing = True + internal_entity.compatibility_level = SQL_COMPATIBILITY_LEVEL return internal_entity class SqlRuleAction(object): - def __init__(self, sql_expression=None): + def __init__(self, sql_expression=None, parameters=None, requires_preprocessing=None): self.sql_expression = sql_expression + self.parameters = parameters + self.requires_preprocessing = requires_preprocessing @classmethod def _from_internal_entity(cls, internal_sql_rule_action): - sql_rule_filter = cls(internal_sql_rule_action.sql_expression) - return sql_rule_filter + sql_rule_action = cls() + sql_rule_action.sql_expression = internal_sql_rule_action.sql_expression + sql_rule_action.parameters = OrderedDict((kv.key, kv.value) for kv in internal_sql_rule_action.parameters) \ + if internal_sql_rule_action.parameters else OrderedDict() + sql_rule_action.requires_preprocessing = internal_sql_rule_action.requires_preprocessing + return sql_rule_action def _to_internal_entity(self): - return InternalSqlRuleAction(sql_expression=self.sql_expression) + internal_entity = InternalSqlRuleAction(sql_expression=self.sql_expression) + internal_entity.parameters = [KeyValue(key=key, value=value) for key, value in self.parameters.items()] \ + if self.parameters else None + internal_entity.compatibility_level = SQL_COMPATIBILITY_LEVEL + internal_entity.requires_preprocessing = self.requires_preprocessing + return internal_entity RULE_CLASS_MAPPING = { From 17c92e6676188319ff781015ff00c152ddc7b3e8 Mon Sep 17 00:00:00 2001 From: Yijun Xie <48257664+YijunXieMS@users.noreply.github.com> Date: Wed, 8 Jul 2020 17:11:24 -0700 Subject: [PATCH 02/22] Update model workaround for sql rule and action parameters --- .../management/_model_workaround.py | 33 ++++++++++++++++--- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_model_workaround.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_model_workaround.py index 238ba907408f..1ca22b040990 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_model_workaround.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_model_workaround.py @@ -75,7 +75,13 @@ CreateRuleBodyContent: ("type", "rule_description"), CreateSubscriptionBodyContent: ("type", "subscription_description"), CreateTopicBodyContent: ("type", "topic_description"), - FalseFilter: ("type", "sql_expression"), + FalseFilter: ( + "type", + "sql_expression", + "compatibility_level", + "parameters", + "requires_preprocessing", + ), KeyValue: ("key", "value"), MessageCountDetails: ( "active_message_count", @@ -141,8 +147,20 @@ RuleDescriptionEntryContent: ("type", "rule_description"), RuleDescriptionFeed: ("id", "title", "updated", "link", "entry"), ServiceBusManagementError: ("code", "detail"), - SqlFilter: ("type", "sql_expression"), - SqlRuleAction: ("type", "sql_expression"), + SqlFilter: ( + "type", + "sql_expression", + "compatibility_level", + "parameters", + "requires_preprocessing", + ), + SqlRuleAction: ( + "type", + "sql_expression", + "compatibility_level", + "parameters", + "requires_preprocessing", + ), SubscriptionDescription: ( "lock_duration", "requires_session", @@ -209,9 +227,14 @@ ), TopicDescriptionEntryContent: ("type", "topic_description"), TopicDescriptionFeed: ("id", "title", "updated", "link", "entry"), - TrueFilter: ("type", "sql_expression"), + TrueFilter: ( + "type", + "sql_expression", + "compatibility_level", + "parameters", + "requires_preprocessing", + ), } # type: Dict[Type[Model], Tuple[str, ...]] - ### End of code generated by the script. From ab9407b3da3d9115acac0248a49774b52f18283c Mon Sep 17 00:00:00 2001 From: Yijun Xie <48257664+YijunXieMS@users.noreply.github.com> Date: Thu, 16 Jul 2020 00:06:17 -0700 Subject: [PATCH 03/22] serialize / deserialize data types of rule filter key values --- .../azure/servicebus/management/_constants.py | 2 + .../management/_management_client.py | 15 ++- .../azure/servicebus/management/_utils.py | 120 +++++++++++++++++- 3 files changed, 130 insertions(+), 7 deletions(-) diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_constants.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_constants.py index 16cd35d39df8..9ee881652a5f 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_constants.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_constants.py @@ -18,3 +18,5 @@ LIST_OP_TOP = "$top" SQL_COMPATIBILITY_LEVEL = "20" + +INT_MAX_VALUE_CSHARP = 2147483647 # C# int max value \ No newline at end of file diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_management_client.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_management_client.py index a90c993b16b3..879b2b24fef5 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_management_client.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_management_client.py @@ -23,7 +23,8 @@ QueueDescription as InternalQueueDescription, TopicDescription as InternalTopicDescription, \ SubscriptionDescription as InternalSubscriptionDescription, RuleDescription as InternalRuleDescription, \ NamespaceProperties -from ._utils import extract_data_template, get_next_template +from ._utils import extract_data_template, get_next_template, deserialize_rule_key_values, serialize_rule_key_values, \ + extract_rule_data_template from ._xml_workaround_policy import ServiceBusXMLWorkaroundPolicy from .._common.constants import JWT_TOKEN_SCOPE @@ -683,6 +684,7 @@ def get_rule(self, topic, subscription, rule_name, **kwargs): "Rule('Topic: {}, Subscription: {}, Rule {}') does not exist".format( subscription_name, topic_name, rule_name)) rule_description = RuleDescription._from_internal_entity(rule_name, entry.content.rule_description) + deserialize_rule_key_values(entry_ele, rule_description) return rule_description def create_rule(self, topic, subscription, rule, **kwargs): @@ -713,6 +715,7 @@ def create_rule(self, topic, subscription, rule, **kwargs): ) ) request_body = create_entity_body.serialize(is_xml=True) + serialize_rule_key_values(request_body, rule) with _handle_response_error(): entry_ele = self._impl.rule.put( topic_name, @@ -721,6 +724,7 @@ def create_rule(self, topic, subscription, rule, **kwargs): request_body, api_version=constants.API_VERSION, **kwargs) entry = RuleDescriptionEntry.deserialize(entry_ele) result = entry.content.rule_description + deserialize_rule_key_values(entry_ele, result) return result def update_rule(self, topic, subscription, rule, **kwargs): @@ -755,6 +759,7 @@ def update_rule(self, topic, subscription, rule, **kwargs): ) ) request_body = create_entity_body.serialize(is_xml=True) + serialize_rule_key_values(request_body, rule) with _handle_response_error(): self._impl.rule.put( topic_name, @@ -809,12 +814,14 @@ def list_rules(self, topic, subscription, **kwargs): except AttributeError: subscription_name = subscription - def entry_to_rule(entry): + def entry_to_rule(ele, entry): rule = entry.content.rule_description - return RuleDescription._from_internal_entity(entry.title, rule) + rule_description = RuleDescription._from_internal_entity(entry.title, rule) + deserialize_rule_key_values(ele, rule_description) + return rule_description extract_data = functools.partial( - extract_data_template, RuleDescriptionFeed, entry_to_rule + extract_rule_data_template, RuleDescriptionFeed, entry_to_rule ) get_next = functools.partial( get_next_template, functools.partial(self._impl.list_rules, topic_name, subscription_name), **kwargs diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py index ead42fe7042f..3987ac9d9b7a 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py @@ -2,8 +2,10 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- +from datetime import datetime, timedelta from typing import cast, Union -from xml.etree.ElementTree import ElementTree +from xml.etree.ElementTree import ElementTree, SubElement, Element, QName +import isodate # Refer to the async version of this module under ..\aio\management\_utils.py for detailed explanation. @@ -16,13 +18,23 @@ from ._handle_response_error import _handle_response_error +def extract_rule_data_template(feed_class, convert, feed_element): + deserialized = feed_class.deserialize(feed_element) + + list_of_entities = [convert(*x) if convert else x for x in zip(feed_element.findall(constants.ENTRY_TAG), deserialized.entry)] + next_link = None + if deserialized.link and len(deserialized.link) == 2: + next_link = deserialized.link[1].href + return next_link, iter(list_of_entities) + + def extract_data_template(feed_class, convert, feed_element): deserialized = feed_class.deserialize(feed_element) - list_of_qd = [convert(x) if convert else x for x in deserialized.entry] + list_of_entities = [convert(x) if convert else x for x in deserialized.entry] next_link = None if deserialized.link and len(deserialized.link) == 2: next_link = deserialized.link[1].href - return next_link, iter(list_of_qd) + return next_link, iter(list_of_entities) def get_next_template(list_func, *args, **kwargs): @@ -44,3 +56,105 @@ def get_next_template(list_func, *args, **kwargs): ) ) return feed_element + + +def deserialize_value(value, value_type): + if value_type in ("int", "long"): + value = int(value) + elif value_type == "boolean": + value = True if value.lower() == "true" else False + elif value_type == "double": + value = float(value) + elif value_type == "datetime": + value = isodate.parse_datetime(value) + elif value == "duration": + value = isodate.parse_duration(value) + return value + + +def serialize_value_type(value): + value_type = type(value) + if value_type == str: + return "string", value + if value_type == int: + return "int" if value <= constants.INT_MAX_VALUE_CSHARP else "long", str(value) + if value_type == float: + return "double", str(value) + if value_type == datetime: + return "datetime", isodate.datetime_isoformat(value) + if value_type == timedelta: + return "duration", isodate.duration_isoformat(value) + raise ValueError("value {} of type {} is wrong for the key value".format(value, value_type)) + + +def deserialize_key_values(root, parameters): + key_values_ele = root.findall("{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}KeyValueOfstringanyType") + for key_value_ele in key_values_ele: + key_ele = key_value_ele.find("{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Key") + value_ele = key_value_ele.find("{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Value") + key = key_ele.text + value = value_ele.text + value_type = value_ele.attrib["{http://www.w3.org/2001/XMLSchema-instance}type"] + value_type = value_type.split(":")[1] + value = deserialize_value(value, value_type) + parameters[key] = value + + +def deserialize_rule_key_values(entry_ele, rule_description): + content = entry_ele.find(constants.CONTENT_TAG) + if content: + correlation_filter_properties_ele = content.find( + "{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}RuleDescription") \ + .find("{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Filter") \ + .find("{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Properties") + if correlation_filter_properties_ele: + deserialize_key_values(correlation_filter_properties_ele, rule_description.filter.properties) + sql_filter_parameters_ele = content.find( + "{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}RuleDescription") \ + .find("{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Filter") \ + .find("{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Parameters") + if sql_filter_parameters_ele: + deserialize_key_values(sql_filter_parameters_ele, rule_description.filter.parameters) + sql_action_parameters_ele = content.find( + "{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}RuleDescription") \ + .find("{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Action") \ + .find("{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Parameters") + if sql_action_parameters_ele: + deserialize_key_values(sql_action_parameters_ele, rule_description.action.parameters) + + +def serialize_key_values(root, kvs): + root.clear() + if kvs: + for key, value in kvs.items(): + value_type, value_in_str = serialize_value_type(value) + key_value_ele = SubElement(root, QName("http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "KeyValueOfstringanyType")) + key_ele = SubElement(key_value_ele, QName("http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "Key")) + key_ele.text = key + type_qname = QName("http://www.w3.org/2001/XMLSchema-instance", "type") + value_ele = SubElement(key_value_ele, QName("http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "Value"), {type_qname: "d6p1:" + value_type}) + value_ele.text = value_in_str + value_ele.attrib["xmlns:d6p1"] = "http://www.w3.org/2001/XMLSchema" + + +def serialize_rule_key_values(entry_ele, rule_descrpiton): + content = entry_ele.find(constants.CONTENT_TAG) + if content: + correlation_filter_parameters_ele = content.find( + "{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}RuleDescription") \ + .find("{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Filter") \ + .find("{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Properties") + if correlation_filter_parameters_ele: + serialize_key_values(correlation_filter_parameters_ele, rule_descrpiton.filter.properties) + sql_filter_parameters_ele = content.find( + "{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}RuleDescription") \ + .find("{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Filter") \ + .find("{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Parameters") + if sql_filter_parameters_ele: + serialize_key_values(sql_filter_parameters_ele, rule_descrpiton.filter.parameters) + sql_action_parameters_ele = content.find( + "{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}RuleDescription") \ + .find("{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Action") \ + .find("{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Parameters") + if sql_action_parameters_ele: + serialize_key_values(sql_action_parameters_ele, rule_descrpiton.action.parameters) From 3c6853a519dc013a4ac6cb750d44af93c2017907 Mon Sep 17 00:00:00 2001 From: Yijun Xie <48257664+YijunXieMS@users.noreply.github.com> Date: Thu, 16 Jul 2020 12:35:37 -0700 Subject: [PATCH 04/22] serialize / deserialize data types of rule filter key values --- .../management/_management_client_async.py | 15 +++- .../azure/servicebus/aio/management/_utils.py | 20 +++++ .../azure/servicebus/management/_constants.py | 30 +++++-- .../azure/servicebus/management/_utils.py | 83 ++++++++++--------- .../management/_xml_workaround_policy.py | 20 ----- 5 files changed, 98 insertions(+), 70 deletions(-) diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_management_client_async.py b/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_management_client_async.py index 490d84d456db..f5b01e5319fb 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_management_client_async.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_management_client_async.py @@ -10,7 +10,6 @@ from datetime import timedelta from azure.core.async_paging import AsyncItemPaged -from azure.servicebus.aio.management._utils import extract_data_template, get_next_template from azure.core.exceptions import ResourceNotFoundError from azure.core.pipeline import AsyncPipeline from azure.core.pipeline.policies import HttpLoggingPolicy, DistributedTracingPolicy, ContentDecodePolicy, \ @@ -39,6 +38,8 @@ from ...management._xml_workaround_policy import ServiceBusXMLWorkaroundPolicy from ...management._handle_response_error import _handle_response_error from ...management._model_workaround import avoid_timedelta_overflow +from ._utils import extract_data_template, extract_rule_data_template, get_next_template +from ...management._utils import deserialize_rule_key_values, serialize_rule_key_values if TYPE_CHECKING: @@ -692,6 +693,7 @@ async def get_rule( "Rule('Topic: {}, Subscription: {}, Rule {}') does not exist".format( subscription_name, topic_name, rule_name)) rule_description = RuleDescription._from_internal_entity(rule_name, entry.content.rule_description) + deserialize_rule_key_values(entry_ele, rule_description) return rule_description async def create_rule( @@ -724,6 +726,7 @@ async def create_rule( ) ) request_body = create_entity_body.serialize(is_xml=True) + serialize_rule_key_values(request_body, rule) with _handle_response_error(): entry_ele = await self._impl.rule.put( topic_name, @@ -732,6 +735,7 @@ async def create_rule( request_body, api_version=constants.API_VERSION, **kwargs) entry = RuleDescriptionEntry.deserialize(entry_ele) result = entry.content.rule_description + deserialize_rule_key_values(entry_ele, result) return result async def update_rule( @@ -767,6 +771,7 @@ async def update_rule( ) ) request_body = create_entity_body.serialize(is_xml=True) + serialize_rule_key_values(request_body, rule) with _handle_response_error(): await self._impl.rule.put( topic_name, @@ -824,12 +829,14 @@ def list_rules( except AttributeError: subscription_name = subscription - def entry_to_rule(entry): + def entry_to_rule(ele, entry): rule = entry.content.rule_description - return RuleDescription._from_internal_entity(entry.title, rule) + rule_description = RuleDescription._from_internal_entity(entry.title, rule) + deserialize_rule_key_values(ele, rule_description) + return rule_description extract_data = functools.partial( - extract_data_template, RuleDescriptionFeed, entry_to_rule + extract_rule_data_template, RuleDescriptionFeed, entry_to_rule ) get_next = functools.partial( get_next_template, functools.partial(self._impl.list_rules, topic_name, subscription_name), **kwargs diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_utils.py b/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_utils.py index 035661df3e2e..771e56cdf9f5 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_utils.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_utils.py @@ -89,6 +89,26 @@ async def extract_data_template(feed_class, convert, feed_element): return next_link, iter(list_of_qd) # when next_page is None, AsyncPagedItem will stop fetch next page data. +async def extract_rule_data_template(feed_class, convert, feed_element): + """Special version of function extrat_data_template for Rule. + + Pass both the XML entry element and the rule instance to function `convert`. Rule needs to extract + KeyValue from XML Element and set to Rule model instance manually. The msrest serialization/deserialization + doesn't work for this special part. + """ + deserialized = feed_class.deserialize(feed_element) + next_link = None + if deserialized.link and len(deserialized.link) == 2: + next_link = deserialized.link[1].href + if deserialized.entry: + list_of_entities = [ + convert(*x) if convert else x for x in zip(feed_element.findall(constants.ENTRY_TAG), deserialized.entry) + ] + else: + list_of_entities = [] + return next_link, iter(list_of_entities) + + async def get_next_template(list_func, *args, start_index=0, max_page_size=100, **kwargs): """Call list_func to get the XML data and deserialize it to XML ElementTree. diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_constants.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_constants.py index 9ee881652a5f..fe22e1025b36 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_constants.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_constants.py @@ -5,18 +5,32 @@ API_VERSION_PARAM_NAME = "api-version" API_VERSION = "2017-04" -ENTRY_TAG = "{http://www.w3.org/2005/Atom}entry" -CONTENT_TAG = "{http://www.w3.org/2005/Atom}content" -QUEUE_DESCRIPTION_TAG = "{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}QueueDescription" -COUNT_DETAILS_TAG = "{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}CountDetails" -TITLE_TAG = "{http://www.w3.org/2005/Atom}title" - ENTITY_TYPE_QUEUES = "queues" ENTITY_TYPE_TOPICS = "topics" - LIST_OP_SKIP = "$skip" LIST_OP_TOP = "$top" +XML_SCHEMA_NAMESPACE = "http://www.w3.org/2001/XMLSchema" +XML_SCHEMA_INSTANCE_NAMESPACE = "http://www.w3.org/2001/XMLSchema-instance" + +SB_XML_NAMESPACE = "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect" +ENTRY_TAG = "{http://www.w3.org/2005/Atom}entry" +CONTENT_TAG = "{http://www.w3.org/2005/Atom}content" + +RULE_KEY_VALUE = "KeyValueOfstringanyType" +RULE_KEY = "Key" +RULE_VALUE = "Value" +RULE_VALUE_TYPE = "type" +RULE_VALUE_TYPE_XML_PREFIX = "d6p1" SQL_COMPATIBILITY_LEVEL = "20" +INT_MAX_VALUE_CSHARP = 2147483647 # C# int max value -INT_MAX_VALUE_CSHARP = 2147483647 # C# int max value \ No newline at end of file +RULE_DESCRIPTION_TAG = "{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}RuleDescription" +RULE_FILTER_TAG = "{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Filter" +RULE_FILTER_COR_PROPERTIES_TAG = "{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Properties" +RULE_PARAMETERS_TAG = "{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Parameters" +RULE_ACTION_TAG = "{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Action" +RULE_KEY_VALUE_TAG = "{{{}}}{}".format(SB_XML_NAMESPACE, RULE_KEY_VALUE) +RULE_KEY_TAG = "{{{}}}{}".format(SB_XML_NAMESPACE, RULE_KEY) +RULE_VALUE_TAG = "{{{}}}{}".format(SB_XML_NAMESPACE, RULE_VALUE) +RULE_VALUE_TYPE_TAG = "{{{}}}{}".format(XML_SCHEMA_INSTANCE_NAMESPACE, RULE_VALUE_TYPE) diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py index 3987ac9d9b7a..ca62a3b0041b 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py @@ -3,8 +3,8 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- from datetime import datetime, timedelta -from typing import cast, Union -from xml.etree.ElementTree import ElementTree, SubElement, Element, QName +from typing import cast +from xml.etree.ElementTree import ElementTree, SubElement, QName import isodate # Refer to the async version of this module under ..\aio\management\_utils.py for detailed explanation. @@ -20,11 +20,15 @@ def extract_rule_data_template(feed_class, convert, feed_element): deserialized = feed_class.deserialize(feed_element) - - list_of_entities = [convert(*x) if convert else x for x in zip(feed_element.findall(constants.ENTRY_TAG), deserialized.entry)] next_link = None if deserialized.link and len(deserialized.link) == 2: next_link = deserialized.link[1].href + if deserialized.entry: + list_of_entities = [ + convert(*x) if convert else x for x in zip(feed_element.findall(constants.ENTRY_TAG), deserialized.entry) + ] + else: + list_of_entities = [] return next_link, iter(list_of_entities) @@ -84,17 +88,17 @@ def serialize_value_type(value): return "datetime", isodate.datetime_isoformat(value) if value_type == timedelta: return "duration", isodate.duration_isoformat(value) - raise ValueError("value {} of type {} is wrong for the key value".format(value, value_type)) + raise ValueError("value {} of type {} is not supported for the key value".format(value, value_type)) def deserialize_key_values(root, parameters): - key_values_ele = root.findall("{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}KeyValueOfstringanyType") + key_values_ele = root.findall(constants.RULE_KEY_VALUE_TAG) for key_value_ele in key_values_ele: - key_ele = key_value_ele.find("{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Key") - value_ele = key_value_ele.find("{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Value") + key_ele = key_value_ele.find(constants.RULE_KEY_TAG) + value_ele = key_value_ele.find(constants.RULE_VALUE_TAG) key = key_ele.text value = value_ele.text - value_type = value_ele.attrib["{http://www.w3.org/2001/XMLSchema-instance}type"] + value_type = value_ele.attrib[constants.RULE_VALUE_TYPE_TAG] value_type = value_type.split(":")[1] value = deserialize_value(value, value_type) parameters[key] = value @@ -103,22 +107,22 @@ def deserialize_key_values(root, parameters): def deserialize_rule_key_values(entry_ele, rule_description): content = entry_ele.find(constants.CONTENT_TAG) if content: - correlation_filter_properties_ele = content.find( - "{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}RuleDescription") \ - .find("{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Filter") \ - .find("{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Properties") + correlation_filter_properties_ele = content\ + .find(constants.RULE_DESCRIPTION_TAG) \ + .find(constants.RULE_FILTER_TAG) \ + .find(constants.RULE_FILTER_COR_PROPERTIES_TAG) if correlation_filter_properties_ele: deserialize_key_values(correlation_filter_properties_ele, rule_description.filter.properties) - sql_filter_parameters_ele = content.find( - "{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}RuleDescription") \ - .find("{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Filter") \ - .find("{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Parameters") + sql_filter_parameters_ele = content\ + .find(constants.RULE_DESCRIPTION_TAG) \ + .find(constants.RULE_FILTER_TAG) \ + .find(constants.RULE_PARAMETERS_TAG) if sql_filter_parameters_ele: deserialize_key_values(sql_filter_parameters_ele, rule_description.filter.parameters) - sql_action_parameters_ele = content.find( - "{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}RuleDescription") \ - .find("{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Action") \ - .find("{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Parameters") + sql_action_parameters_ele = content\ + .find(constants.RULE_DESCRIPTION_TAG) \ + .find(constants.RULE_ACTION_TAG) \ + .find(constants.RULE_PARAMETERS_TAG) if sql_action_parameters_ele: deserialize_key_values(sql_action_parameters_ele, rule_description.action.parameters) @@ -128,33 +132,36 @@ def serialize_key_values(root, kvs): if kvs: for key, value in kvs.items(): value_type, value_in_str = serialize_value_type(value) - key_value_ele = SubElement(root, QName("http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "KeyValueOfstringanyType")) - key_ele = SubElement(key_value_ele, QName("http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "Key")) + key_value_ele = SubElement(root, QName(constants.SB_XML_NAMESPACE, constants.RULE_KEY_VALUE)) + key_ele = SubElement(key_value_ele, QName(constants.SB_XML_NAMESPACE, constants.RULE_KEY)) key_ele.text = key - type_qname = QName("http://www.w3.org/2001/XMLSchema-instance", "type") - value_ele = SubElement(key_value_ele, QName("http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "Value"), {type_qname: "d6p1:" + value_type}) + type_qname = QName(constants.XML_SCHEMA_INSTANCE_NAMESPACE, "type") + value_ele = SubElement( + key_value_ele, QName(constants.SB_XML_NAMESPACE, constants.RULE_VALUE), + {type_qname: constants.RULE_VALUE_TYPE_XML_PREFIX + ":" + value_type} + ) value_ele.text = value_in_str - value_ele.attrib["xmlns:d6p1"] = "http://www.w3.org/2001/XMLSchema" + value_ele.attrib["xmlns:"+constants.RULE_VALUE_TYPE_XML_PREFIX] = constants.XML_SCHEMA_NAMESPACE def serialize_rule_key_values(entry_ele, rule_descrpiton): content = entry_ele.find(constants.CONTENT_TAG) if content: - correlation_filter_parameters_ele = content.find( - "{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}RuleDescription") \ - .find("{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Filter") \ - .find("{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Properties") + correlation_filter_parameters_ele = content\ + .find(constants.RULE_DESCRIPTION_TAG) \ + .find(constants.RULE_FILTER_TAG) \ + .find(constants.RULE_FILTER_COR_PROPERTIES_TAG) if correlation_filter_parameters_ele: serialize_key_values(correlation_filter_parameters_ele, rule_descrpiton.filter.properties) - sql_filter_parameters_ele = content.find( - "{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}RuleDescription") \ - .find("{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Filter") \ - .find("{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Parameters") + sql_filter_parameters_ele = content\ + .find(constants.RULE_DESCRIPTION_TAG) \ + .find(constants.RULE_FILTER_TAG) \ + .find(constants.RULE_PARAMETERS_TAG) if sql_filter_parameters_ele: serialize_key_values(sql_filter_parameters_ele, rule_descrpiton.filter.parameters) - sql_action_parameters_ele = content.find( - "{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}RuleDescription") \ - .find("{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Action") \ - .find("{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Parameters") + sql_action_parameters_ele = content\ + .find(constants.RULE_DESCRIPTION_TAG) \ + .find(constants.RULE_ACTION_TAG) \ + .find(constants.RULE_PARAMETERS_TAG) if sql_action_parameters_ele: serialize_key_values(sql_action_parameters_ele, rule_descrpiton.action.parameters) diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_xml_workaround_policy.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_xml_workaround_policy.py index ed45887e8247..277db51df0eb 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_xml_workaround_policy.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_xml_workaround_policy.py @@ -20,22 +20,6 @@ class ServiceBusXMLWorkaroundPolicy(SansIOHTTPPolicy): 1 ... - - Another problem is Swagger specification doesn't allow an XML tag to have both a value and attributes. - For instance value1 can't be defined in swagger. - So here we add it. - - - 1 - ... - - - key1 - value1 - - - - """ def on_request(self, request): # type: (PipelineRequest) -> None @@ -50,10 +34,6 @@ def on_request(self, request): if b'' in request_body: - request_body = request_body.replace( - b'', - b'') request.http_request.body = request_body request.http_request.data = request_body request.http_request.headers["Content-Length"] = str(len(request_body)) From 9c9cfbfc0180d7470fad2a6675d845dbc3358e56 Mon Sep 17 00:00:00 2001 From: Yijun Xie <48257664+YijunXieMS@users.noreply.github.com> Date: Thu, 16 Jul 2020 12:36:14 -0700 Subject: [PATCH 05/22] re-gen models after swagger description change --- .../management/_generated/models/_models.py | 314 ++++++++++-------- .../_generated/models/_models_py3.py | 314 ++++++++++-------- 2 files changed, 362 insertions(+), 266 deletions(-) diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_generated/models/_models.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_generated/models/_models.py index e9a0d4b5c6ac..bc5a8b1d5438 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_generated/models/_models.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_generated/models/_models.py @@ -35,14 +35,14 @@ class AuthorizationRule(msrest.serialization.Model): _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True, 'prefix': 'i', 'ns': 'http://www.w3.org/2001/XMLSchema-instance'}}, - 'claim_type': {'key': 'ClaimType', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'claim_value': {'key': 'ClaimValue', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'rights': {'key': 'Rights', 'type': '[str]', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'AccessRights', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'created_time': {'key': 'CreatedTime', 'type': 'iso-8601', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'modified_time': {'key': 'ModifiedTime', 'type': 'iso-8601', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'key_name': {'key': 'KeyName', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'primary_key': {'key': 'PrimaryKey', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'secondary_key': {'key': 'SecondaryKey', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'claim_type': {'key': 'claimType', 'type': 'str', 'xml': {'name': 'ClaimType', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'claim_value': {'key': 'claimValue', 'type': 'str', 'xml': {'name': 'ClaimValue', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'rights': {'key': 'rights', 'type': '[str]', 'xml': {'name': 'Rights', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'AccessRights', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'created_time': {'key': 'createdTime', 'type': 'iso-8601', 'xml': {'name': 'CreatedTime', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'modified_time': {'key': 'modifiedTime', 'type': 'iso-8601', 'xml': {'name': 'ModifiedTime', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'key_name': {'key': 'keyName', 'type': 'str', 'xml': {'name': 'KeyName', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'primary_key': {'key': 'primaryKey', 'type': 'str', 'xml': {'name': 'PrimaryKey', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str', 'xml': {'name': 'SecondaryKey', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, } _xml_map = { 'name': 'AuthorizationRule', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect' @@ -70,10 +70,16 @@ class RuleFilter(msrest.serialization.Model): You probably want to use the sub-classes and not this class directly. Known sub-classes are: CorrelationFilter, SqlFilter. - :param type: Constant filled by server. + All required parameters must be populated in order to send to Azure. + + :param type: Required. Constant filled by server. :type type: str """ + _validation = { + 'type': {'required': True}, + } + _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True, 'prefix': 'xsi', 'ns': 'http://www.w3.org/2001/XMLSchema-instance'}}, } @@ -96,7 +102,9 @@ def __init__( class CorrelationFilter(RuleFilter): """CorrelationFilter. - :param type: Constant filled by server. + All required parameters must be populated in order to send to Azure. + + :param type: Required. Constant filled by server. :type type: str :param correlation_id: :type correlation_id: str @@ -118,17 +126,21 @@ class CorrelationFilter(RuleFilter): :type properties: list[~azure.servicebus.management._generated.models.KeyValue] """ + _validation = { + 'type': {'required': True}, + } + _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True, 'prefix': 'xsi', 'ns': 'http://www.w3.org/2001/XMLSchema-instance'}}, - 'correlation_id': {'key': 'CorrelationId', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'message_id': {'key': 'MessageId', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'to': {'key': 'To', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'reply_to': {'key': 'ReplyTo', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'label': {'key': 'Label', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'session_id': {'key': 'SessionId', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'reply_to_session_id': {'key': 'ReplyToSessionId', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'content_type': {'key': 'ContentType', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'properties': {'key': 'Properties', 'type': '[KeyValue]', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'KeyValueOfstringanyType', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'correlation_id': {'key': 'correlationId', 'type': 'str', 'xml': {'name': 'CorrelationId', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'message_id': {'key': 'messageId', 'type': 'str', 'xml': {'name': 'MessageId', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'to': {'key': 'to', 'type': 'str', 'xml': {'name': 'To', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'reply_to': {'key': 'replyTo', 'type': 'str', 'xml': {'name': 'ReplyTo', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'label': {'key': 'label', 'type': 'str', 'xml': {'name': 'Label', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'session_id': {'key': 'sessionId', 'type': 'str', 'xml': {'name': 'SessionId', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'reply_to_session_id': {'key': 'replyToSessionId', 'type': 'str', 'xml': {'name': 'ReplyToSessionId', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'content_type': {'key': 'contentType', 'type': 'str', 'xml': {'name': 'ContentType', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'properties': {'key': 'properties', 'type': '[KeyValue]', 'xml': {'name': 'Properties', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'KeyValueOfstringanyType', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, } def __init__( @@ -181,7 +193,7 @@ class CreateQueueBodyContent(msrest.serialization.Model): _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True}}, - 'queue_description': {'key': 'QueueDescription', 'type': 'QueueDescription'}, + 'queue_description': {'key': 'queueDescription', 'type': 'QueueDescription'}, } _xml_map = { 'ns': 'http://www.w3.org/2005/Atom' @@ -229,7 +241,7 @@ class CreateRuleBodyContent(msrest.serialization.Model): _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True}}, - 'rule_description': {'key': 'RuleDescription', 'type': 'RuleDescription'}, + 'rule_description': {'key': 'ruleDescription', 'type': 'RuleDescription'}, } _xml_map = { 'ns': 'http://www.w3.org/2005/Atom' @@ -278,7 +290,7 @@ class CreateSubscriptionBodyContent(msrest.serialization.Model): _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True}}, - 'subscription_description': {'key': 'SubscriptionDescription', 'type': 'SubscriptionDescription'}, + 'subscription_description': {'key': 'subscriptionDescription', 'type': 'SubscriptionDescription'}, } _xml_map = { 'ns': 'http://www.w3.org/2005/Atom' @@ -326,7 +338,7 @@ class CreateTopicBodyContent(msrest.serialization.Model): _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True}}, - 'topic_description': {'key': 'TopicDescription', 'type': 'TopicDescription'}, + 'topic_description': {'key': 'topicDescription', 'type': 'TopicDescription'}, } _xml_map = { 'ns': 'http://www.w3.org/2005/Atom' @@ -347,10 +359,16 @@ class RuleAction(msrest.serialization.Model): You probably want to use the sub-classes and not this class directly. Known sub-classes are: EmptyRuleAction, SqlRuleAction. - :param type: Constant filled by server. + All required parameters must be populated in order to send to Azure. + + :param type: Required. Constant filled by server. :type type: str """ + _validation = { + 'type': {'required': True}, + } + _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True, 'prefix': 'xsi', 'ns': 'http://www.w3.org/2001/XMLSchema-instance'}}, } @@ -373,10 +391,16 @@ def __init__( class EmptyRuleAction(RuleAction): """EmptyRuleAction. - :param type: Constant filled by server. + All required parameters must be populated in order to send to Azure. + + :param type: Required. Constant filled by server. :type type: str """ + _validation = { + 'type': {'required': True}, + } + _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True, 'prefix': 'xsi', 'ns': 'http://www.w3.org/2001/XMLSchema-instance'}}, } @@ -395,7 +419,9 @@ class SqlFilter(RuleFilter): You probably want to use the sub-classes and not this class directly. Known sub-classes are: FalseFilter, TrueFilter. - :param type: Constant filled by server. + All required parameters must be populated in order to send to Azure. + + :param type: Required. Constant filled by server. :type type: str :param sql_expression: :type sql_expression: str @@ -407,12 +433,16 @@ class SqlFilter(RuleFilter): :type requires_preprocessing: bool """ + _validation = { + 'type': {'required': True}, + } + _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True, 'prefix': 'xsi', 'ns': 'http://www.w3.org/2001/XMLSchema-instance'}}, - 'sql_expression': {'key': 'SqlExpression', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'compatibility_level': {'key': 'CompatibilityLevel', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'parameters': {'key': 'Parameters', 'type': '[KeyValue]', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'KeyValueOfstringanyType', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'requires_preprocessing': {'key': 'RequiresPreprocessing', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'sql_expression': {'key': 'sqlExpression', 'type': 'str', 'xml': {'name': 'SqlExpression', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'str', 'xml': {'name': 'CompatibilityLevel', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'parameters': {'key': 'parameters', 'type': '[KeyValue]', 'xml': {'name': 'Parameters', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'KeyValueOfstringanyType', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool', 'xml': {'name': 'RequiresPreprocessing', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, } _subtype_map = { @@ -434,7 +464,9 @@ def __init__( class FalseFilter(SqlFilter): """FalseFilter. - :param type: Constant filled by server. + All required parameters must be populated in order to send to Azure. + + :param type: Required. Constant filled by server. :type type: str :param sql_expression: :type sql_expression: str @@ -446,12 +478,16 @@ class FalseFilter(SqlFilter): :type requires_preprocessing: bool """ + _validation = { + 'type': {'required': True}, + } + _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True, 'prefix': 'xsi', 'ns': 'http://www.w3.org/2001/XMLSchema-instance'}}, - 'sql_expression': {'key': 'SqlExpression', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'compatibility_level': {'key': 'CompatibilityLevel', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'parameters': {'key': 'Parameters', 'type': '[KeyValue]', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'KeyValueOfstringanyType', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'requires_preprocessing': {'key': 'RequiresPreprocessing', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'sql_expression': {'key': 'sqlExpression', 'type': 'str', 'xml': {'name': 'SqlExpression', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'str', 'xml': {'name': 'CompatibilityLevel', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'parameters': {'key': 'parameters', 'type': '[KeyValue]', 'xml': {'name': 'Parameters', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'KeyValueOfstringanyType', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool', 'xml': {'name': 'RequiresPreprocessing', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, } def __init__( @@ -472,8 +508,8 @@ class KeyValue(msrest.serialization.Model): """ _attribute_map = { - 'key': {'key': 'Key', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'value': {'key': 'Value', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'key': {'key': 'key', 'type': 'str', 'xml': {'name': 'Key', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'value': {'key': 'value', 'type': 'str', 'xml': {'name': 'Value', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, } _xml_map = { 'name': 'KeyValueOfstringanyType', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect' @@ -505,11 +541,11 @@ class MessageCountDetails(msrest.serialization.Model): """ _attribute_map = { - 'active_message_count': {'key': 'ActiveMessageCount', 'type': 'int', 'xml': {'prefix': 'd2p1', 'ns': 'http://schemas.microsoft.com/netservices/2011/06/servicebus'}}, - 'dead_letter_message_count': {'key': 'DeadLetterMessageCount', 'type': 'int', 'xml': {'prefix': 'd2p1', 'ns': 'http://schemas.microsoft.com/netservices/2011/06/servicebus'}}, - 'scheduled_message_count': {'key': 'ScheduledMessageCount', 'type': 'int', 'xml': {'prefix': 'd2p1', 'ns': 'http://schemas.microsoft.com/netservices/2011/06/servicebus'}}, - 'transfer_dead_letter_message_count': {'key': 'TransferDeadLetterMessageCount', 'type': 'int', 'xml': {'prefix': 'd2p1', 'ns': 'http://schemas.microsoft.com/netservices/2011/06/servicebus'}}, - 'transfer_message_count': {'key': 'TransferMessageCount', 'type': 'int', 'xml': {'prefix': 'd2p1', 'ns': 'http://schemas.microsoft.com/netservices/2011/06/servicebus'}}, + 'active_message_count': {'key': 'activeMessageCount', 'type': 'int', 'xml': {'name': 'ActiveMessageCount', 'prefix': 'd2p1', 'ns': 'http://schemas.microsoft.com/netservices/2011/06/servicebus'}}, + 'dead_letter_message_count': {'key': 'deadLetterMessageCount', 'type': 'int', 'xml': {'name': 'DeadLetterMessageCount', 'prefix': 'd2p1', 'ns': 'http://schemas.microsoft.com/netservices/2011/06/servicebus'}}, + 'scheduled_message_count': {'key': 'scheduledMessageCount', 'type': 'int', 'xml': {'name': 'ScheduledMessageCount', 'prefix': 'd2p1', 'ns': 'http://schemas.microsoft.com/netservices/2011/06/servicebus'}}, + 'transfer_dead_letter_message_count': {'key': 'transferDeadLetterMessageCount', 'type': 'int', 'xml': {'name': 'TransferDeadLetterMessageCount', 'prefix': 'd2p1', 'ns': 'http://schemas.microsoft.com/netservices/2011/06/servicebus'}}, + 'transfer_message_count': {'key': 'transferMessageCount', 'type': 'int', 'xml': {'name': 'TransferMessageCount', 'prefix': 'd2p1', 'ns': 'http://schemas.microsoft.com/netservices/2011/06/servicebus'}}, } _xml_map = { 'name': 'CountDetails', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect' @@ -549,13 +585,13 @@ class NamespaceProperties(msrest.serialization.Model): """ _attribute_map = { - 'alias': {'key': 'Alias', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'created_time': {'key': 'CreatedTime', 'type': 'iso-8601', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'messaging_sku': {'key': 'MessagingSku', 'type': 'str', 'xml': {'name': 'MessagingSKU', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'messaging_units': {'key': 'MessagingUnits', 'type': 'int', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'modified_time': {'key': 'ModifiedTime', 'type': 'iso-8601', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'name': {'key': 'Name', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'namespace_type': {'key': 'NamespaceType', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'alias': {'key': 'alias', 'type': 'str', 'xml': {'name': 'Alias', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'created_time': {'key': 'createdTime', 'type': 'iso-8601', 'xml': {'name': 'CreatedTime', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'messaging_sku': {'key': 'messagingSku', 'type': 'str', 'xml': {'name': 'MessagingSKU', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'messaging_units': {'key': 'messagingUnits', 'type': 'int', 'xml': {'name': 'MessagingUnits', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'modified_time': {'key': 'modifiedTime', 'type': 'iso-8601', 'xml': {'name': 'ModifiedTime', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'name': {'key': 'name', 'type': 'str', 'xml': {'name': 'Name', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'namespace_type': {'key': 'namespaceType', 'type': 'str', 'xml': {'name': 'NamespaceType', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, } _xml_map = { 'name': 'NamespaceInfo', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect' @@ -724,32 +760,32 @@ class QueueDescription(msrest.serialization.Model): """ _attribute_map = { - 'lock_duration': {'key': 'LockDuration', 'type': 'duration', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'max_size_in_megabytes': {'key': 'MaxSizeInMegabytes', 'type': 'long', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'requires_duplicate_detection': {'key': 'RequiresDuplicateDetection', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'requires_session': {'key': 'RequiresSession', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'default_message_time_to_live': {'key': 'DefaultMessageTimeToLive', 'type': 'duration', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'dead_lettering_on_message_expiration': {'key': 'DeadLetteringOnMessageExpiration', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'duplicate_detection_history_time_window': {'key': 'DuplicateDetectionHistoryTimeWindow', 'type': 'duration', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'max_delivery_count': {'key': 'MaxDeliveryCount', 'type': 'int', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'enable_batched_operations': {'key': 'EnableBatchedOperations', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'size_in_bytes': {'key': 'SizeInBytes', 'type': 'int', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'message_count': {'key': 'MessageCount', 'type': 'int', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'is_anonymous_accessible': {'key': 'IsAnonymousAccessible', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'authorization_rules': {'key': 'AuthorizationRules', 'type': '[AuthorizationRule]', 'xml': {'name': 'AuthorizationRules', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'AuthorizationRule', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'status': {'key': 'Status', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'forward_to': {'key': 'ForwardTo', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'user_metadata': {'key': 'UserMetadata', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'created_at': {'key': 'CreatedAt', 'type': 'iso-8601', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'updated_at': {'key': 'UpdatedAt', 'type': 'iso-8601', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'accessed_at': {'key': 'AccessedAt', 'type': 'iso-8601', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'support_ordering': {'key': 'SupportOrdering', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'message_count_details': {'key': 'MessageCountDetails', 'type': 'MessageCountDetails'}, - 'auto_delete_on_idle': {'key': 'AutoDeleteOnIdle', 'type': 'duration', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'enable_partitioning': {'key': 'EnablePartitioning', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'entity_availability_status': {'key': 'EntityAvailabilityStatus', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'enable_express': {'key': 'EnableExpress', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'forward_dead_lettered_messages_to': {'key': 'ForwardDeadLetteredMessagesTo', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'lock_duration': {'key': 'lockDuration', 'type': 'duration', 'xml': {'name': 'LockDuration', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'max_size_in_megabytes': {'key': 'maxSizeInMegabytes', 'type': 'long', 'xml': {'name': 'MaxSizeInMegabytes', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'requires_duplicate_detection': {'key': 'requiresDuplicateDetection', 'type': 'bool', 'xml': {'name': 'RequiresDuplicateDetection', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'requires_session': {'key': 'requiresSession', 'type': 'bool', 'xml': {'name': 'RequiresSession', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'default_message_time_to_live': {'key': 'defaultMessageTimeToLive', 'type': 'duration', 'xml': {'name': 'DefaultMessageTimeToLive', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'dead_lettering_on_message_expiration': {'key': 'deadLetteringOnMessageExpiration', 'type': 'bool', 'xml': {'name': 'DeadLetteringOnMessageExpiration', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'duplicate_detection_history_time_window': {'key': 'duplicateDetectionHistoryTimeWindow', 'type': 'duration', 'xml': {'name': 'DuplicateDetectionHistoryTimeWindow', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'max_delivery_count': {'key': 'maxDeliveryCount', 'type': 'int', 'xml': {'name': 'MaxDeliveryCount', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'enable_batched_operations': {'key': 'enableBatchedOperations', 'type': 'bool', 'xml': {'name': 'EnableBatchedOperations', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'size_in_bytes': {'key': 'sizeInBytes', 'type': 'int', 'xml': {'name': 'SizeInBytes', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'message_count': {'key': 'messageCount', 'type': 'int', 'xml': {'name': 'MessageCount', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'is_anonymous_accessible': {'key': 'isAnonymousAccessible', 'type': 'bool', 'xml': {'name': 'IsAnonymousAccessible', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'authorization_rules': {'key': 'authorizationRules', 'type': '[AuthorizationRule]', 'xml': {'name': 'AuthorizationRules', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'AuthorizationRule', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'status': {'key': 'status', 'type': 'str', 'xml': {'name': 'Status', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'forward_to': {'key': 'forwardTo', 'type': 'str', 'xml': {'name': 'ForwardTo', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'user_metadata': {'key': 'userMetadata', 'type': 'str', 'xml': {'name': 'UserMetadata', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601', 'xml': {'name': 'CreatedAt', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'updated_at': {'key': 'updatedAt', 'type': 'iso-8601', 'xml': {'name': 'UpdatedAt', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'accessed_at': {'key': 'accessedAt', 'type': 'iso-8601', 'xml': {'name': 'AccessedAt', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'support_ordering': {'key': 'supportOrdering', 'type': 'bool', 'xml': {'name': 'SupportOrdering', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'message_count_details': {'key': 'messageCountDetails', 'type': 'MessageCountDetails'}, + 'auto_delete_on_idle': {'key': 'autoDeleteOnIdle', 'type': 'duration', 'xml': {'name': 'AutoDeleteOnIdle', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'enable_partitioning': {'key': 'enablePartitioning', 'type': 'bool', 'xml': {'name': 'EnablePartitioning', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'entity_availability_status': {'key': 'entityAvailabilityStatus', 'type': 'str', 'xml': {'name': 'EntityAvailabilityStatus', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'enable_express': {'key': 'enableExpress', 'type': 'bool', 'xml': {'name': 'EnableExpress', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'forward_dead_lettered_messages_to': {'key': 'forwardDeadLetteredMessagesTo', 'type': 'str', 'xml': {'name': 'ForwardDeadLetteredMessagesTo', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, } _xml_map = { 'name': 'QueueDescription', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect' @@ -913,7 +949,7 @@ class ResponseAuthor(msrest.serialization.Model): 'name': {'key': 'name', 'type': 'str', 'xml': {'ns': 'http://www.w3.org/2005/Atom'}}, } _xml_map = { - 'ns': 'http://www.w3.org/2005/Atom' + 'name': 'author', 'ns': 'http://www.w3.org/2005/Atom' } def __init__( @@ -964,13 +1000,13 @@ class RuleDescription(msrest.serialization.Model): """ _attribute_map = { - 'filter': {'key': 'Filter', 'type': 'RuleFilter'}, - 'action': {'key': 'Action', 'type': 'RuleAction'}, - 'created_at': {'key': 'CreatedAt', 'type': 'iso-8601', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'name': {'key': 'Name', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'filter': {'key': 'filter', 'type': 'RuleFilter'}, + 'action': {'key': 'action', 'type': 'RuleAction'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601', 'xml': {'name': 'CreatedAt', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'name': {'key': 'name', 'type': 'str', 'xml': {'name': 'Name', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, } _xml_map = { - 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect' + 'name': 'RuleDescription', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect' } def __init__( @@ -1100,8 +1136,8 @@ class ServiceBusManagementError(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'Code', 'type': 'int'}, - 'detail': {'key': 'Detail', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'int', 'xml': {'name': 'Code'}}, + 'detail': {'key': 'detail', 'type': 'str', 'xml': {'name': 'Detail'}}, } def __init__( @@ -1116,7 +1152,9 @@ def __init__( class SqlRuleAction(RuleAction): """SqlRuleAction. - :param type: Constant filled by server. + All required parameters must be populated in order to send to Azure. + + :param type: Required. Constant filled by server. :type type: str :param sql_expression: :type sql_expression: str @@ -1128,12 +1166,16 @@ class SqlRuleAction(RuleAction): :type requires_preprocessing: bool """ + _validation = { + 'type': {'required': True}, + } + _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True, 'prefix': 'xsi', 'ns': 'http://www.w3.org/2001/XMLSchema-instance'}}, - 'sql_expression': {'key': 'SqlExpression', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'compatibility_level': {'key': 'CompatibilityLevel', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'parameters': {'key': 'Parameters', 'type': '[KeyValue]', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'KeyValueOfstringanyType', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'requires_preprocessing': {'key': 'RequiresPreprocessing', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'sql_expression': {'key': 'sqlExpression', 'type': 'str', 'xml': {'name': 'SqlExpression', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'str', 'xml': {'name': 'CompatibilityLevel', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'parameters': {'key': 'parameters', 'type': '[KeyValue]', 'xml': {'name': 'Parameters', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'KeyValueOfstringanyType', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool', 'xml': {'name': 'RequiresPreprocessing', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, } def __init__( @@ -1207,24 +1249,24 @@ class SubscriptionDescription(msrest.serialization.Model): """ _attribute_map = { - 'lock_duration': {'key': 'LockDuration', 'type': 'duration', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'requires_session': {'key': 'RequiresSession', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'default_message_time_to_live': {'key': 'DefaultMessageTimeToLive', 'type': 'duration', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'dead_lettering_on_message_expiration': {'key': 'DeadLetteringOnMessageExpiration', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'dead_lettering_on_filter_evaluation_exceptions': {'key': 'DeadLetteringOnFilterEvaluationExceptions', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'message_count': {'key': 'MessageCount', 'type': 'int', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'max_delivery_count': {'key': 'MaxDeliveryCount', 'type': 'int', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'enable_batched_operations': {'key': 'EnableBatchedOperations', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'status': {'key': 'Status', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'forward_to': {'key': 'ForwardTo', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'created_at': {'key': 'CreatedAt', 'type': 'iso-8601', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'updated_at': {'key': 'UpdatedAt', 'type': 'iso-8601', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'accessed_at': {'key': 'AccessedAt', 'type': 'iso-8601', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'message_count_details': {'key': 'MessageCountDetails', 'type': 'MessageCountDetails'}, - 'user_metadata': {'key': 'UserMetadata', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'forward_dead_lettered_messages_to': {'key': 'ForwardDeadLetteredMessagesTo', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'auto_delete_on_idle': {'key': 'AutoDeleteOnIdle', 'type': 'duration', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'entity_availability_status': {'key': 'EntityAvailabilityStatus', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'lock_duration': {'key': 'lockDuration', 'type': 'duration', 'xml': {'name': 'LockDuration', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'requires_session': {'key': 'requiresSession', 'type': 'bool', 'xml': {'name': 'RequiresSession', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'default_message_time_to_live': {'key': 'defaultMessageTimeToLive', 'type': 'duration', 'xml': {'name': 'DefaultMessageTimeToLive', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'dead_lettering_on_message_expiration': {'key': 'deadLetteringOnMessageExpiration', 'type': 'bool', 'xml': {'name': 'DeadLetteringOnMessageExpiration', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'dead_lettering_on_filter_evaluation_exceptions': {'key': 'deadLetteringOnFilterEvaluationExceptions', 'type': 'bool', 'xml': {'name': 'DeadLetteringOnFilterEvaluationExceptions', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'message_count': {'key': 'messageCount', 'type': 'int', 'xml': {'name': 'MessageCount', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'max_delivery_count': {'key': 'maxDeliveryCount', 'type': 'int', 'xml': {'name': 'MaxDeliveryCount', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'enable_batched_operations': {'key': 'enableBatchedOperations', 'type': 'bool', 'xml': {'name': 'EnableBatchedOperations', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'status': {'key': 'status', 'type': 'str', 'xml': {'name': 'Status', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'forward_to': {'key': 'forwardTo', 'type': 'str', 'xml': {'name': 'ForwardTo', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601', 'xml': {'name': 'CreatedAt', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'updated_at': {'key': 'updatedAt', 'type': 'iso-8601', 'xml': {'name': 'UpdatedAt', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'accessed_at': {'key': 'accessedAt', 'type': 'iso-8601', 'xml': {'name': 'AccessedAt', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'message_count_details': {'key': 'messageCountDetails', 'type': 'MessageCountDetails'}, + 'user_metadata': {'key': 'userMetadata', 'type': 'str', 'xml': {'name': 'UserMetadata', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'forward_dead_lettered_messages_to': {'key': 'forwardDeadLetteredMessagesTo', 'type': 'str', 'xml': {'name': 'ForwardDeadLetteredMessagesTo', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'auto_delete_on_idle': {'key': 'autoDeleteOnIdle', 'type': 'duration', 'xml': {'name': 'AutoDeleteOnIdle', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'entity_availability_status': {'key': 'entityAvailabilityStatus', 'type': 'str', 'xml': {'name': 'EntityAvailabilityStatus', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, } _xml_map = { 'name': 'SubscriptionDescription', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect' @@ -1429,28 +1471,28 @@ class TopicDescription(msrest.serialization.Model): """ _attribute_map = { - 'default_message_time_to_live': {'key': 'DefaultMessageTimeToLive', 'type': 'duration', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'max_size_in_megabytes': {'key': 'MaxSizeInMegabytes', 'type': 'long', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'requires_duplicate_detection': {'key': 'RequiresDuplicateDetection', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'duplicate_detection_history_time_window': {'key': 'DuplicateDetectionHistoryTimeWindow', 'type': 'duration', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'enable_batched_operations': {'key': 'EnableBatchedOperations', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'size_in_bytes': {'key': 'SizeInBytes', 'type': 'int', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'filtering_messages_before_publishing': {'key': 'FilteringMessagesBeforePublishing', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'is_anonymous_accessible': {'key': 'IsAnonymousAccessible', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'authorization_rules': {'key': 'AuthorizationRules', 'type': '[AuthorizationRule]', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'AuthorizationRule', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'status': {'key': 'Status', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'created_at': {'key': 'CreatedAt', 'type': 'iso-8601', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'updated_at': {'key': 'UpdatedAt', 'type': 'iso-8601', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'accessed_at': {'key': 'AccessedAt', 'type': 'iso-8601', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'support_ordering': {'key': 'SupportOrdering', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'message_count_details': {'key': 'MessageCountDetails', 'type': 'MessageCountDetails'}, - 'subscription_count': {'key': 'SubscriptionCount', 'type': 'int', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'auto_delete_on_idle': {'key': 'AutoDeleteOnIdle', 'type': 'duration', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'enable_partitioning': {'key': 'EnablePartitioning', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'entity_availability_status': {'key': 'EntityAvailabilityStatus', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'enable_subscription_partitioning': {'key': 'EnableSubscriptionPartitioning', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'enable_express': {'key': 'EnableExpress', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'user_metadata': {'key': 'UserMetadata', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'default_message_time_to_live': {'key': 'defaultMessageTimeToLive', 'type': 'duration', 'xml': {'name': 'DefaultMessageTimeToLive', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'max_size_in_megabytes': {'key': 'maxSizeInMegabytes', 'type': 'long', 'xml': {'name': 'MaxSizeInMegabytes', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'requires_duplicate_detection': {'key': 'requiresDuplicateDetection', 'type': 'bool', 'xml': {'name': 'RequiresDuplicateDetection', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'duplicate_detection_history_time_window': {'key': 'duplicateDetectionHistoryTimeWindow', 'type': 'duration', 'xml': {'name': 'DuplicateDetectionHistoryTimeWindow', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'enable_batched_operations': {'key': 'enableBatchedOperations', 'type': 'bool', 'xml': {'name': 'EnableBatchedOperations', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'size_in_bytes': {'key': 'sizeInBytes', 'type': 'int', 'xml': {'name': 'SizeInBytes', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'filtering_messages_before_publishing': {'key': 'filteringMessagesBeforePublishing', 'type': 'bool', 'xml': {'name': 'FilteringMessagesBeforePublishing', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'is_anonymous_accessible': {'key': 'isAnonymousAccessible', 'type': 'bool', 'xml': {'name': 'IsAnonymousAccessible', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'authorization_rules': {'key': 'authorizationRules', 'type': '[AuthorizationRule]', 'xml': {'name': 'AuthorizationRules', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'AuthorizationRule', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'status': {'key': 'status', 'type': 'str', 'xml': {'name': 'Status', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601', 'xml': {'name': 'CreatedAt', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'updated_at': {'key': 'updatedAt', 'type': 'iso-8601', 'xml': {'name': 'UpdatedAt', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'accessed_at': {'key': 'accessedAt', 'type': 'iso-8601', 'xml': {'name': 'AccessedAt', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'support_ordering': {'key': 'supportOrdering', 'type': 'bool', 'xml': {'name': 'SupportOrdering', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'message_count_details': {'key': 'messageCountDetails', 'type': 'MessageCountDetails'}, + 'subscription_count': {'key': 'subscriptionCount', 'type': 'int', 'xml': {'name': 'SubscriptionCount', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'auto_delete_on_idle': {'key': 'autoDeleteOnIdle', 'type': 'duration', 'xml': {'name': 'AutoDeleteOnIdle', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'enable_partitioning': {'key': 'enablePartitioning', 'type': 'bool', 'xml': {'name': 'EnablePartitioning', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'entity_availability_status': {'key': 'entityAvailabilityStatus', 'type': 'str', 'xml': {'name': 'EntityAvailabilityStatus', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'enable_subscription_partitioning': {'key': 'enableSubscriptionPartitioning', 'type': 'bool', 'xml': {'name': 'EnableSubscriptionPartitioning', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'enable_express': {'key': 'enableExpress', 'type': 'bool', 'xml': {'name': 'EnableExpress', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'user_metadata': {'key': 'userMetadata', 'type': 'str', 'xml': {'name': 'UserMetadata', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, } _xml_map = { 'name': 'TopicDescription', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect' @@ -1602,7 +1644,9 @@ def __init__( class TrueFilter(SqlFilter): """TrueFilter. - :param type: Constant filled by server. + All required parameters must be populated in order to send to Azure. + + :param type: Required. Constant filled by server. :type type: str :param sql_expression: :type sql_expression: str @@ -1614,12 +1658,16 @@ class TrueFilter(SqlFilter): :type requires_preprocessing: bool """ + _validation = { + 'type': {'required': True}, + } + _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True, 'prefix': 'xsi', 'ns': 'http://www.w3.org/2001/XMLSchema-instance'}}, - 'sql_expression': {'key': 'SqlExpression', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'compatibility_level': {'key': 'CompatibilityLevel', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'parameters': {'key': 'Parameters', 'type': '[KeyValue]', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'KeyValueOfstringanyType', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'requires_preprocessing': {'key': 'RequiresPreprocessing', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'sql_expression': {'key': 'sqlExpression', 'type': 'str', 'xml': {'name': 'SqlExpression', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'str', 'xml': {'name': 'CompatibilityLevel', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'parameters': {'key': 'parameters', 'type': '[KeyValue]', 'xml': {'name': 'Parameters', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'KeyValueOfstringanyType', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool', 'xml': {'name': 'RequiresPreprocessing', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, } def __init__( diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_generated/models/_models_py3.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_generated/models/_models_py3.py index 923e3eeede0a..656f86cc8284 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_generated/models/_models_py3.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_generated/models/_models_py3.py @@ -40,14 +40,14 @@ class AuthorizationRule(msrest.serialization.Model): _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True, 'prefix': 'i', 'ns': 'http://www.w3.org/2001/XMLSchema-instance'}}, - 'claim_type': {'key': 'ClaimType', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'claim_value': {'key': 'ClaimValue', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'rights': {'key': 'Rights', 'type': '[str]', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'AccessRights', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'created_time': {'key': 'CreatedTime', 'type': 'iso-8601', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'modified_time': {'key': 'ModifiedTime', 'type': 'iso-8601', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'key_name': {'key': 'KeyName', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'primary_key': {'key': 'PrimaryKey', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'secondary_key': {'key': 'SecondaryKey', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'claim_type': {'key': 'claimType', 'type': 'str', 'xml': {'name': 'ClaimType', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'claim_value': {'key': 'claimValue', 'type': 'str', 'xml': {'name': 'ClaimValue', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'rights': {'key': 'rights', 'type': '[str]', 'xml': {'name': 'Rights', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'AccessRights', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'created_time': {'key': 'createdTime', 'type': 'iso-8601', 'xml': {'name': 'CreatedTime', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'modified_time': {'key': 'modifiedTime', 'type': 'iso-8601', 'xml': {'name': 'ModifiedTime', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'key_name': {'key': 'keyName', 'type': 'str', 'xml': {'name': 'KeyName', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'primary_key': {'key': 'primaryKey', 'type': 'str', 'xml': {'name': 'PrimaryKey', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str', 'xml': {'name': 'SecondaryKey', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, } _xml_map = { 'name': 'AuthorizationRule', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect' @@ -85,10 +85,16 @@ class RuleFilter(msrest.serialization.Model): You probably want to use the sub-classes and not this class directly. Known sub-classes are: CorrelationFilter, SqlFilter. - :param type: Constant filled by server. + All required parameters must be populated in order to send to Azure. + + :param type: Required. Constant filled by server. :type type: str """ + _validation = { + 'type': {'required': True}, + } + _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True, 'prefix': 'xsi', 'ns': 'http://www.w3.org/2001/XMLSchema-instance'}}, } @@ -111,7 +117,9 @@ def __init__( class CorrelationFilter(RuleFilter): """CorrelationFilter. - :param type: Constant filled by server. + All required parameters must be populated in order to send to Azure. + + :param type: Required. Constant filled by server. :type type: str :param correlation_id: :type correlation_id: str @@ -133,17 +141,21 @@ class CorrelationFilter(RuleFilter): :type properties: list[~azure.servicebus.management._generated.models.KeyValue] """ + _validation = { + 'type': {'required': True}, + } + _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True, 'prefix': 'xsi', 'ns': 'http://www.w3.org/2001/XMLSchema-instance'}}, - 'correlation_id': {'key': 'CorrelationId', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'message_id': {'key': 'MessageId', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'to': {'key': 'To', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'reply_to': {'key': 'ReplyTo', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'label': {'key': 'Label', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'session_id': {'key': 'SessionId', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'reply_to_session_id': {'key': 'ReplyToSessionId', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'content_type': {'key': 'ContentType', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'properties': {'key': 'Properties', 'type': '[KeyValue]', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'KeyValueOfstringanyType', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'correlation_id': {'key': 'correlationId', 'type': 'str', 'xml': {'name': 'CorrelationId', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'message_id': {'key': 'messageId', 'type': 'str', 'xml': {'name': 'MessageId', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'to': {'key': 'to', 'type': 'str', 'xml': {'name': 'To', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'reply_to': {'key': 'replyTo', 'type': 'str', 'xml': {'name': 'ReplyTo', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'label': {'key': 'label', 'type': 'str', 'xml': {'name': 'Label', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'session_id': {'key': 'sessionId', 'type': 'str', 'xml': {'name': 'SessionId', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'reply_to_session_id': {'key': 'replyToSessionId', 'type': 'str', 'xml': {'name': 'ReplyToSessionId', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'content_type': {'key': 'contentType', 'type': 'str', 'xml': {'name': 'ContentType', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'properties': {'key': 'properties', 'type': '[KeyValue]', 'xml': {'name': 'Properties', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'KeyValueOfstringanyType', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, } def __init__( @@ -208,7 +220,7 @@ class CreateQueueBodyContent(msrest.serialization.Model): _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True}}, - 'queue_description': {'key': 'QueueDescription', 'type': 'QueueDescription'}, + 'queue_description': {'key': 'queueDescription', 'type': 'QueueDescription'}, } _xml_map = { 'ns': 'http://www.w3.org/2005/Atom' @@ -261,7 +273,7 @@ class CreateRuleBodyContent(msrest.serialization.Model): _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True}}, - 'rule_description': {'key': 'RuleDescription', 'type': 'RuleDescription'}, + 'rule_description': {'key': 'ruleDescription', 'type': 'RuleDescription'}, } _xml_map = { 'ns': 'http://www.w3.org/2005/Atom' @@ -315,7 +327,7 @@ class CreateSubscriptionBodyContent(msrest.serialization.Model): _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True}}, - 'subscription_description': {'key': 'SubscriptionDescription', 'type': 'SubscriptionDescription'}, + 'subscription_description': {'key': 'subscriptionDescription', 'type': 'SubscriptionDescription'}, } _xml_map = { 'ns': 'http://www.w3.org/2005/Atom' @@ -368,7 +380,7 @@ class CreateTopicBodyContent(msrest.serialization.Model): _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True}}, - 'topic_description': {'key': 'TopicDescription', 'type': 'TopicDescription'}, + 'topic_description': {'key': 'topicDescription', 'type': 'TopicDescription'}, } _xml_map = { 'ns': 'http://www.w3.org/2005/Atom' @@ -392,10 +404,16 @@ class RuleAction(msrest.serialization.Model): You probably want to use the sub-classes and not this class directly. Known sub-classes are: EmptyRuleAction, SqlRuleAction. - :param type: Constant filled by server. + All required parameters must be populated in order to send to Azure. + + :param type: Required. Constant filled by server. :type type: str """ + _validation = { + 'type': {'required': True}, + } + _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True, 'prefix': 'xsi', 'ns': 'http://www.w3.org/2001/XMLSchema-instance'}}, } @@ -418,10 +436,16 @@ def __init__( class EmptyRuleAction(RuleAction): """EmptyRuleAction. - :param type: Constant filled by server. + All required parameters must be populated in order to send to Azure. + + :param type: Required. Constant filled by server. :type type: str """ + _validation = { + 'type': {'required': True}, + } + _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True, 'prefix': 'xsi', 'ns': 'http://www.w3.org/2001/XMLSchema-instance'}}, } @@ -440,7 +464,9 @@ class SqlFilter(RuleFilter): You probably want to use the sub-classes and not this class directly. Known sub-classes are: FalseFilter, TrueFilter. - :param type: Constant filled by server. + All required parameters must be populated in order to send to Azure. + + :param type: Required. Constant filled by server. :type type: str :param sql_expression: :type sql_expression: str @@ -452,12 +478,16 @@ class SqlFilter(RuleFilter): :type requires_preprocessing: bool """ + _validation = { + 'type': {'required': True}, + } + _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True, 'prefix': 'xsi', 'ns': 'http://www.w3.org/2001/XMLSchema-instance'}}, - 'sql_expression': {'key': 'SqlExpression', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'compatibility_level': {'key': 'CompatibilityLevel', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'parameters': {'key': 'Parameters', 'type': '[KeyValue]', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'KeyValueOfstringanyType', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'requires_preprocessing': {'key': 'RequiresPreprocessing', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'sql_expression': {'key': 'sqlExpression', 'type': 'str', 'xml': {'name': 'SqlExpression', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'str', 'xml': {'name': 'CompatibilityLevel', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'parameters': {'key': 'parameters', 'type': '[KeyValue]', 'xml': {'name': 'Parameters', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'KeyValueOfstringanyType', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool', 'xml': {'name': 'RequiresPreprocessing', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, } _subtype_map = { @@ -484,7 +514,9 @@ def __init__( class FalseFilter(SqlFilter): """FalseFilter. - :param type: Constant filled by server. + All required parameters must be populated in order to send to Azure. + + :param type: Required. Constant filled by server. :type type: str :param sql_expression: :type sql_expression: str @@ -496,12 +528,16 @@ class FalseFilter(SqlFilter): :type requires_preprocessing: bool """ + _validation = { + 'type': {'required': True}, + } + _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True, 'prefix': 'xsi', 'ns': 'http://www.w3.org/2001/XMLSchema-instance'}}, - 'sql_expression': {'key': 'SqlExpression', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'compatibility_level': {'key': 'CompatibilityLevel', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'parameters': {'key': 'Parameters', 'type': '[KeyValue]', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'KeyValueOfstringanyType', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'requires_preprocessing': {'key': 'RequiresPreprocessing', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'sql_expression': {'key': 'sqlExpression', 'type': 'str', 'xml': {'name': 'SqlExpression', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'str', 'xml': {'name': 'CompatibilityLevel', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'parameters': {'key': 'parameters', 'type': '[KeyValue]', 'xml': {'name': 'Parameters', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'KeyValueOfstringanyType', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool', 'xml': {'name': 'RequiresPreprocessing', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, } def __init__( @@ -527,8 +563,8 @@ class KeyValue(msrest.serialization.Model): """ _attribute_map = { - 'key': {'key': 'Key', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'value': {'key': 'Value', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'key': {'key': 'key', 'type': 'str', 'xml': {'name': 'Key', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'value': {'key': 'value', 'type': 'str', 'xml': {'name': 'Value', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, } _xml_map = { 'name': 'KeyValueOfstringanyType', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect' @@ -563,11 +599,11 @@ class MessageCountDetails(msrest.serialization.Model): """ _attribute_map = { - 'active_message_count': {'key': 'ActiveMessageCount', 'type': 'int', 'xml': {'prefix': 'd2p1', 'ns': 'http://schemas.microsoft.com/netservices/2011/06/servicebus'}}, - 'dead_letter_message_count': {'key': 'DeadLetterMessageCount', 'type': 'int', 'xml': {'prefix': 'd2p1', 'ns': 'http://schemas.microsoft.com/netservices/2011/06/servicebus'}}, - 'scheduled_message_count': {'key': 'ScheduledMessageCount', 'type': 'int', 'xml': {'prefix': 'd2p1', 'ns': 'http://schemas.microsoft.com/netservices/2011/06/servicebus'}}, - 'transfer_dead_letter_message_count': {'key': 'TransferDeadLetterMessageCount', 'type': 'int', 'xml': {'prefix': 'd2p1', 'ns': 'http://schemas.microsoft.com/netservices/2011/06/servicebus'}}, - 'transfer_message_count': {'key': 'TransferMessageCount', 'type': 'int', 'xml': {'prefix': 'd2p1', 'ns': 'http://schemas.microsoft.com/netservices/2011/06/servicebus'}}, + 'active_message_count': {'key': 'activeMessageCount', 'type': 'int', 'xml': {'name': 'ActiveMessageCount', 'prefix': 'd2p1', 'ns': 'http://schemas.microsoft.com/netservices/2011/06/servicebus'}}, + 'dead_letter_message_count': {'key': 'deadLetterMessageCount', 'type': 'int', 'xml': {'name': 'DeadLetterMessageCount', 'prefix': 'd2p1', 'ns': 'http://schemas.microsoft.com/netservices/2011/06/servicebus'}}, + 'scheduled_message_count': {'key': 'scheduledMessageCount', 'type': 'int', 'xml': {'name': 'ScheduledMessageCount', 'prefix': 'd2p1', 'ns': 'http://schemas.microsoft.com/netservices/2011/06/servicebus'}}, + 'transfer_dead_letter_message_count': {'key': 'transferDeadLetterMessageCount', 'type': 'int', 'xml': {'name': 'TransferDeadLetterMessageCount', 'prefix': 'd2p1', 'ns': 'http://schemas.microsoft.com/netservices/2011/06/servicebus'}}, + 'transfer_message_count': {'key': 'transferMessageCount', 'type': 'int', 'xml': {'name': 'TransferMessageCount', 'prefix': 'd2p1', 'ns': 'http://schemas.microsoft.com/netservices/2011/06/servicebus'}}, } _xml_map = { 'name': 'CountDetails', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect' @@ -613,13 +649,13 @@ class NamespaceProperties(msrest.serialization.Model): """ _attribute_map = { - 'alias': {'key': 'Alias', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'created_time': {'key': 'CreatedTime', 'type': 'iso-8601', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'messaging_sku': {'key': 'MessagingSku', 'type': 'str', 'xml': {'name': 'MessagingSKU', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'messaging_units': {'key': 'MessagingUnits', 'type': 'int', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'modified_time': {'key': 'ModifiedTime', 'type': 'iso-8601', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'name': {'key': 'Name', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'namespace_type': {'key': 'NamespaceType', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'alias': {'key': 'alias', 'type': 'str', 'xml': {'name': 'Alias', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'created_time': {'key': 'createdTime', 'type': 'iso-8601', 'xml': {'name': 'CreatedTime', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'messaging_sku': {'key': 'messagingSku', 'type': 'str', 'xml': {'name': 'MessagingSKU', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'messaging_units': {'key': 'messagingUnits', 'type': 'int', 'xml': {'name': 'MessagingUnits', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'modified_time': {'key': 'modifiedTime', 'type': 'iso-8601', 'xml': {'name': 'ModifiedTime', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'name': {'key': 'name', 'type': 'str', 'xml': {'name': 'Name', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'namespace_type': {'key': 'namespaceType', 'type': 'str', 'xml': {'name': 'NamespaceType', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, } _xml_map = { 'name': 'NamespaceInfo', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect' @@ -806,32 +842,32 @@ class QueueDescription(msrest.serialization.Model): """ _attribute_map = { - 'lock_duration': {'key': 'LockDuration', 'type': 'duration', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'max_size_in_megabytes': {'key': 'MaxSizeInMegabytes', 'type': 'long', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'requires_duplicate_detection': {'key': 'RequiresDuplicateDetection', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'requires_session': {'key': 'RequiresSession', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'default_message_time_to_live': {'key': 'DefaultMessageTimeToLive', 'type': 'duration', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'dead_lettering_on_message_expiration': {'key': 'DeadLetteringOnMessageExpiration', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'duplicate_detection_history_time_window': {'key': 'DuplicateDetectionHistoryTimeWindow', 'type': 'duration', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'max_delivery_count': {'key': 'MaxDeliveryCount', 'type': 'int', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'enable_batched_operations': {'key': 'EnableBatchedOperations', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'size_in_bytes': {'key': 'SizeInBytes', 'type': 'int', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'message_count': {'key': 'MessageCount', 'type': 'int', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'is_anonymous_accessible': {'key': 'IsAnonymousAccessible', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'authorization_rules': {'key': 'AuthorizationRules', 'type': '[AuthorizationRule]', 'xml': {'name': 'AuthorizationRules', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'AuthorizationRule', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'status': {'key': 'Status', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'forward_to': {'key': 'ForwardTo', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'user_metadata': {'key': 'UserMetadata', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'created_at': {'key': 'CreatedAt', 'type': 'iso-8601', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'updated_at': {'key': 'UpdatedAt', 'type': 'iso-8601', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'accessed_at': {'key': 'AccessedAt', 'type': 'iso-8601', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'support_ordering': {'key': 'SupportOrdering', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'message_count_details': {'key': 'MessageCountDetails', 'type': 'MessageCountDetails'}, - 'auto_delete_on_idle': {'key': 'AutoDeleteOnIdle', 'type': 'duration', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'enable_partitioning': {'key': 'EnablePartitioning', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'entity_availability_status': {'key': 'EntityAvailabilityStatus', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'enable_express': {'key': 'EnableExpress', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'forward_dead_lettered_messages_to': {'key': 'ForwardDeadLetteredMessagesTo', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'lock_duration': {'key': 'lockDuration', 'type': 'duration', 'xml': {'name': 'LockDuration', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'max_size_in_megabytes': {'key': 'maxSizeInMegabytes', 'type': 'long', 'xml': {'name': 'MaxSizeInMegabytes', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'requires_duplicate_detection': {'key': 'requiresDuplicateDetection', 'type': 'bool', 'xml': {'name': 'RequiresDuplicateDetection', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'requires_session': {'key': 'requiresSession', 'type': 'bool', 'xml': {'name': 'RequiresSession', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'default_message_time_to_live': {'key': 'defaultMessageTimeToLive', 'type': 'duration', 'xml': {'name': 'DefaultMessageTimeToLive', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'dead_lettering_on_message_expiration': {'key': 'deadLetteringOnMessageExpiration', 'type': 'bool', 'xml': {'name': 'DeadLetteringOnMessageExpiration', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'duplicate_detection_history_time_window': {'key': 'duplicateDetectionHistoryTimeWindow', 'type': 'duration', 'xml': {'name': 'DuplicateDetectionHistoryTimeWindow', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'max_delivery_count': {'key': 'maxDeliveryCount', 'type': 'int', 'xml': {'name': 'MaxDeliveryCount', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'enable_batched_operations': {'key': 'enableBatchedOperations', 'type': 'bool', 'xml': {'name': 'EnableBatchedOperations', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'size_in_bytes': {'key': 'sizeInBytes', 'type': 'int', 'xml': {'name': 'SizeInBytes', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'message_count': {'key': 'messageCount', 'type': 'int', 'xml': {'name': 'MessageCount', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'is_anonymous_accessible': {'key': 'isAnonymousAccessible', 'type': 'bool', 'xml': {'name': 'IsAnonymousAccessible', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'authorization_rules': {'key': 'authorizationRules', 'type': '[AuthorizationRule]', 'xml': {'name': 'AuthorizationRules', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'AuthorizationRule', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'status': {'key': 'status', 'type': 'str', 'xml': {'name': 'Status', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'forward_to': {'key': 'forwardTo', 'type': 'str', 'xml': {'name': 'ForwardTo', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'user_metadata': {'key': 'userMetadata', 'type': 'str', 'xml': {'name': 'UserMetadata', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601', 'xml': {'name': 'CreatedAt', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'updated_at': {'key': 'updatedAt', 'type': 'iso-8601', 'xml': {'name': 'UpdatedAt', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'accessed_at': {'key': 'accessedAt', 'type': 'iso-8601', 'xml': {'name': 'AccessedAt', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'support_ordering': {'key': 'supportOrdering', 'type': 'bool', 'xml': {'name': 'SupportOrdering', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'message_count_details': {'key': 'messageCountDetails', 'type': 'MessageCountDetails'}, + 'auto_delete_on_idle': {'key': 'autoDeleteOnIdle', 'type': 'duration', 'xml': {'name': 'AutoDeleteOnIdle', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'enable_partitioning': {'key': 'enablePartitioning', 'type': 'bool', 'xml': {'name': 'EnablePartitioning', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'entity_availability_status': {'key': 'entityAvailabilityStatus', 'type': 'str', 'xml': {'name': 'EntityAvailabilityStatus', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'enable_express': {'key': 'enableExpress', 'type': 'bool', 'xml': {'name': 'EnableExpress', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'forward_dead_lettered_messages_to': {'key': 'forwardDeadLetteredMessagesTo', 'type': 'str', 'xml': {'name': 'ForwardDeadLetteredMessagesTo', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, } _xml_map = { 'name': 'QueueDescription', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect' @@ -1040,7 +1076,7 @@ class ResponseAuthor(msrest.serialization.Model): 'name': {'key': 'name', 'type': 'str', 'xml': {'ns': 'http://www.w3.org/2005/Atom'}}, } _xml_map = { - 'ns': 'http://www.w3.org/2005/Atom' + 'name': 'author', 'ns': 'http://www.w3.org/2005/Atom' } def __init__( @@ -1096,13 +1132,13 @@ class RuleDescription(msrest.serialization.Model): """ _attribute_map = { - 'filter': {'key': 'Filter', 'type': 'RuleFilter'}, - 'action': {'key': 'Action', 'type': 'RuleAction'}, - 'created_at': {'key': 'CreatedAt', 'type': 'iso-8601', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'name': {'key': 'Name', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'filter': {'key': 'filter', 'type': 'RuleFilter'}, + 'action': {'key': 'action', 'type': 'RuleAction'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601', 'xml': {'name': 'CreatedAt', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'name': {'key': 'name', 'type': 'str', 'xml': {'name': 'Name', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, } _xml_map = { - 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect' + 'name': 'RuleDescription', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect' } def __init__( @@ -1253,8 +1289,8 @@ class ServiceBusManagementError(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'Code', 'type': 'int'}, - 'detail': {'key': 'Detail', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'int', 'xml': {'name': 'Code'}}, + 'detail': {'key': 'detail', 'type': 'str', 'xml': {'name': 'Detail'}}, } def __init__( @@ -1272,7 +1308,9 @@ def __init__( class SqlRuleAction(RuleAction): """SqlRuleAction. - :param type: Constant filled by server. + All required parameters must be populated in order to send to Azure. + + :param type: Required. Constant filled by server. :type type: str :param sql_expression: :type sql_expression: str @@ -1284,12 +1322,16 @@ class SqlRuleAction(RuleAction): :type requires_preprocessing: bool """ + _validation = { + 'type': {'required': True}, + } + _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True, 'prefix': 'xsi', 'ns': 'http://www.w3.org/2001/XMLSchema-instance'}}, - 'sql_expression': {'key': 'SqlExpression', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'compatibility_level': {'key': 'CompatibilityLevel', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'parameters': {'key': 'Parameters', 'type': '[KeyValue]', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'KeyValueOfstringanyType', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'requires_preprocessing': {'key': 'RequiresPreprocessing', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'sql_expression': {'key': 'sqlExpression', 'type': 'str', 'xml': {'name': 'SqlExpression', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'str', 'xml': {'name': 'CompatibilityLevel', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'parameters': {'key': 'parameters', 'type': '[KeyValue]', 'xml': {'name': 'Parameters', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'KeyValueOfstringanyType', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool', 'xml': {'name': 'RequiresPreprocessing', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, } def __init__( @@ -1368,24 +1410,24 @@ class SubscriptionDescription(msrest.serialization.Model): """ _attribute_map = { - 'lock_duration': {'key': 'LockDuration', 'type': 'duration', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'requires_session': {'key': 'RequiresSession', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'default_message_time_to_live': {'key': 'DefaultMessageTimeToLive', 'type': 'duration', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'dead_lettering_on_message_expiration': {'key': 'DeadLetteringOnMessageExpiration', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'dead_lettering_on_filter_evaluation_exceptions': {'key': 'DeadLetteringOnFilterEvaluationExceptions', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'message_count': {'key': 'MessageCount', 'type': 'int', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'max_delivery_count': {'key': 'MaxDeliveryCount', 'type': 'int', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'enable_batched_operations': {'key': 'EnableBatchedOperations', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'status': {'key': 'Status', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'forward_to': {'key': 'ForwardTo', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'created_at': {'key': 'CreatedAt', 'type': 'iso-8601', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'updated_at': {'key': 'UpdatedAt', 'type': 'iso-8601', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'accessed_at': {'key': 'AccessedAt', 'type': 'iso-8601', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'message_count_details': {'key': 'MessageCountDetails', 'type': 'MessageCountDetails'}, - 'user_metadata': {'key': 'UserMetadata', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'forward_dead_lettered_messages_to': {'key': 'ForwardDeadLetteredMessagesTo', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'auto_delete_on_idle': {'key': 'AutoDeleteOnIdle', 'type': 'duration', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'entity_availability_status': {'key': 'EntityAvailabilityStatus', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'lock_duration': {'key': 'lockDuration', 'type': 'duration', 'xml': {'name': 'LockDuration', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'requires_session': {'key': 'requiresSession', 'type': 'bool', 'xml': {'name': 'RequiresSession', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'default_message_time_to_live': {'key': 'defaultMessageTimeToLive', 'type': 'duration', 'xml': {'name': 'DefaultMessageTimeToLive', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'dead_lettering_on_message_expiration': {'key': 'deadLetteringOnMessageExpiration', 'type': 'bool', 'xml': {'name': 'DeadLetteringOnMessageExpiration', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'dead_lettering_on_filter_evaluation_exceptions': {'key': 'deadLetteringOnFilterEvaluationExceptions', 'type': 'bool', 'xml': {'name': 'DeadLetteringOnFilterEvaluationExceptions', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'message_count': {'key': 'messageCount', 'type': 'int', 'xml': {'name': 'MessageCount', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'max_delivery_count': {'key': 'maxDeliveryCount', 'type': 'int', 'xml': {'name': 'MaxDeliveryCount', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'enable_batched_operations': {'key': 'enableBatchedOperations', 'type': 'bool', 'xml': {'name': 'EnableBatchedOperations', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'status': {'key': 'status', 'type': 'str', 'xml': {'name': 'Status', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'forward_to': {'key': 'forwardTo', 'type': 'str', 'xml': {'name': 'ForwardTo', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601', 'xml': {'name': 'CreatedAt', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'updated_at': {'key': 'updatedAt', 'type': 'iso-8601', 'xml': {'name': 'UpdatedAt', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'accessed_at': {'key': 'accessedAt', 'type': 'iso-8601', 'xml': {'name': 'AccessedAt', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'message_count_details': {'key': 'messageCountDetails', 'type': 'MessageCountDetails'}, + 'user_metadata': {'key': 'userMetadata', 'type': 'str', 'xml': {'name': 'UserMetadata', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'forward_dead_lettered_messages_to': {'key': 'forwardDeadLetteredMessagesTo', 'type': 'str', 'xml': {'name': 'ForwardDeadLetteredMessagesTo', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'auto_delete_on_idle': {'key': 'autoDeleteOnIdle', 'type': 'duration', 'xml': {'name': 'AutoDeleteOnIdle', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'entity_availability_status': {'key': 'entityAvailabilityStatus', 'type': 'str', 'xml': {'name': 'EntityAvailabilityStatus', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, } _xml_map = { 'name': 'SubscriptionDescription', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect' @@ -1625,28 +1667,28 @@ class TopicDescription(msrest.serialization.Model): """ _attribute_map = { - 'default_message_time_to_live': {'key': 'DefaultMessageTimeToLive', 'type': 'duration', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'max_size_in_megabytes': {'key': 'MaxSizeInMegabytes', 'type': 'long', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'requires_duplicate_detection': {'key': 'RequiresDuplicateDetection', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'duplicate_detection_history_time_window': {'key': 'DuplicateDetectionHistoryTimeWindow', 'type': 'duration', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'enable_batched_operations': {'key': 'EnableBatchedOperations', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'size_in_bytes': {'key': 'SizeInBytes', 'type': 'int', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'filtering_messages_before_publishing': {'key': 'FilteringMessagesBeforePublishing', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'is_anonymous_accessible': {'key': 'IsAnonymousAccessible', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'authorization_rules': {'key': 'AuthorizationRules', 'type': '[AuthorizationRule]', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'AuthorizationRule', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'status': {'key': 'Status', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'created_at': {'key': 'CreatedAt', 'type': 'iso-8601', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'updated_at': {'key': 'UpdatedAt', 'type': 'iso-8601', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'accessed_at': {'key': 'AccessedAt', 'type': 'iso-8601', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'support_ordering': {'key': 'SupportOrdering', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'message_count_details': {'key': 'MessageCountDetails', 'type': 'MessageCountDetails'}, - 'subscription_count': {'key': 'SubscriptionCount', 'type': 'int', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'auto_delete_on_idle': {'key': 'AutoDeleteOnIdle', 'type': 'duration', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'enable_partitioning': {'key': 'EnablePartitioning', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'entity_availability_status': {'key': 'EntityAvailabilityStatus', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'enable_subscription_partitioning': {'key': 'EnableSubscriptionPartitioning', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'enable_express': {'key': 'EnableExpress', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'user_metadata': {'key': 'UserMetadata', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'default_message_time_to_live': {'key': 'defaultMessageTimeToLive', 'type': 'duration', 'xml': {'name': 'DefaultMessageTimeToLive', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'max_size_in_megabytes': {'key': 'maxSizeInMegabytes', 'type': 'long', 'xml': {'name': 'MaxSizeInMegabytes', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'requires_duplicate_detection': {'key': 'requiresDuplicateDetection', 'type': 'bool', 'xml': {'name': 'RequiresDuplicateDetection', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'duplicate_detection_history_time_window': {'key': 'duplicateDetectionHistoryTimeWindow', 'type': 'duration', 'xml': {'name': 'DuplicateDetectionHistoryTimeWindow', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'enable_batched_operations': {'key': 'enableBatchedOperations', 'type': 'bool', 'xml': {'name': 'EnableBatchedOperations', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'size_in_bytes': {'key': 'sizeInBytes', 'type': 'int', 'xml': {'name': 'SizeInBytes', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'filtering_messages_before_publishing': {'key': 'filteringMessagesBeforePublishing', 'type': 'bool', 'xml': {'name': 'FilteringMessagesBeforePublishing', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'is_anonymous_accessible': {'key': 'isAnonymousAccessible', 'type': 'bool', 'xml': {'name': 'IsAnonymousAccessible', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'authorization_rules': {'key': 'authorizationRules', 'type': '[AuthorizationRule]', 'xml': {'name': 'AuthorizationRules', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'AuthorizationRule', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'status': {'key': 'status', 'type': 'str', 'xml': {'name': 'Status', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601', 'xml': {'name': 'CreatedAt', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'updated_at': {'key': 'updatedAt', 'type': 'iso-8601', 'xml': {'name': 'UpdatedAt', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'accessed_at': {'key': 'accessedAt', 'type': 'iso-8601', 'xml': {'name': 'AccessedAt', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'support_ordering': {'key': 'supportOrdering', 'type': 'bool', 'xml': {'name': 'SupportOrdering', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'message_count_details': {'key': 'messageCountDetails', 'type': 'MessageCountDetails'}, + 'subscription_count': {'key': 'subscriptionCount', 'type': 'int', 'xml': {'name': 'SubscriptionCount', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'auto_delete_on_idle': {'key': 'autoDeleteOnIdle', 'type': 'duration', 'xml': {'name': 'AutoDeleteOnIdle', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'enable_partitioning': {'key': 'enablePartitioning', 'type': 'bool', 'xml': {'name': 'EnablePartitioning', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'entity_availability_status': {'key': 'entityAvailabilityStatus', 'type': 'str', 'xml': {'name': 'EntityAvailabilityStatus', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'enable_subscription_partitioning': {'key': 'enableSubscriptionPartitioning', 'type': 'bool', 'xml': {'name': 'EnableSubscriptionPartitioning', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'enable_express': {'key': 'enableExpress', 'type': 'bool', 'xml': {'name': 'EnableExpress', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'user_metadata': {'key': 'userMetadata', 'type': 'str', 'xml': {'name': 'UserMetadata', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, } _xml_map = { 'name': 'TopicDescription', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect' @@ -1839,7 +1881,9 @@ def __init__( class TrueFilter(SqlFilter): """TrueFilter. - :param type: Constant filled by server. + All required parameters must be populated in order to send to Azure. + + :param type: Required. Constant filled by server. :type type: str :param sql_expression: :type sql_expression: str @@ -1851,12 +1895,16 @@ class TrueFilter(SqlFilter): :type requires_preprocessing: bool """ + _validation = { + 'type': {'required': True}, + } + _attribute_map = { 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True, 'prefix': 'xsi', 'ns': 'http://www.w3.org/2001/XMLSchema-instance'}}, - 'sql_expression': {'key': 'SqlExpression', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'compatibility_level': {'key': 'CompatibilityLevel', 'type': 'str', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'parameters': {'key': 'Parameters', 'type': '[KeyValue]', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'KeyValueOfstringanyType', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, - 'requires_preprocessing': {'key': 'RequiresPreprocessing', 'type': 'bool', 'xml': {'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'sql_expression': {'key': 'sqlExpression', 'type': 'str', 'xml': {'name': 'SqlExpression', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'str', 'xml': {'name': 'CompatibilityLevel', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'parameters': {'key': 'parameters', 'type': '[KeyValue]', 'xml': {'name': 'Parameters', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect', 'wrapped': True, 'itemsName': 'KeyValueOfstringanyType', 'itemsNs': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool', 'xml': {'name': 'RequiresPreprocessing', 'ns': 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'}}, } def __init__( From 48dc43ee8482aa60c774d2221392a21386dd5f51 Mon Sep 17 00:00:00 2001 From: Yijun Xie <48257664+YijunXieMS@users.noreply.github.com> Date: Thu, 16 Jul 2020 12:48:33 -0700 Subject: [PATCH 06/22] fix pylint --- .../azure-servicebus/azure/servicebus/management/_utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py index ca62a3b0041b..fa66ee8a7bd2 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py @@ -66,7 +66,7 @@ def deserialize_value(value, value_type): if value_type in ("int", "long"): value = int(value) elif value_type == "boolean": - value = True if value.lower() == "true" else False + value = value.lower() == "true" elif value_type == "double": value = float(value) elif value_type == "datetime": @@ -84,6 +84,8 @@ def serialize_value_type(value): return "int" if value <= constants.INT_MAX_VALUE_CSHARP else "long", str(value) if value_type == float: return "double", str(value) + if value_type == bool: + return "boolean", str(value) if value_type == datetime: return "datetime", isodate.datetime_isoformat(value) if value_type == timedelta: From 2f1eaae86dd91712addf98376d54a4455e5b804e Mon Sep 17 00:00:00 2001 From: Yijun Xie <48257664+YijunXieMS@users.noreply.github.com> Date: Thu, 16 Jul 2020 16:04:07 -0700 Subject: [PATCH 07/22] Update some constant names --- .../azure/servicebus/aio/management/_utils.py | 7 +++++-- .../azure/servicebus/management/_constants.py | 9 ++++----- .../azure/servicebus/management/_models.py | 10 +++++----- .../azure/servicebus/management/_utils.py | 7 ++++--- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_utils.py b/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_utils.py index 771e56cdf9f5..a5a20021c302 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_utils.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_utils.py @@ -93,8 +93,10 @@ async def extract_rule_data_template(feed_class, convert, feed_element): """Special version of function extrat_data_template for Rule. Pass both the XML entry element and the rule instance to function `convert`. Rule needs to extract - KeyValue from XML Element and set to Rule model instance manually. The msrest serialization/deserialization + KeyValue from XML Element and set to Rule model instance manually. The autorest/msrest serialization/deserialization doesn't work for this special part. + After autorest is enhanced, this method can be removed. + Refer to autorest issue https://github.com/Azure/autorest/issues/3535 """ deserialized = feed_class.deserialize(feed_element) next_link = None @@ -102,7 +104,8 @@ async def extract_rule_data_template(feed_class, convert, feed_element): next_link = deserialized.link[1].href if deserialized.entry: list_of_entities = [ - convert(*x) if convert else x for x in zip(feed_element.findall(constants.ENTRY_TAG), deserialized.entry) + convert(*x) if convert else x for x in zip(feed_element.findall( + constants.ATOM_ENTRY_TAG), deserialized.entry) ] else: list_of_entities = [] diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_constants.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_constants.py index fe22e1025b36..654e284ad544 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_constants.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_constants.py @@ -9,22 +9,21 @@ ENTITY_TYPE_TOPICS = "topics" LIST_OP_SKIP = "$skip" LIST_OP_TOP = "$top" +INT_MAX_VALUE_CSHARP = 2147483647 # C# int max value XML_SCHEMA_NAMESPACE = "http://www.w3.org/2001/XMLSchema" XML_SCHEMA_INSTANCE_NAMESPACE = "http://www.w3.org/2001/XMLSchema-instance" +ATOM_ENTRY_TAG = "{http://www.w3.org/2005/Atom}entry" +ATOM_CONTENT_TAG = "{http://www.w3.org/2005/Atom}content" SB_XML_NAMESPACE = "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect" -ENTRY_TAG = "{http://www.w3.org/2005/Atom}entry" -CONTENT_TAG = "{http://www.w3.org/2005/Atom}content" RULE_KEY_VALUE = "KeyValueOfstringanyType" RULE_KEY = "Key" RULE_VALUE = "Value" RULE_VALUE_TYPE = "type" RULE_VALUE_TYPE_XML_PREFIX = "d6p1" -SQL_COMPATIBILITY_LEVEL = "20" -INT_MAX_VALUE_CSHARP = 2147483647 # C# int max value - +RULE_SQL_COMPATIBILITY_LEVEL = "20" RULE_DESCRIPTION_TAG = "{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}RuleDescription" RULE_FILTER_TAG = "{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Filter" RULE_FILTER_COR_PROPERTIES_TAG = "{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}Properties" diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_models.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_models.py index 830549178456..476868fb319e 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_models.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_models.py @@ -19,7 +19,7 @@ KeyValue from ._model_workaround import adjust_attribute_map -from ._constants import SQL_COMPATIBILITY_LEVEL +from ._constants import RULE_SQL_COMPATIBILITY_LEVEL adjust_attribute_map() @@ -671,7 +671,7 @@ def _to_internal_entity(self): internal_entity = InternalSqlFilter(sql_expression=self.sql_expression) internal_entity.parameters = [KeyValue(key=key, value=value) for key, value in self.parameters.items()] \ if self.parameters else None - internal_entity.compatibility_level = SQL_COMPATIBILITY_LEVEL + internal_entity.compatibility_level = RULE_SQL_COMPATIBILITY_LEVEL internal_entity.requires_preprocessing = self.requires_preprocessing return internal_entity @@ -684,7 +684,7 @@ def _to_internal_entity(self): internal_entity = InternalTrueFilter() internal_entity.sql_expression = self.sql_expression internal_entity.requires_preprocessing = True - internal_entity.compatibility_level = SQL_COMPATIBILITY_LEVEL + internal_entity.compatibility_level = RULE_SQL_COMPATIBILITY_LEVEL return internal_entity @@ -697,7 +697,7 @@ def _to_internal_entity(self): internal_entity = InternalFalseFilter() internal_entity.sql_expression = self.sql_expression internal_entity.requires_preprocessing = True - internal_entity.compatibility_level = SQL_COMPATIBILITY_LEVEL + internal_entity.compatibility_level = RULE_SQL_COMPATIBILITY_LEVEL return internal_entity @@ -720,7 +720,7 @@ def _to_internal_entity(self): internal_entity = InternalSqlRuleAction(sql_expression=self.sql_expression) internal_entity.parameters = [KeyValue(key=key, value=value) for key, value in self.parameters.items()] \ if self.parameters else None - internal_entity.compatibility_level = SQL_COMPATIBILITY_LEVEL + internal_entity.compatibility_level = RULE_SQL_COMPATIBILITY_LEVEL internal_entity.requires_preprocessing = self.requires_preprocessing return internal_entity diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py index fa66ee8a7bd2..896b3a511a35 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py @@ -25,7 +25,8 @@ def extract_rule_data_template(feed_class, convert, feed_element): next_link = deserialized.link[1].href if deserialized.entry: list_of_entities = [ - convert(*x) if convert else x for x in zip(feed_element.findall(constants.ENTRY_TAG), deserialized.entry) + convert(*x) if convert else x for x in zip( + feed_element.findall(constants.ATOM_ENTRY_TAG), deserialized.entry) ] else: list_of_entities = [] @@ -107,7 +108,7 @@ def deserialize_key_values(root, parameters): def deserialize_rule_key_values(entry_ele, rule_description): - content = entry_ele.find(constants.CONTENT_TAG) + content = entry_ele.find(constants.ATOM_CONTENT_TAG) if content: correlation_filter_properties_ele = content\ .find(constants.RULE_DESCRIPTION_TAG) \ @@ -147,7 +148,7 @@ def serialize_key_values(root, kvs): def serialize_rule_key_values(entry_ele, rule_descrpiton): - content = entry_ele.find(constants.CONTENT_TAG) + content = entry_ele.find(constants.ATOM_CONTENT_TAG) if content: correlation_filter_parameters_ele = content\ .find(constants.RULE_DESCRIPTION_TAG) \ From d926b035db4a1567a521dfae8286770de5c4b163 Mon Sep 17 00:00:00 2001 From: Yijun Xie <48257664+YijunXieMS@users.noreply.github.com> Date: Thu, 16 Jul 2020 21:35:50 -0700 Subject: [PATCH 08/22] Update test_async_mgmt_rule_create to include properties and parameters --- ...les_async.test_async_mgmt_rule_create.yaml | 224 ++++++++++-------- .../mgmt_tests/test_mgmt_rules_async.py | 33 ++- ...test_mgmt_rules.test_mgmt_rule_create.yaml | 196 ++++++++------- .../tests/mgmt_tests/test_mgmt_rules.py | 59 ++++- 4 files changed, 311 insertions(+), 201 deletions(-) diff --git a/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/recordings/test_mgmt_rules_async.test_async_mgmt_rule_create.yaml b/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/recordings/test_mgmt_rules_async.test_async_mgmt_rule_create.yaml index 1ae5e27da0e4..340889052687 100644 --- a/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/recordings/test_mgmt_rules_async.test_async_mgmt_rule_create.yaml +++ b/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/recordings/test_mgmt_rules_async.test_async_mgmt_rule_create.yaml @@ -5,22 +5,22 @@ interactions: Accept: - application/xml User-Agent: - - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.18362-SP0) + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.20161-SP0) method: GET uri: https://servicebustestsbname.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-04 response: body: - string: Topicshttps://servicebustest5levlyksxm.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-042020-07-02T06:05:01Z + string: Topicshttps://servicebustestviy6yieihi.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-042020-07-17T02:29:56Z headers: content-type: application/atom+xml;type=feed;charset=utf-8 - date: Thu, 02 Jul 2020 06:05:01 GMT + date: Fri, 17 Jul 2020 02:29:56 GMT server: Microsoft-HTTPAPI/2.0 transfer-encoding: chunked status: code: 200 message: OK - url: https://servicebustest5levlyksxm.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-04 + url: https://servicebustestviy6yieihi.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-04 - request: body: ' @@ -34,26 +34,26 @@ interactions: Content-Type: - application/atom+xml User-Agent: - - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.18362-SP0) + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.20161-SP0) method: PUT uri: https://servicebustestsbname.servicebus.windows.net/topic_testaddf?api-version=2017-04 response: body: - string: https://servicebustest5levlyksxm.servicebus.windows.net/topic_testaddf?api-version=2017-04topic_testaddf2020-07-02T06:05:02Z2020-07-02T06:05:02Zservicebustest5levlyksxmhttps://servicebustestviy6yieihi.servicebus.windows.net/topic_testaddf?api-version=2017-04topic_testaddf2020-07-17T02:29:56Z2020-07-17T02:29:57Zservicebustestviy6yieihiP10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2020-07-02T06:05:02.167Z2020-07-02T06:05:02.203ZtrueP10675199DT2H48M5.4775807SfalseAvailablefalsefalse + xmlns:i="http://www.w3.org/2001/XMLSchema-instance">P10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2020-07-17T02:29:56.967Z2020-07-17T02:29:57.04ZtrueP10675199DT2H48M5.4775807SfalseAvailablefalsefalse headers: content-type: application/atom+xml;type=entry;charset=utf-8 - date: Thu, 02 Jul 2020 06:05:02 GMT + date: Fri, 17 Jul 2020 02:29:56 GMT server: Microsoft-HTTPAPI/2.0 strict-transport-security: max-age=31536000 transfer-encoding: chunked status: code: 201 message: Created - url: https://servicebustest5levlyksxm.servicebus.windows.net/topic_testaddf?api-version=2017-04 + url: https://servicebustestviy6yieihi.servicebus.windows.net/topic_testaddf?api-version=2017-04 - request: body: ' @@ -67,231 +67,255 @@ interactions: Content-Type: - application/atom+xml User-Agent: - - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.18362-SP0) + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.20161-SP0) method: PUT uri: https://servicebustestsbname.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk?api-version=2017-04 response: body: - string: https://servicebustest5levlyksxm.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk?api-version=2017-04sub_testkkk2020-07-02T06:05:02Z2020-07-02T06:05:02Zhttps://servicebustestviy6yieihi.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk?api-version=2017-04sub_testkkk2020-07-17T02:29:57Z2020-07-17T02:29:57ZPT1MfalseP10675199DT2H48M5.4775807Sfalsetrue010trueActive2020-07-02T06:05:02.6809266Z2020-07-02T06:05:02.6809266Z0001-01-01T00:00:00P10675199DT2H48M5.4775807SAvailable + xmlns:i="http://www.w3.org/2001/XMLSchema-instance">PT1MfalseP10675199DT2H48M5.4775807Sfalsetrue010trueActive2020-07-17T02:29:57.5311135Z2020-07-17T02:29:57.5311135Z0001-01-01T00:00:00P10675199DT2H48M5.4775807SAvailable headers: content-type: application/atom+xml;type=entry;charset=utf-8 - date: Thu, 02 Jul 2020 06:05:02 GMT - etag: '637292667022030000' + date: Fri, 17 Jul 2020 02:29:57 GMT + etag: '637305497970400000' server: Microsoft-HTTPAPI/2.0 strict-transport-security: max-age=31536000 transfer-encoding: chunked status: code: 201 message: Created - url: https://servicebustest5levlyksxm.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk?api-version=2017-04 + url: https://servicebustestviy6yieihi.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk?api-version=2017-04 - request: body: ' testcidSET Priority = ''low''test_rule_1' + xsi:type="CorrelationFilter">testcidkey_stringstr1key_int2key_long2147483650key_boolfalsekey_datetime2020-07-05T11:12:13key_durationP1DT2H3MSET Priority = @param20@param2020-07-05T11:12:13test_rule_1' headers: Accept: - application/xml Content-Length: - - '518' + - '1765' Content-Type: - application/atom+xml User-Agent: - - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.18362-SP0) + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.20161-SP0) method: PUT uri: https://servicebustestsbname.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_1?api-version=2017-04 response: body: - string: https://servicebustest5levlyksxm.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_1?api-version=2017-04test_rule_12020-07-02T06:05:02Z2020-07-02T06:05:02Zhttps://servicebustestviy6yieihi.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_1?api-version=2017-04test_rule_12020-07-17T02:29:57Z2020-07-17T02:29:57ZtestcidSET Priority = 'low'202020-07-02T06:05:02.9777986Ztest_rule_1 + xmlns:i="http://www.w3.org/2001/XMLSchema-instance">testcidkey_stringstr1key_int2key_long2147483650key_boolfalsekey_datetime2020-07-05T11:12:13key_durationP1DT2H3MSET Priority = @param20@param2020-07-05T11:12:132020-07-17T02:29:57.7811732Ztest_rule_1 headers: content-type: application/atom+xml;type=entry;charset=utf-8 - date: Thu, 02 Jul 2020 06:05:02 GMT - etag: '637292667022030000' + date: Fri, 17 Jul 2020 02:29:57 GMT + etag: '637305497970400000' server: Microsoft-HTTPAPI/2.0 strict-transport-security: max-age=31536000 transfer-encoding: chunked status: code: 201 message: Created - url: https://servicebustest5levlyksxm.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_1?api-version=2017-04 + url: https://servicebustestviy6yieihi.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_1?api-version=2017-04 - request: body: null headers: Accept: - application/xml User-Agent: - - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.18362-SP0) + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.20161-SP0) method: GET uri: https://servicebustestsbname.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_1?enrich=false&api-version=2017-04 response: body: - string: sb://servicebustest5levlyksxm.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_1?enrich=false&api-version=2017-04test_rule_12020-07-02T06:05:02Z2020-07-02T06:05:02Zsb://servicebustestviy6yieihi.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_1?enrich=false&api-version=2017-04test_rule_12020-07-17T02:29:57Z2020-07-17T02:29:57ZtestcidSET Priority = 'low'202020-07-02T06:05:02.9848695Ztest_rule_1 + xmlns:i="http://www.w3.org/2001/XMLSchema-instance">testcidkey_stringstr1key_int2key_long2147483650key_boolfalsekey_datetime2020-07-05T11:12:13key_durationP1DT2H3MSET Priority = @param20@param2020-07-05T11:12:132020-07-17T02:29:57.7591895Ztest_rule_1 headers: content-type: application/atom+xml;type=entry;charset=utf-8 - date: Thu, 02 Jul 2020 06:05:02 GMT - etag: '637292667022030000' + date: Fri, 17 Jul 2020 02:29:57 GMT + etag: '637305497970400000' server: Microsoft-HTTPAPI/2.0 strict-transport-security: max-age=31536000 transfer-encoding: chunked status: code: 200 message: OK - url: https://servicebustest5levlyksxm.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_1?enrich=false&api-version=2017-04 + url: https://servicebustestviy6yieihi.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_1?enrich=false&api-version=2017-04 - request: body: ' Priority = ''low''Priority = @param120@param1str1test_rule_2' headers: Accept: - application/xml Content-Length: - - '463' + - '690' Content-Type: - application/atom+xml User-Agent: - - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.18362-SP0) + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.20161-SP0) method: PUT uri: https://servicebustestsbname.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_2?api-version=2017-04 response: body: - string: https://servicebustest5levlyksxm.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_2?api-version=2017-04test_rule_22020-07-02T06:05:03Z2020-07-02T06:05:03Zhttps://servicebustestviy6yieihi.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_2?api-version=2017-04test_rule_22020-07-17T02:29:57Z2020-07-17T02:29:57ZPriority - = 'low'202020-07-02T06:05:03.087174Ztest_rule_2 + = @param120@param1str12020-07-17T02:29:57.9998237Ztest_rule_2 headers: content-type: application/atom+xml;type=entry;charset=utf-8 - date: Thu, 02 Jul 2020 06:05:02 GMT - etag: '637292667022030000' + date: Fri, 17 Jul 2020 02:29:57 GMT + etag: '637305497970400000' server: Microsoft-HTTPAPI/2.0 strict-transport-security: max-age=31536000 transfer-encoding: chunked status: code: 201 message: Created - url: https://servicebustest5levlyksxm.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_2?api-version=2017-04 + url: https://servicebustestviy6yieihi.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_2?api-version=2017-04 - request: body: null headers: Accept: - application/xml User-Agent: - - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.18362-SP0) + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.20161-SP0) method: GET uri: https://servicebustestsbname.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_2?enrich=false&api-version=2017-04 response: body: - string: sb://servicebustest5levlyksxm.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_2?enrich=false&api-version=2017-04test_rule_22020-07-02T06:05:03Z2020-07-02T06:05:03Zsb://servicebustestviy6yieihi.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_2?enrich=false&api-version=2017-04test_rule_22020-07-17T02:29:57Z2020-07-17T02:29:57ZPriority - = 'low'202020-07-02T06:05:03.0942588Ztest_rule_2 + = @param120@param1str12020-07-17T02:29:57.9779356Ztest_rule_2 headers: content-type: application/atom+xml;type=entry;charset=utf-8 - date: Thu, 02 Jul 2020 06:05:02 GMT - etag: '637292667022030000' + date: Fri, 17 Jul 2020 02:29:57 GMT + etag: '637305497970400000' server: Microsoft-HTTPAPI/2.0 strict-transport-security: max-age=31536000 transfer-encoding: chunked status: code: 200 message: OK - url: https://servicebustest5levlyksxm.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_2?enrich=false&api-version=2017-04 + url: https://servicebustestviy6yieihi.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_2?enrich=false&api-version=2017-04 - request: body: ' 1 = 1test_rule_3' + xsi:type="TrueFilter">1=120truetest_rule_3' headers: Accept: - application/xml Content-Length: - - '453' + - '545' Content-Type: - application/atom+xml User-Agent: - - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.18362-SP0) + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.20161-SP0) method: PUT uri: https://servicebustestsbname.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_3?api-version=2017-04 response: body: - string: https://servicebustest5levlyksxm.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_3?api-version=2017-04test_rule_32020-07-02T06:05:03Z2020-07-02T06:05:03Zhttps://servicebustestviy6yieihi.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_3?api-version=2017-04test_rule_32020-07-17T02:29:58Z2020-07-17T02:29:58Z1=1202020-07-02T06:05:03.2277809Ztest_rule_3 + i:type="EmptyRuleAction"/>2020-07-17T02:29:58.2189657Ztest_rule_3 headers: content-type: application/atom+xml;type=entry;charset=utf-8 - date: Thu, 02 Jul 2020 06:05:02 GMT - etag: '637292667022030000' + date: Fri, 17 Jul 2020 02:29:57 GMT + etag: '637305497970400000' server: Microsoft-HTTPAPI/2.0 strict-transport-security: max-age=31536000 transfer-encoding: chunked status: code: 201 message: Created - url: https://servicebustest5levlyksxm.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_3?api-version=2017-04 + url: https://servicebustestviy6yieihi.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_3?api-version=2017-04 - request: body: null headers: Accept: - application/xml User-Agent: - - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.18362-SP0) + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.20161-SP0) method: GET uri: https://servicebustestsbname.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_3?enrich=false&api-version=2017-04 response: body: - string: sb://servicebustest5levlyksxm.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_3?enrich=false&api-version=2017-04test_rule_32020-07-02T06:05:03Z2020-07-02T06:05:03Zsb://servicebustestviy6yieihi.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_3?enrich=false&api-version=2017-04test_rule_32020-07-17T02:29:58Z2020-07-17T02:29:58Z1=1202020-07-02T06:05:03.2348363Ztest_rule_3 + i:type="EmptyRuleAction"/>2020-07-17T02:29:58.2138767Ztest_rule_3 headers: content-type: application/atom+xml;type=entry;charset=utf-8 - date: Thu, 02 Jul 2020 06:05:02 GMT - etag: '637292667022030000' + date: Fri, 17 Jul 2020 02:29:57 GMT + etag: '637305497970400000' server: Microsoft-HTTPAPI/2.0 strict-transport-security: max-age=31536000 transfer-encoding: chunked status: code: 200 message: OK - url: https://servicebustest5levlyksxm.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_3?enrich=false&api-version=2017-04 + url: https://servicebustestviy6yieihi.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_3?enrich=false&api-version=2017-04 - request: body: null headers: Accept: - application/xml User-Agent: - - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.18362-SP0) + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.20161-SP0) method: DELETE uri: https://servicebustestsbname.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_1?api-version=2017-04 response: @@ -299,21 +323,21 @@ interactions: string: '' headers: content-length: '0' - date: Thu, 02 Jul 2020 06:05:02 GMT - etag: '637292667022030000' + date: Fri, 17 Jul 2020 02:29:58 GMT + etag: '637305497970400000' server: Microsoft-HTTPAPI/2.0 strict-transport-security: max-age=31536000 status: code: 200 message: OK - url: https://servicebustest5levlyksxm.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_1?api-version=2017-04 + url: https://servicebustestviy6yieihi.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_1?api-version=2017-04 - request: body: null headers: Accept: - application/xml User-Agent: - - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.18362-SP0) + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.20161-SP0) method: DELETE uri: https://servicebustestsbname.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_2?api-version=2017-04 response: @@ -321,21 +345,21 @@ interactions: string: '' headers: content-length: '0' - date: Thu, 02 Jul 2020 06:05:03 GMT - etag: '637292667022030000' + date: Fri, 17 Jul 2020 02:29:58 GMT + etag: '637305497970400000' server: Microsoft-HTTPAPI/2.0 strict-transport-security: max-age=31536000 status: code: 200 message: OK - url: https://servicebustest5levlyksxm.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_2?api-version=2017-04 + url: https://servicebustestviy6yieihi.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_2?api-version=2017-04 - request: body: null headers: Accept: - application/xml User-Agent: - - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.18362-SP0) + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.20161-SP0) method: DELETE uri: https://servicebustestsbname.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_3?api-version=2017-04 response: @@ -343,21 +367,21 @@ interactions: string: '' headers: content-length: '0' - date: Thu, 02 Jul 2020 06:05:03 GMT - etag: '637292667022030000' + date: Fri, 17 Jul 2020 02:29:58 GMT + etag: '637305497970400000' server: Microsoft-HTTPAPI/2.0 strict-transport-security: max-age=31536000 status: code: 200 message: OK - url: https://servicebustest5levlyksxm.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_3?api-version=2017-04 + url: https://servicebustestviy6yieihi.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_3?api-version=2017-04 - request: body: null headers: Accept: - application/xml User-Agent: - - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.18362-SP0) + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.20161-SP0) method: DELETE uri: https://servicebustestsbname.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk?api-version=2017-04 response: @@ -365,21 +389,21 @@ interactions: string: '' headers: content-length: '0' - date: Thu, 02 Jul 2020 06:05:03 GMT - etag: '637292667022030000' + date: Fri, 17 Jul 2020 02:29:58 GMT + etag: '637305497970400000' server: Microsoft-HTTPAPI/2.0 strict-transport-security: max-age=31536000 status: code: 200 message: OK - url: https://servicebustest5levlyksxm.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk?api-version=2017-04 + url: https://servicebustestviy6yieihi.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk?api-version=2017-04 - request: body: null headers: Accept: - application/xml User-Agent: - - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.18362-SP0) + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.20161-SP0) method: DELETE uri: https://servicebustestsbname.servicebus.windows.net/topic_testaddf?api-version=2017-04 response: @@ -387,12 +411,12 @@ interactions: string: '' headers: content-length: '0' - date: Thu, 02 Jul 2020 06:05:03 GMT - etag: '637292667022030000' + date: Fri, 17 Jul 2020 02:29:58 GMT + etag: '637305497970400000' server: Microsoft-HTTPAPI/2.0 strict-transport-security: max-age=31536000 status: code: 200 message: OK - url: https://servicebustest5levlyksxm.servicebus.windows.net/topic_testaddf?api-version=2017-04 + url: https://servicebustestviy6yieihi.servicebus.windows.net/topic_testaddf?api-version=2017-04 version: 1 diff --git a/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/test_mgmt_rules_async.py b/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/test_mgmt_rules_async.py index 82a300513fe8..152bc12e1f93 100644 --- a/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/test_mgmt_rules_async.py +++ b/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/test_mgmt_rules_async.py @@ -4,11 +4,14 @@ # license information. #-------------------------------------------------------------------------- import logging +from datetime import datetime, timedelta + import pytest import msrest from azure.servicebus.aio.management import ServiceBusManagementClient from azure.servicebus.management import RuleDescription, CorrelationRuleFilter, SqlRuleFilter, TrueRuleFilter, SqlRuleAction +from azure.servicebus.management._constants import INT_MAX_VALUE_CSHARP from utilities import get_logger from azure.core.exceptions import HttpResponseError, ResourceExistsError @@ -34,11 +37,22 @@ async def test_async_mgmt_rule_create(self, servicebus_namespace_connection_stri rule_name_2 = 'test_rule_2' rule_name_3 = 'test_rule_3' - correlation_fitler = CorrelationRuleFilter(correlation_id='testcid') - sql_rule_action = SqlRuleAction(sql_expression="SET Priority = 'low'") + correlation_fitler = CorrelationRuleFilter(correlation_id='testcid', properties={ + "key_string": "str1", + "key_int": 2, + "key_long": INT_MAX_VALUE_CSHARP + 3, + "key_bool": False, + "key_datetime": datetime(2020, 7, 5, 11, 12, 13), + "key_duration": timedelta(days=1, hours=2, minutes=3) + }) + sql_rule_action = SqlRuleAction(sql_expression="SET Priority = @param", parameters={ + "@param": datetime(2020, 7, 5, 11, 12, 13), + }) rule_1 = RuleDescription(name=rule_name_1, filter=correlation_fitler, action=sql_rule_action) - sql_filter = SqlRuleFilter("Priority = 'low'") + sql_filter = SqlRuleFilter("Priority = @param1", parameters={ + "@param1": "str1", + }) rule_2 = RuleDescription(name=rule_name_2, filter=sql_filter) bool_filter = TrueRuleFilter() @@ -50,14 +64,23 @@ async def test_async_mgmt_rule_create(self, servicebus_namespace_connection_stri await mgmt_service.create_rule(topic_name, subscription_name, rule_1) rule_desc = await mgmt_service.get_rule(topic_name, subscription_name, rule_name_1) + rule_properties = rule_desc.filter.properties assert type(rule_desc.filter) == CorrelationRuleFilter assert rule_desc.filter.correlation_id == 'testcid' - assert rule_desc.action.sql_expression == "SET Priority = 'low'" + assert rule_desc.action.sql_expression == "SET Priority = @param" + assert rule_desc.action.parameters["@param"] == datetime(2020, 7, 5, 11, 12, 13) + assert rule_properties["key_string"] == "str1" + assert rule_properties["key_int"] == 2 + assert rule_properties["key_long"] == INT_MAX_VALUE_CSHARP + 3 + assert rule_properties["key_bool"] is False + assert rule_properties["key_datetime"] == datetime(2020, 7, 5, 11, 12, 13) + assert rule_properties["key_duration"] == timedelta(days=1, hours=2, minutes=3) await mgmt_service.create_rule(topic_name, subscription_name, rule_2) rule_desc = await mgmt_service.get_rule(topic_name, subscription_name, rule_name_2) assert type(rule_desc.filter) == SqlRuleFilter - assert rule_desc.filter.sql_expression == "Priority = 'low'" + assert rule_desc.filter.sql_expression == "Priority = @param1" + assert rule_desc.filter.parameters["@param1"] == "str1" await mgmt_service.create_rule(topic_name, subscription_name, rule_3) rule_desc = await mgmt_service.get_rule(topic_name, subscription_name, rule_name_3) diff --git a/sdk/servicebus/azure-servicebus/tests/mgmt_tests/recordings/test_mgmt_rules.test_mgmt_rule_create.yaml b/sdk/servicebus/azure-servicebus/tests/mgmt_tests/recordings/test_mgmt_rules.test_mgmt_rule_create.yaml index 3e700ec52c06..0ddb9fb730ca 100644 --- a/sdk/servicebus/azure-servicebus/tests/mgmt_tests/recordings/test_mgmt_rules.test_mgmt_rule_create.yaml +++ b/sdk/servicebus/azure-servicebus/tests/mgmt_tests/recordings/test_mgmt_rules.test_mgmt_rule_create.yaml @@ -9,18 +9,18 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.18362-SP0) + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.20161-SP0) method: GET uri: https://servicebustestsbname.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-04 response: body: - string: Topicshttps://servicebustestshi5frbomp.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-042020-07-02T05:58:36Z + string: Topicshttps://servicebustestzca2g5qsmq.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-042020-07-17T02:22:21Z headers: content-type: - application/atom+xml;type=feed;charset=utf-8 date: - - Thu, 02 Jul 2020 05:58:36 GMT + - Fri, 17 Jul 2020 02:22:20 GMT server: - Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -45,21 +45,21 @@ interactions: Content-Type: - application/atom+xml User-Agent: - - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.18362-SP0) + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.20161-SP0) method: PUT uri: https://servicebustestsbname.servicebus.windows.net/topic_testaddf?api-version=2017-04 response: body: - string: https://servicebustestshi5frbomp.servicebus.windows.net/topic_testaddf?api-version=2017-04topic_testaddf2020-07-02T05:58:37Z2020-07-02T05:58:37Zservicebustestshi5frbomphttps://servicebustestzca2g5qsmq.servicebus.windows.net/topic_testaddf?api-version=2017-04topic_testaddf2020-07-17T02:22:21Z2020-07-17T02:22:22Zservicebustestzca2g5qsmqP10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2020-07-02T05:58:37.417Z2020-07-02T05:58:37.447ZtrueP10675199DT2H48M5.4775807SfalseAvailablefalsefalse + xmlns:i="http://www.w3.org/2001/XMLSchema-instance">P10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2020-07-17T02:22:21.953Z2020-07-17T02:22:22.04ZtrueP10675199DT2H48M5.4775807SfalseAvailablefalsefalse headers: content-type: - application/atom+xml;type=entry;charset=utf-8 date: - - Thu, 02 Jul 2020 05:58:37 GMT + - Fri, 17 Jul 2020 02:22:21 GMT server: - Microsoft-HTTPAPI/2.0 strict-transport-security: @@ -86,23 +86,23 @@ interactions: Content-Type: - application/atom+xml User-Agent: - - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.18362-SP0) + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.20161-SP0) method: PUT uri: https://servicebustestsbname.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk?api-version=2017-04 response: body: - string: https://servicebustestshi5frbomp.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk?api-version=2017-04sub_testkkk2020-07-02T05:58:37Z2020-07-02T05:58:37Zhttps://servicebustestzca2g5qsmq.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk?api-version=2017-04sub_testkkk2020-07-17T02:22:22Z2020-07-17T02:22:22ZPT1MfalseP10675199DT2H48M5.4775807Sfalsetrue010trueActive2020-07-02T05:58:37.9708001Z2020-07-02T05:58:37.9708001Z0001-01-01T00:00:00P10675199DT2H48M5.4775807SAvailable + xmlns:i="http://www.w3.org/2001/XMLSchema-instance">PT1MfalseP10675199DT2H48M5.4775807Sfalsetrue010trueActive2020-07-17T02:22:22.6633698Z2020-07-17T02:22:22.6633698Z0001-01-01T00:00:00P10675199DT2H48M5.4775807SAvailable headers: content-type: - application/atom+xml;type=entry;charset=utf-8 date: - - Thu, 02 Jul 2020 05:58:37 GMT + - Fri, 17 Jul 2020 02:22:22 GMT etag: - - '637292663174470000' + - '637305493420400000' server: - Microsoft-HTTPAPI/2.0 strict-transport-security: @@ -117,8 +117,15 @@ interactions: testcidSET Priority = ''low''test_rule_1' + xsi:type="CorrelationFilter">testcidkey_stringstr1key_int2key_long2147483650key_boolfalsekey_datetime2020-07-05T11:12:13key_durationP1DT2H3MSET Priority = @param20@param2020-07-05T11:12:13test_rule_1' headers: Accept: - application/xml @@ -127,28 +134,35 @@ interactions: Connection: - keep-alive Content-Length: - - '518' + - '1765' Content-Type: - application/atom+xml User-Agent: - - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.18362-SP0) + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.20161-SP0) method: PUT uri: https://servicebustestsbname.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_1?api-version=2017-04 response: body: - string: https://servicebustestshi5frbomp.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_1?api-version=2017-04test_rule_12020-07-02T05:58:38Z2020-07-02T05:58:38Zhttps://servicebustestzca2g5qsmq.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_1?api-version=2017-04test_rule_12020-07-17T02:22:23Z2020-07-17T02:22:23ZtestcidSET Priority = 'low'202020-07-02T05:58:38.1426348Ztest_rule_1 + xmlns:i="http://www.w3.org/2001/XMLSchema-instance">testcidkey_stringstr1key_int2key_long2147483650key_boolfalsekey_datetime2020-07-05T11:12:13key_durationP1DT2H3MSET Priority = @param20@param2020-07-05T11:12:132020-07-17T02:22:23.0245154Ztest_rule_1 headers: content-type: - application/atom+xml;type=entry;charset=utf-8 date: - - Thu, 02 Jul 2020 05:58:38 GMT + - Fri, 17 Jul 2020 02:22:22 GMT etag: - - '637292663174470000' + - '637305493420400000' server: - Microsoft-HTTPAPI/2.0 strict-transport-security: @@ -168,24 +182,31 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.18362-SP0) + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.20161-SP0) method: GET uri: https://servicebustestsbname.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_1?enrich=false&api-version=2017-04 response: body: - string: sb://servicebustestshi5frbomp.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_1?enrich=false&api-version=2017-04test_rule_12020-07-02T05:58:38Z2020-07-02T05:58:38Zsb://servicebustestzca2g5qsmq.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_1?enrich=false&api-version=2017-04test_rule_12020-07-17T02:22:23Z2020-07-17T02:22:23ZtestcidSET Priority = 'low'202020-07-02T05:58:38.1487771Ztest_rule_1 + xmlns:i="http://www.w3.org/2001/XMLSchema-instance">testcidkey_stringstr1key_int2key_long2147483650key_boolfalsekey_datetime2020-07-05T11:12:13key_durationP1DT2H3MSET Priority = @param20@param2020-07-05T11:12:132020-07-17T02:22:23.0289508Ztest_rule_1 headers: content-type: - application/atom+xml;type=entry;charset=utf-8 date: - - Thu, 02 Jul 2020 05:58:38 GMT + - Fri, 17 Jul 2020 02:22:22 GMT etag: - - '637292663174470000' + - '637305493420400000' server: - Microsoft-HTTPAPI/2.0 strict-transport-security: @@ -200,7 +221,8 @@ interactions: Priority = ''low''Priority = @param120@param1str1test_rule_2' headers: Accept: @@ -210,29 +232,30 @@ interactions: Connection: - keep-alive Content-Length: - - '463' + - '690' Content-Type: - application/atom+xml User-Agent: - - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.18362-SP0) + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.20161-SP0) method: PUT uri: https://servicebustestsbname.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_2?api-version=2017-04 response: body: - string: https://servicebustestshi5frbomp.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_2?api-version=2017-04test_rule_22020-07-02T05:58:38Z2020-07-02T05:58:38Zhttps://servicebustestzca2g5qsmq.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_2?api-version=2017-04test_rule_22020-07-17T02:22:23Z2020-07-17T02:22:23ZPriority - = 'low'202020-07-02T05:58:38.3926736Ztest_rule_2 + = @param120@param1str12020-07-17T02:22:23.2276052Ztest_rule_2 headers: content-type: - application/atom+xml;type=entry;charset=utf-8 date: - - Thu, 02 Jul 2020 05:58:38 GMT + - Fri, 17 Jul 2020 02:22:22 GMT etag: - - '637292663174470000' + - '637305493420400000' server: - Microsoft-HTTPAPI/2.0 strict-transport-security: @@ -252,25 +275,26 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.18362-SP0) + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.20161-SP0) method: GET uri: https://servicebustestsbname.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_2?enrich=false&api-version=2017-04 response: body: - string: sb://servicebustestshi5frbomp.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_2?enrich=false&api-version=2017-04test_rule_22020-07-02T05:58:38Z2020-07-02T05:58:38Zsb://servicebustestzca2g5qsmq.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_2?enrich=false&api-version=2017-04test_rule_22020-07-17T02:22:23Z2020-07-17T02:22:23ZPriority - = 'low'202020-07-02T05:58:38.3837741Ztest_rule_2 + = @param120@param1str12020-07-17T02:22:23.2476778Ztest_rule_2 headers: content-type: - application/atom+xml;type=entry;charset=utf-8 date: - - Thu, 02 Jul 2020 05:58:38 GMT + - Fri, 17 Jul 2020 02:22:22 GMT etag: - - '637292663174470000' + - '637305493420400000' server: - Microsoft-HTTPAPI/2.0 strict-transport-security: @@ -285,8 +309,8 @@ interactions: 1 = 1test_rule_3' + xsi:type="TrueFilter">1=120truetest_rule_3' headers: Accept: - application/xml @@ -295,28 +319,28 @@ interactions: Connection: - keep-alive Content-Length: - - '453' + - '545' Content-Type: - application/atom+xml User-Agent: - - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.18362-SP0) + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.20161-SP0) method: PUT uri: https://servicebustestsbname.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_3?api-version=2017-04 response: body: - string: https://servicebustestshi5frbomp.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_3?api-version=2017-04test_rule_32020-07-02T05:58:38Z2020-07-02T05:58:38Zhttps://servicebustestzca2g5qsmq.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_3?api-version=2017-04test_rule_32020-07-17T02:22:23Z2020-07-17T02:22:23Z1=1202020-07-02T05:58:38.7832611Ztest_rule_3 + i:type="EmptyRuleAction"/>2020-07-17T02:22:23.4776391Ztest_rule_3 headers: content-type: - application/atom+xml;type=entry;charset=utf-8 date: - - Thu, 02 Jul 2020 05:58:38 GMT + - Fri, 17 Jul 2020 02:22:22 GMT etag: - - '637292663174470000' + - '637305493420400000' server: - Microsoft-HTTPAPI/2.0 strict-transport-security: @@ -336,24 +360,24 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.18362-SP0) + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.20161-SP0) method: GET uri: https://servicebustestsbname.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_3?enrich=false&api-version=2017-04 response: body: - string: sb://servicebustestshi5frbomp.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_3?enrich=false&api-version=2017-04test_rule_32020-07-02T05:58:38Z2020-07-02T05:58:38Zsb://servicebustestzca2g5qsmq.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_3?enrich=false&api-version=2017-04test_rule_32020-07-17T02:22:23Z2020-07-17T02:22:23Z1=1202020-07-02T05:58:38.7744248Ztest_rule_3 + i:type="EmptyRuleAction"/>2020-07-17T02:22:23.4820344Ztest_rule_3 headers: content-type: - application/atom+xml;type=entry;charset=utf-8 date: - - Thu, 02 Jul 2020 05:58:38 GMT + - Fri, 17 Jul 2020 02:22:23 GMT etag: - - '637292663174470000' + - '637305493420400000' server: - Microsoft-HTTPAPI/2.0 strict-transport-security: @@ -375,7 +399,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.18362-SP0) + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.20161-SP0) method: DELETE uri: https://servicebustestsbname.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_1?api-version=2017-04 response: @@ -385,9 +409,9 @@ interactions: content-length: - '0' date: - - Thu, 02 Jul 2020 05:58:38 GMT + - Fri, 17 Jul 2020 02:22:23 GMT etag: - - '637292663174470000' + - '637305493420400000' server: - Microsoft-HTTPAPI/2.0 strict-transport-security: @@ -407,7 +431,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.18362-SP0) + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.20161-SP0) method: DELETE uri: https://servicebustestsbname.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_2?api-version=2017-04 response: @@ -417,9 +441,9 @@ interactions: content-length: - '0' date: - - Thu, 02 Jul 2020 05:58:38 GMT + - Fri, 17 Jul 2020 02:22:23 GMT etag: - - '637292663174470000' + - '637305493420400000' server: - Microsoft-HTTPAPI/2.0 strict-transport-security: @@ -439,7 +463,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.18362-SP0) + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.20161-SP0) method: DELETE uri: https://servicebustestsbname.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk/rules/test_rule_3?api-version=2017-04 response: @@ -449,9 +473,9 @@ interactions: content-length: - '0' date: - - Thu, 02 Jul 2020 05:58:39 GMT + - Fri, 17 Jul 2020 02:22:23 GMT etag: - - '637292663174470000' + - '637305493420400000' server: - Microsoft-HTTPAPI/2.0 strict-transport-security: @@ -471,7 +495,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.18362-SP0) + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.20161-SP0) method: DELETE uri: https://servicebustestsbname.servicebus.windows.net/topic_testaddf/subscriptions/sub_testkkk?api-version=2017-04 response: @@ -481,9 +505,9 @@ interactions: content-length: - '0' date: - - Thu, 02 Jul 2020 05:58:39 GMT + - Fri, 17 Jul 2020 02:22:23 GMT etag: - - '637292663174470000' + - '637305493420400000' server: - Microsoft-HTTPAPI/2.0 strict-transport-security: @@ -503,7 +527,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.18362-SP0) + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.7 (Windows-10-10.0.20161-SP0) method: DELETE uri: https://servicebustestsbname.servicebus.windows.net/topic_testaddf?api-version=2017-04 response: @@ -513,9 +537,9 @@ interactions: content-length: - '0' date: - - Thu, 02 Jul 2020 05:58:39 GMT + - Fri, 17 Jul 2020 02:22:24 GMT etag: - - '637292663174470000' + - '637305493420400000' server: - Microsoft-HTTPAPI/2.0 strict-transport-security: diff --git a/sdk/servicebus/azure-servicebus/tests/mgmt_tests/test_mgmt_rules.py b/sdk/servicebus/azure-servicebus/tests/mgmt_tests/test_mgmt_rules.py index 2c982cdfa768..4f495c2f49bf 100644 --- a/sdk/servicebus/azure-servicebus/tests/mgmt_tests/test_mgmt_rules.py +++ b/sdk/servicebus/azure-servicebus/tests/mgmt_tests/test_mgmt_rules.py @@ -5,9 +5,11 @@ #-------------------------------------------------------------------------- import logging import pytest +from datetime import datetime, timedelta import msrest from azure.servicebus.management import ServiceBusManagementClient, RuleDescription, CorrelationRuleFilter, SqlRuleFilter, TrueRuleFilter, FalseRuleFilter, SqlRuleAction +from azure.servicebus.management._constants import INT_MAX_VALUE_CSHARP from utilities import get_logger from azure.core.exceptions import HttpResponseError, ResourceExistsError @@ -33,11 +35,22 @@ def test_mgmt_rule_create(self, servicebus_namespace_connection_string, **kwargs rule_name_2 = 'test_rule_2' rule_name_3 = 'test_rule_3' - correlation_fitler = CorrelationRuleFilter(correlation_id='testcid') - sql_rule_action = SqlRuleAction(sql_expression="SET Priority = 'low'") + correlation_fitler = CorrelationRuleFilter(correlation_id='testcid', properties={ + "key_string": "str1", + "key_int": 2, + "key_long": INT_MAX_VALUE_CSHARP + 3, + "key_bool": False, + "key_datetime": datetime(2020, 7, 5, 11, 12, 13), + "key_duration": timedelta(days=1, hours=2, minutes=3) + }) + sql_rule_action = SqlRuleAction(sql_expression="SET Priority = @param", parameters={ + "@param": datetime(2020, 7, 5, 11, 12, 13), + }) rule_1 = RuleDescription(name=rule_name_1, filter=correlation_fitler, action=sql_rule_action) - sql_filter = SqlRuleFilter("Priority = 'low'") + sql_filter = SqlRuleFilter("Priority = @param1", parameters={ + "@param1": "str1", + }) rule_2 = RuleDescription(name=rule_name_2, filter=sql_filter) bool_filter = TrueRuleFilter() @@ -49,25 +62,51 @@ def test_mgmt_rule_create(self, servicebus_namespace_connection_string, **kwargs mgmt_service.create_rule(topic_name, subscription_name, rule_1) rule_desc = mgmt_service.get_rule(topic_name, subscription_name, rule_name_1) + rule_properties = rule_desc.filter.properties assert type(rule_desc.filter) == CorrelationRuleFilter assert rule_desc.filter.correlation_id == 'testcid' - assert rule_desc.action.sql_expression == "SET Priority = 'low'" + assert rule_desc.action.sql_expression == "SET Priority = @param" + assert rule_desc.action.parameters["@param"] == datetime(2020, 7, 5, 11, 12, 13) + assert rule_properties["key_string"] == "str1" + assert rule_properties["key_int"] == 2 + assert rule_properties["key_long"] == INT_MAX_VALUE_CSHARP + 3 + assert rule_properties["key_bool"] is False + assert rule_properties["key_datetime"] == datetime(2020, 7, 5, 11, 12, 13) + assert rule_properties["key_duration"] == timedelta(days=1, hours=2, minutes=3) + mgmt_service.create_rule(topic_name, subscription_name, rule_2) rule_desc = mgmt_service.get_rule(topic_name, subscription_name, rule_name_2) assert type(rule_desc.filter) == SqlRuleFilter - assert rule_desc.filter.sql_expression == "Priority = 'low'" + assert rule_desc.filter.sql_expression == "Priority = @param1" + assert rule_desc.filter.parameters["@param1"] == "str1" mgmt_service.create_rule(topic_name, subscription_name, rule_3) rule_desc = mgmt_service.get_rule(topic_name, subscription_name, rule_name_3) assert type(rule_desc.filter) == TrueRuleFilter finally: - mgmt_service.delete_rule(topic_name, subscription_name, rule_name_1) - mgmt_service.delete_rule(topic_name, subscription_name, rule_name_2) - mgmt_service.delete_rule(topic_name, subscription_name, rule_name_3) - mgmt_service.delete_subscription(topic_name, subscription_name) - mgmt_service.delete_topic(topic_name) + try: + mgmt_service.delete_rule(topic_name, subscription_name, rule_name_1) + except: + pass + try: + mgmt_service.delete_rule(topic_name, subscription_name, rule_name_2) + except: + pass + try: + mgmt_service.delete_rule(topic_name, subscription_name, rule_name_3) + except: + pass + try: + mgmt_service.delete_subscription(topic_name, subscription_name) + except: + pass + try: + mgmt_service.delete_topic(topic_name) + except: + pass + @CachedResourceGroupPreparer(name_prefix='servicebustest') @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') From 199f6efaf90a14025dff083bedf10b048989f8d2 Mon Sep 17 00:00:00 2001 From: Yijun Xie <48257664+YijunXieMS@users.noreply.github.com> Date: Thu, 16 Jul 2020 21:57:58 -0700 Subject: [PATCH 09/22] bug fixing --- .../management/_management_client_async.py | 2 +- .../management/_management_client.py | 2 +- .../azure/servicebus/management/_utils.py | 20 +++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_management_client_async.py b/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_management_client_async.py index f5b01e5319fb..9d252b0e722d 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_management_client_async.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_management_client_async.py @@ -734,7 +734,7 @@ async def create_rule( rule_name, request_body, api_version=constants.API_VERSION, **kwargs) entry = RuleDescriptionEntry.deserialize(entry_ele) - result = entry.content.rule_description + result = RuleDescription._from_internal_entity(rule_name, entry.content.rule_description) deserialize_rule_key_values(entry_ele, result) return result diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_management_client.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_management_client.py index 879b2b24fef5..d9c14066120f 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_management_client.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_management_client.py @@ -723,7 +723,7 @@ def create_rule(self, topic, subscription, rule, **kwargs): rule_name, request_body, api_version=constants.API_VERSION, **kwargs) entry = RuleDescriptionEntry.deserialize(entry_ele) - result = entry.content.rule_description + result = RuleDescription._from_internal_entity(rule_name, entry.content.rule_description) deserialize_rule_key_values(entry_ele, result) return result diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py index 896b3a511a35..80ae06928e29 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py @@ -70,9 +70,9 @@ def deserialize_value(value, value_type): value = value.lower() == "true" elif value_type == "double": value = float(value) - elif value_type == "datetime": + elif value_type == "dateTime": value = isodate.parse_datetime(value) - elif value == "duration": + elif value_type == "duration": value = isodate.parse_duration(value) return value @@ -86,15 +86,15 @@ def serialize_value_type(value): if value_type == float: return "double", str(value) if value_type == bool: - return "boolean", str(value) + return "boolean", str(value).lower() if value_type == datetime: - return "datetime", isodate.datetime_isoformat(value) + return "dateTime", isodate.datetime_isoformat(value) if value_type == timedelta: return "duration", isodate.duration_isoformat(value) raise ValueError("value {} of type {} is not supported for the key value".format(value, value_type)) -def deserialize_key_values(root, parameters): +def deserialize_key_values(root, key_values): key_values_ele = root.findall(constants.RULE_KEY_VALUE_TAG) for key_value_ele in key_values_ele: key_ele = key_value_ele.find(constants.RULE_KEY_TAG) @@ -104,7 +104,7 @@ def deserialize_key_values(root, parameters): value_type = value_ele.attrib[constants.RULE_VALUE_TYPE_TAG] value_type = value_type.split(":")[1] value = deserialize_value(value, value_type) - parameters[key] = value + key_values[key] = value def deserialize_rule_key_values(entry_ele, rule_description): @@ -147,7 +147,7 @@ def serialize_key_values(root, kvs): value_ele.attrib["xmlns:"+constants.RULE_VALUE_TYPE_XML_PREFIX] = constants.XML_SCHEMA_NAMESPACE -def serialize_rule_key_values(entry_ele, rule_descrpiton): +def serialize_rule_key_values(entry_ele, rule_descripiton): content = entry_ele.find(constants.ATOM_CONTENT_TAG) if content: correlation_filter_parameters_ele = content\ @@ -155,16 +155,16 @@ def serialize_rule_key_values(entry_ele, rule_descrpiton): .find(constants.RULE_FILTER_TAG) \ .find(constants.RULE_FILTER_COR_PROPERTIES_TAG) if correlation_filter_parameters_ele: - serialize_key_values(correlation_filter_parameters_ele, rule_descrpiton.filter.properties) + serialize_key_values(correlation_filter_parameters_ele, rule_descripiton.filter.properties) sql_filter_parameters_ele = content\ .find(constants.RULE_DESCRIPTION_TAG) \ .find(constants.RULE_FILTER_TAG) \ .find(constants.RULE_PARAMETERS_TAG) if sql_filter_parameters_ele: - serialize_key_values(sql_filter_parameters_ele, rule_descrpiton.filter.parameters) + serialize_key_values(sql_filter_parameters_ele, rule_descripiton.filter.parameters) sql_action_parameters_ele = content\ .find(constants.RULE_DESCRIPTION_TAG) \ .find(constants.RULE_ACTION_TAG) \ .find(constants.RULE_PARAMETERS_TAG) if sql_action_parameters_ele: - serialize_key_values(sql_action_parameters_ele, rule_descrpiton.action.parameters) + serialize_key_values(sql_action_parameters_ele, rule_descripiton.action.parameters) From 63cc2a76fd6fccab8f685c33f0e7c27daed79755 Mon Sep 17 00:00:00 2001 From: Yijun Xie <48257664+YijunXieMS@users.noreply.github.com> Date: Fri, 17 Jul 2020 11:52:39 -0700 Subject: [PATCH 10/22] Add docstring to rule filter and action --- .../azure/servicebus/management/_models.py | 47 ++++++++++++++++++- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_models.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_models.py index 476868fb319e..d03a0ed14617 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_models.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_models.py @@ -606,6 +606,27 @@ def _to_internal_entity(self): class CorrelationRuleFilter(object): + """Represents the correlation filter expression. + + :param correlation_id: Identifier of the correlation. + :type correlation_id: str + :param message_id: Identifier of the message. + :type message_id: str + :param to: Address to send to. + :type to: str + :param reply_to: Address of the queue to reply to. + :type reply_to: str + :param label: Application specific label. + :type label: str + :param session_id: Session identifier. + :type session_id: str + :param reply_to_session_id: Session identifier to reply to. + :type reply_to_session_id: str + :param content_type: Content type of the message. + :type content_type: str + :param properties: dictionary object for custom filters + :type properties: dict[str, str] + """ def __init__(self, **kwargs): self.correlation_id = kwargs.get('correlation_id', None) self.message_id = kwargs.get('message_id', None) @@ -653,7 +674,16 @@ def _to_internal_entity(self): class SqlRuleFilter(object): - def __init__(self, sql_expression=None, parameters=None, requires_preprocessing=None): + """Represents a filter which is a composition of an expression and an action + that is executed in the pub/sub pipeline. + + :param sql_expression: The SQL expression. e.g. MyProperty='ABC' + :type sql_expression: str + :param requires_preprocessing: Value that indicates whether the rule + filter requires preprocessing. Default value: True . + :type requires_preprocessing: bool + """ + def __init__(self, sql_expression=None, parameters=None, requires_preprocessing=True): self.sql_expression = sql_expression self.parameters = parameters self.requires_preprocessing = requires_preprocessing @@ -677,6 +707,8 @@ def _to_internal_entity(self): class TrueRuleFilter(SqlRuleFilter): + """A sql filter with a sql expression that is always True + """ def __init__(self): super(TrueRuleFilter, self).__init__("1=1", None, True) @@ -690,6 +722,8 @@ def _to_internal_entity(self): class FalseRuleFilter(SqlRuleFilter): + """A sql filter with a sql expression that is always True + """ def __init__(self): super(FalseRuleFilter, self).__init__("1>1", None, True) @@ -702,7 +736,16 @@ def _to_internal_entity(self): class SqlRuleAction(object): - def __init__(self, sql_expression=None, parameters=None, requires_preprocessing=None): + """Represents set of actions written in SQL language-based syntax that is + performed against a ServiceBus.Messaging.BrokeredMessage . + + :param sql_expression: SQL expression. e.g. MyProperty='ABC' + :type sql_expression: str + :param requires_preprocessing: Value that indicates whether the rule + action requires preprocessing. Default value: True . + :type requires_preprocessing: bool + """ + def __init__(self, sql_expression=None, parameters=None, requires_preprocessing=True): self.sql_expression = sql_expression self.parameters = parameters self.requires_preprocessing = requires_preprocessing From eb1dd0cffa07c230bc995e2a95c604898876cc0b Mon Sep 17 00:00:00 2001 From: Yijun Xie <48257664+YijunXieMS@users.noreply.github.com> Date: Fri, 17 Jul 2020 11:54:01 -0700 Subject: [PATCH 11/22] Add more docstring to explain --- .../azure/servicebus/management/_utils.py | 34 ++++++++++++++++--- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py index 80ae06928e29..ebdcbb63cd88 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py @@ -130,12 +130,30 @@ def deserialize_rule_key_values(entry_ele, rule_description): deserialize_key_values(sql_action_parameters_ele, rule_description.action.parameters) -def serialize_key_values(root, kvs): - root.clear() - if kvs: - for key, value in kvs.items(): +def serialize_key_values(xml_parent, key_values): + """serialize a dict to xml Element and put it under xml_parent + + The serialized XML is like: + + + key_string + str1 + + + key_int + 2 + + ... + + :param xml_parent: The parent xml Element for the serialized xml. + :param key_values: The dict that contains the key values. + :return: `xml_parent` is mutated. The returned value is `None`. + """ + xml_parent.clear() + if key_values: + for key, value in key_values.items(): value_type, value_in_str = serialize_value_type(value) - key_value_ele = SubElement(root, QName(constants.SB_XML_NAMESPACE, constants.RULE_KEY_VALUE)) + key_value_ele = SubElement(xml_parent, QName(constants.SB_XML_NAMESPACE, constants.RULE_KEY_VALUE)) key_ele = SubElement(key_value_ele, QName(constants.SB_XML_NAMESPACE, constants.RULE_KEY)) key_ele.text = key type_qname = QName(constants.XML_SCHEMA_INSTANCE_NAMESPACE, "type") @@ -148,6 +166,12 @@ def serialize_key_values(root, kvs): def serialize_rule_key_values(entry_ele, rule_descripiton): + """Serialize a rule's filter and action that have key values into xml. + + CorrelationRuleFilter.properties, SqlRuleFilter.parameters and SqlRuleAction.parameters may contain + data (dict is not empty). Serialize them to XML. + + """ content = entry_ele.find(constants.ATOM_CONTENT_TAG) if content: correlation_filter_parameters_ele = content\ From f17afc2fe0d70095dc4a52ca21a373e44b760cab Mon Sep 17 00:00:00 2001 From: Yijun Xie <48257664+YijunXieMS@users.noreply.github.com> Date: Fri, 17 Jul 2020 12:07:41 -0700 Subject: [PATCH 12/22] Update docstring --- .../azure/servicebus/management/_utils.py | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py index ebdcbb63cd88..510ba3e4d7a1 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py @@ -94,8 +94,26 @@ def serialize_value_type(value): raise ValueError("value {} of type {} is not supported for the key value".format(value, value_type)) -def deserialize_key_values(root, key_values): - key_values_ele = root.findall(constants.RULE_KEY_VALUE_TAG) +def deserialize_key_values(xml_parent, key_values): + """deserialize xml Element and replace the values in dict key_values with correct data types. + + The deserialized XML is like: + + + key_string + str1 + + + key_int + 2 + + ... + + :param xml_parent: The parent xml Element that contains some children of . + :param key_values: The dict that contains the key values. The value could have wrong data types. + :return: This method returns `None`. It will update each value of key_values to correct value type. + """ + key_values_ele = xml_parent.findall(constants.RULE_KEY_VALUE_TAG) for key_value_ele in key_values_ele: key_ele = key_value_ele.find(constants.RULE_KEY_TAG) value_ele = key_value_ele.find(constants.RULE_VALUE_TAG) From 97d815c8928cb5246b3e5b8bb4ce84ec4ab65de5 Mon Sep 17 00:00:00 2001 From: Yijun Xie <48257664+YijunXieMS@users.noreply.github.com> Date: Tue, 21 Jul 2020 19:28:15 -0700 Subject: [PATCH 13/22] Add isodate dependency in setup.py --- sdk/servicebus/azure-servicebus/setup.py | 3 ++- shared_requirements.txt | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sdk/servicebus/azure-servicebus/setup.py b/sdk/servicebus/azure-servicebus/setup.py index edc32a00f41f..baad834d8d3c 100644 --- a/sdk/servicebus/azure-servicebus/setup.py +++ b/sdk/servicebus/azure-servicebus/setup.py @@ -82,7 +82,8 @@ 'msrestazure>=0.4.32,<2.0.0', 'azure-common~=1.1', 'msrest>=0.6.17,<2.0.0', - 'azure-core<2.0.0,>=1.6.0' + 'azure-core<2.0.0,>=1.6.0', + "isodate>=0.6.0", ], extras_require={ ":python_version<'3.0'": ['azure-nspkg', 'futures'], diff --git a/shared_requirements.txt b/shared_requirements.txt index 6ac62568c117..4cd5ee9f14d4 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -109,6 +109,7 @@ aiohttp>=3.0 aiodns>=2.0 python-dateutil>=2.8.0 six>=1.6 +isodate>=0.6.0 #override azure azure-keyvault~=1.0 #override azure-mgmt-core azure-core<2.0.0,>=1.7.0 #override azure-appconfiguration azure-core<2.0.0,>=1.0.0 From 68e4d1a962459b52528336351064a9cd4b1db52b Mon Sep 17 00:00:00 2001 From: Yijun Xie <48257664+YijunXieMS@users.noreply.github.com> Date: Tue, 21 Jul 2020 19:28:50 -0700 Subject: [PATCH 14/22] Update for code review feedback --- .../management/_management_client_async.py | 9 ++++-- .../azure/servicebus/management/_constants.py | 6 +++- .../management/_management_client.py | 11 ++++--- .../azure/servicebus/management/_models.py | 17 +++++++++- .../azure/servicebus/management/_utils.py | 32 ++++++++++++++++++- .../mgmt_tests/test_mgmt_rules_async.py | 6 ++-- .../tests/mgmt_tests/test_mgmt_rules.py | 6 ++-- 7 files changed, 71 insertions(+), 16 deletions(-) diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_management_client_async.py b/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_management_client_async.py index 9d252b0e722d..9ccb33683ab7 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_management_client_async.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_management_client_async.py @@ -693,7 +693,7 @@ async def get_rule( "Rule('Topic: {}, Subscription: {}, Rule {}') does not exist".format( subscription_name, topic_name, rule_name)) rule_description = RuleDescription._from_internal_entity(rule_name, entry.content.rule_description) - deserialize_rule_key_values(entry_ele, rule_description) + deserialize_rule_key_values(entry_ele, rule_description) # to remove after #3535 is released. return rule_description async def create_rule( @@ -735,7 +735,7 @@ async def create_rule( request_body, api_version=constants.API_VERSION, **kwargs) entry = RuleDescriptionEntry.deserialize(entry_ele) result = RuleDescription._from_internal_entity(rule_name, entry.content.rule_description) - deserialize_rule_key_values(entry_ele, result) + deserialize_rule_key_values(entry_ele, result) # to remove after #3535 is released. return result async def update_rule( @@ -830,9 +830,12 @@ def list_rules( subscription_name = subscription def entry_to_rule(ele, entry): + """ + `ele` will be removed after #3535 is released. + """ rule = entry.content.rule_description rule_description = RuleDescription._from_internal_entity(entry.title, rule) - deserialize_rule_key_values(ele, rule_description) + deserialize_rule_key_values(ele, rule_description) # to remove after #3535 is released. return rule_description extract_data = functools.partial( diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_constants.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_constants.py index 654e284ad544..275a584282da 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_constants.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_constants.py @@ -3,21 +3,24 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- +# Generated API parameters API_VERSION_PARAM_NAME = "api-version" API_VERSION = "2017-04" ENTITY_TYPE_QUEUES = "queues" ENTITY_TYPE_TOPICS = "topics" LIST_OP_SKIP = "$skip" LIST_OP_TOP = "$top" -INT_MAX_VALUE_CSHARP = 2147483647 # C# int max value +# XML namespace and tags XML_SCHEMA_NAMESPACE = "http://www.w3.org/2001/XMLSchema" XML_SCHEMA_INSTANCE_NAMESPACE = "http://www.w3.org/2001/XMLSchema-instance" ATOM_ENTRY_TAG = "{http://www.w3.org/2005/Atom}entry" ATOM_CONTENT_TAG = "{http://www.w3.org/2005/Atom}content" +# ServiceBus XML namespace SB_XML_NAMESPACE = "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect" +# Rule XML tags RULE_KEY_VALUE = "KeyValueOfstringanyType" RULE_KEY = "Key" RULE_VALUE = "Value" @@ -33,3 +36,4 @@ RULE_KEY_TAG = "{{{}}}{}".format(SB_XML_NAMESPACE, RULE_KEY) RULE_VALUE_TAG = "{{{}}}{}".format(SB_XML_NAMESPACE, RULE_VALUE) RULE_VALUE_TYPE_TAG = "{{{}}}{}".format(XML_SCHEMA_INSTANCE_NAMESPACE, RULE_VALUE_TYPE) +INT32_MAX_VALUE = 2147483647 # int32 max value used to tell if a Python int is an int32 or long in other languages diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_management_client.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_management_client.py index d9c14066120f..ff74e6d94779 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_management_client.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_management_client.py @@ -21,7 +21,7 @@ TopicDescriptionFeed, CreateSubscriptionBody, CreateSubscriptionBodyContent, CreateRuleBody, \ CreateRuleBodyContent, CreateQueueBody, CreateQueueBodyContent, \ QueueDescription as InternalQueueDescription, TopicDescription as InternalTopicDescription, \ - SubscriptionDescription as InternalSubscriptionDescription, RuleDescription as InternalRuleDescription, \ + SubscriptionDescription as InternalSubscriptionDescription, \ NamespaceProperties from ._utils import extract_data_template, get_next_template, deserialize_rule_key_values, serialize_rule_key_values, \ extract_rule_data_template @@ -684,7 +684,7 @@ def get_rule(self, topic, subscription, rule_name, **kwargs): "Rule('Topic: {}, Subscription: {}, Rule {}') does not exist".format( subscription_name, topic_name, rule_name)) rule_description = RuleDescription._from_internal_entity(rule_name, entry.content.rule_description) - deserialize_rule_key_values(entry_ele, rule_description) + deserialize_rule_key_values(entry_ele, rule_description) # to remove after #3535 is released. return rule_description def create_rule(self, topic, subscription, rule, **kwargs): @@ -724,7 +724,7 @@ def create_rule(self, topic, subscription, rule, **kwargs): request_body, api_version=constants.API_VERSION, **kwargs) entry = RuleDescriptionEntry.deserialize(entry_ele) result = RuleDescription._from_internal_entity(rule_name, entry.content.rule_description) - deserialize_rule_key_values(entry_ele, result) + deserialize_rule_key_values(entry_ele, result) # to remove after #3535 is released. return result def update_rule(self, topic, subscription, rule, **kwargs): @@ -815,9 +815,12 @@ def list_rules(self, topic, subscription, **kwargs): subscription_name = subscription def entry_to_rule(ele, entry): + """ + `ele` will be removed after https://github.com/Azure/autorest/issues/3535 is released. + """ rule = entry.content.rule_description rule_description = RuleDescription._from_internal_entity(entry.title, rule) - deserialize_rule_key_values(ele, rule_description) + deserialize_rule_key_values(ele, rule_description) # to remove after #3535 is released. return rule_description extract_data = functools.partial( diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_models.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_models.py index d03a0ed14617..33135ff30a86 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_models.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_models.py @@ -5,7 +5,8 @@ # pylint:disable=protected-access from collections import OrderedDict from copy import deepcopy -from typing import Type, Dict +from datetime import datetime, timedelta +from typing import Type, Dict, Any, Union, Optional from msrest.serialization import Model from ._generated.models import QueueDescription as InternalQueueDescription, \ @@ -97,6 +98,7 @@ def __init__( name, **kwargs ): + # type: (str, Any) -> None self.name = name self._internal_qd = None @@ -205,6 +207,7 @@ def __init__( name, **kwargs ): + # type: (str, Any) -> None self.name = name self._internal_qr = None @@ -291,6 +294,7 @@ def __init__( name, **kwargs ): + # type: (str, Any) -> None self.name = name self._internal_td = None @@ -381,6 +385,7 @@ def __init__( name, **kwargs ): + # type: (str, Any) -> None self.name = name self._internal_td = None self.created_at = kwargs.get('created_at', None) @@ -453,6 +458,7 @@ class SubscriptionDescription(object): # pylint:disable=too-many-instance-attri ~azure.servicebus.management._generated.models.EntityAvailabilityStatus """ def __init__(self, name, **kwargs): + # type: (str, Any) -> None self.name = name self._internal_sd = None @@ -533,6 +539,7 @@ class SubscriptionRuntimeInfo(object): """ def __init__(self, name, **kwargs): + # type: (str, Any) -> None self._internal_sd = None self.name = name @@ -571,6 +578,7 @@ class RuleDescription(object): """ def __init__(self, name, **kwargs): + # type: (str, Any) -> None self.filter = kwargs.get('filter', None) self.action = kwargs.get('action', None) self.created_at = kwargs.get('created_at', None) @@ -628,6 +636,7 @@ class CorrelationRuleFilter(object): :type properties: dict[str, str] """ def __init__(self, **kwargs): + # type: (Any) -> None self.correlation_id = kwargs.get('correlation_id', None) self.message_id = kwargs.get('message_id', None) self.to = kwargs.get('to', None) @@ -679,11 +688,14 @@ class SqlRuleFilter(object): :param sql_expression: The SQL expression. e.g. MyProperty='ABC' :type sql_expression: str + :param parameters: Sets the value of the sql expression parameters if any. + :type parameters: dict[str, Union[str, int, float, bool, datetime, timedelta]] :param requires_preprocessing: Value that indicates whether the rule filter requires preprocessing. Default value: True . :type requires_preprocessing: bool """ def __init__(self, sql_expression=None, parameters=None, requires_preprocessing=True): + # type: (Optional[str], Optional[Dict[str, Union[str, int, float, bool, datetime, timedelta]]], bool) -> None self.sql_expression = sql_expression self.parameters = parameters self.requires_preprocessing = requires_preprocessing @@ -741,11 +753,14 @@ class SqlRuleAction(object): :param sql_expression: SQL expression. e.g. MyProperty='ABC' :type sql_expression: str + :param parameters: Sets the value of the sql expression parameters if any. + :type parameters: dict[str, Union[str, int, float, bool, datetime, timedelta]] :param requires_preprocessing: Value that indicates whether the rule action requires preprocessing. Default value: True . :type requires_preprocessing: bool """ def __init__(self, sql_expression=None, parameters=None, requires_preprocessing=True): + # type: (Optional[str], Optional[Dict[str, Union[str, int, float, bool, datetime, timedelta]]], bool) -> None self.sql_expression = sql_expression self.parameters = parameters self.requires_preprocessing = requires_preprocessing diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py index 510ba3e4d7a1..65eb1c1c6cfd 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py @@ -19,6 +19,14 @@ def extract_rule_data_template(feed_class, convert, feed_element): + """Special version of function extrat_data_template for Rule. + + Pass both the XML entry element and the rule instance to function `convert`. Rule needs to extract + KeyValue from XML Element and set to Rule model instance manually. The autorest/msrest serialization/deserialization + doesn't work for this special part. + After autorest is enhanced, this method can be removed. + Refer to autorest issue https://github.com/Azure/autorest/issues/3535 + """ deserialized = feed_class.deserialize(feed_element) next_link = None if deserialized.link and len(deserialized.link) == 2: @@ -43,6 +51,12 @@ def extract_data_template(feed_class, convert, feed_element): def get_next_template(list_func, *args, **kwargs): + """Call list_func to get the XML data and deserialize it to XML ElementTree. + + azure.core.async_paging.AsyncItemPaged will call `extract_data_template` and use the returned + XML ElementTree to call a partial function created from `extrat_data_template`. + + """ start_index = kwargs.pop("start_index", 0) max_page_size = kwargs.pop("max_page_size", 100) api_version = constants.API_VERSION @@ -82,7 +96,7 @@ def serialize_value_type(value): if value_type == str: return "string", value if value_type == int: - return "int" if value <= constants.INT_MAX_VALUE_CSHARP else "long", str(value) + return "int" if value <= constants.INT32_MAX_VALUE else "long", str(value) if value_type == float: return "double", str(value) if value_type == bool: @@ -109,6 +123,9 @@ def deserialize_key_values(xml_parent, key_values): ... + After autorest is enhanced, this method can be removed. + Refer to autorest issue https://github.com/Azure/autorest/issues/3535 + :param xml_parent: The parent xml Element that contains some children of . :param key_values: The dict that contains the key values. The value could have wrong data types. :return: This method returns `None`. It will update each value of key_values to correct value type. @@ -126,6 +143,14 @@ def deserialize_key_values(xml_parent, key_values): def deserialize_rule_key_values(entry_ele, rule_description): + """Deserialize a rule's filter and action that have key values from xml. + + CorrelationRuleFilter.properties, SqlRuleFilter.parameters and SqlRuleAction.parameters may contain + data (dict is not empty). + + After autorest is enhanced, this method can be removed. + Refer to autorest issue https://github.com/Azure/autorest/issues/3535 + """ content = entry_ele.find(constants.ATOM_CONTENT_TAG) if content: correlation_filter_properties_ele = content\ @@ -166,6 +191,9 @@ def serialize_key_values(xml_parent, key_values): :param xml_parent: The parent xml Element for the serialized xml. :param key_values: The dict that contains the key values. :return: `xml_parent` is mutated. The returned value is `None`. + + After autorest is enhanced, this method can be removed. + Refer to autorest issue https://github.com/Azure/autorest/issues/3535 """ xml_parent.clear() if key_values: @@ -189,6 +217,8 @@ def serialize_rule_key_values(entry_ele, rule_descripiton): CorrelationRuleFilter.properties, SqlRuleFilter.parameters and SqlRuleAction.parameters may contain data (dict is not empty). Serialize them to XML. + After autorest is enhanced, this method can be removed. + Refer to autorest issue https://github.com/Azure/autorest/issues/3535 """ content = entry_ele.find(constants.ATOM_CONTENT_TAG) if content: diff --git a/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/test_mgmt_rules_async.py b/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/test_mgmt_rules_async.py index 152bc12e1f93..b01eed309925 100644 --- a/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/test_mgmt_rules_async.py +++ b/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/test_mgmt_rules_async.py @@ -11,7 +11,7 @@ import msrest from azure.servicebus.aio.management import ServiceBusManagementClient from azure.servicebus.management import RuleDescription, CorrelationRuleFilter, SqlRuleFilter, TrueRuleFilter, SqlRuleAction -from azure.servicebus.management._constants import INT_MAX_VALUE_CSHARP +from azure.servicebus.management._constants import INT32_MAX_VALUE from utilities import get_logger from azure.core.exceptions import HttpResponseError, ResourceExistsError @@ -40,7 +40,7 @@ async def test_async_mgmt_rule_create(self, servicebus_namespace_connection_stri correlation_fitler = CorrelationRuleFilter(correlation_id='testcid', properties={ "key_string": "str1", "key_int": 2, - "key_long": INT_MAX_VALUE_CSHARP + 3, + "key_long": INT32_MAX_VALUE + 3, "key_bool": False, "key_datetime": datetime(2020, 7, 5, 11, 12, 13), "key_duration": timedelta(days=1, hours=2, minutes=3) @@ -71,7 +71,7 @@ async def test_async_mgmt_rule_create(self, servicebus_namespace_connection_stri assert rule_desc.action.parameters["@param"] == datetime(2020, 7, 5, 11, 12, 13) assert rule_properties["key_string"] == "str1" assert rule_properties["key_int"] == 2 - assert rule_properties["key_long"] == INT_MAX_VALUE_CSHARP + 3 + assert rule_properties["key_long"] == INT32_MAX_VALUE + 3 assert rule_properties["key_bool"] is False assert rule_properties["key_datetime"] == datetime(2020, 7, 5, 11, 12, 13) assert rule_properties["key_duration"] == timedelta(days=1, hours=2, minutes=3) diff --git a/sdk/servicebus/azure-servicebus/tests/mgmt_tests/test_mgmt_rules.py b/sdk/servicebus/azure-servicebus/tests/mgmt_tests/test_mgmt_rules.py index 4f495c2f49bf..9acc0e3f894e 100644 --- a/sdk/servicebus/azure-servicebus/tests/mgmt_tests/test_mgmt_rules.py +++ b/sdk/servicebus/azure-servicebus/tests/mgmt_tests/test_mgmt_rules.py @@ -9,7 +9,7 @@ import msrest from azure.servicebus.management import ServiceBusManagementClient, RuleDescription, CorrelationRuleFilter, SqlRuleFilter, TrueRuleFilter, FalseRuleFilter, SqlRuleAction -from azure.servicebus.management._constants import INT_MAX_VALUE_CSHARP +from azure.servicebus.management._constants import INT32_MAX_VALUE from utilities import get_logger from azure.core.exceptions import HttpResponseError, ResourceExistsError @@ -38,7 +38,7 @@ def test_mgmt_rule_create(self, servicebus_namespace_connection_string, **kwargs correlation_fitler = CorrelationRuleFilter(correlation_id='testcid', properties={ "key_string": "str1", "key_int": 2, - "key_long": INT_MAX_VALUE_CSHARP + 3, + "key_long": INT32_MAX_VALUE + 3, "key_bool": False, "key_datetime": datetime(2020, 7, 5, 11, 12, 13), "key_duration": timedelta(days=1, hours=2, minutes=3) @@ -69,7 +69,7 @@ def test_mgmt_rule_create(self, servicebus_namespace_connection_string, **kwargs assert rule_desc.action.parameters["@param"] == datetime(2020, 7, 5, 11, 12, 13) assert rule_properties["key_string"] == "str1" assert rule_properties["key_int"] == 2 - assert rule_properties["key_long"] == INT_MAX_VALUE_CSHARP + 3 + assert rule_properties["key_long"] == INT32_MAX_VALUE + 3 assert rule_properties["key_bool"] is False assert rule_properties["key_datetime"] == datetime(2020, 7, 5, 11, 12, 13) assert rule_properties["key_duration"] == timedelta(days=1, hours=2, minutes=3) From fb5b730febfbc9ca32299b0f58e1c6a0c8d19730 Mon Sep 17 00:00:00 2001 From: Yijun Xie <48257664+YijunXieMS@users.noreply.github.com> Date: Wed, 22 Jul 2020 11:57:51 -0700 Subject: [PATCH 15/22] Add type hint to model class __init__ --- .../azure/servicebus/management/_models.py | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_models.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_models.py index 33135ff30a86..ee3559cd4672 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_models.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_models.py @@ -100,7 +100,7 @@ def __init__( ): # type: (str, Any) -> None self.name = name - self._internal_qd = None + self._internal_qd = None # type: Optional[InternalQueueDescription] self.authorization_rules = kwargs.get('authorization_rules', None) self.auto_delete_on_idle = kwargs.get('auto_delete_on_idle', None) @@ -209,7 +209,7 @@ def __init__( ): # type: (str, Any) -> None self.name = name - self._internal_qr = None + self._internal_qr = None # type: Optional[InternalQueueDescription] self.accessed_at = kwargs.get('accessed_at', None) self.created_at = kwargs.get('created_at', None) @@ -296,7 +296,7 @@ def __init__( ): # type: (str, Any) -> None self.name = name - self._internal_td = None + self._internal_td = None # type: Optional[InternalTopicDescription] self.default_message_time_to_live = kwargs.get('default_message_time_to_live', None) self.max_size_in_megabytes = kwargs.get('max_size_in_megabytes', None) @@ -387,7 +387,7 @@ def __init__( ): # type: (str, Any) -> None self.name = name - self._internal_td = None + self._internal_td = None # type: Optional[InternalTopicDescription] self.created_at = kwargs.get('created_at', None) self.updated_at = kwargs.get('updated_at', None) self.accessed_at = kwargs.get('accessed_at', None) @@ -460,7 +460,7 @@ class SubscriptionDescription(object): # pylint:disable=too-many-instance-attri def __init__(self, name, **kwargs): # type: (str, Any) -> None self.name = name - self._internal_sd = None + self._internal_sd = None # type: Optional[InternalSubscriptionDescription] self.lock_duration = kwargs.get('lock_duration', None) self.requires_session = kwargs.get('requires_session', None) @@ -540,7 +540,7 @@ class SubscriptionRuntimeInfo(object): """ def __init__(self, name, **kwargs): # type: (str, Any) -> None - self._internal_sd = None + self._internal_sd = None # type: Optional[InternalSubscriptionDescription] self.name = name self.message_count = kwargs.get('message_count', None) @@ -584,7 +584,7 @@ def __init__(self, name, **kwargs): self.created_at = kwargs.get('created_at', None) self.name = name - self._internal_rule = None + self._internal_rule = None # type: Optional[InternalRuleDescription] @classmethod def _from_internal_entity(cls, name, internal_rule): @@ -597,7 +597,6 @@ def _from_internal_entity(cls, name, internal_rule): rule.action = RULE_CLASS_MAPPING[type(internal_rule.action)]._from_internal_entity(internal_rule.action) \ if internal_rule.action and isinstance(internal_rule.action, tuple(RULE_CLASS_MAPPING.keys())) else None rule.created_at = internal_rule.created_at - rule.name = internal_rule.name return rule @@ -605,7 +604,7 @@ def _to_internal_entity(self): # type: () -> InternalRuleDescription if not self._internal_rule: self._internal_rule = InternalRuleDescription() - self._internal_rule.filter = self.filter._to_internal_entity() if self.filter else TRUE_FILTER + self._internal_rule.filter = self.filter._to_internal_entity() if self.filter else TRUE_FILTER # type: ignore self._internal_rule.action = self.action._to_internal_entity() if self.action else EMPTY_RULE_ACTION self._internal_rule.created_at = self.created_at self._internal_rule.name = self.name @@ -666,6 +665,7 @@ def _from_internal_entity(cls, internal_correlation_filter): return correlation_filter def _to_internal_entity(self): + # type: () -> InternalCorrelationFilter internal_entity = InternalCorrelationFilter() internal_entity.correlation_id = self.correlation_id @@ -710,9 +710,11 @@ def _from_internal_entity(cls, internal_sql_rule_filter): return sql_rule_filter def _to_internal_entity(self): + # type: () -> InternalSqlFilter internal_entity = InternalSqlFilter(sql_expression=self.sql_expression) - internal_entity.parameters = [KeyValue(key=key, value=value) for key, value in self.parameters.items()] \ - if self.parameters else None + internal_entity.parameters = [ + KeyValue(key=key, value=value) for key, value in self.parameters.items() # type: ignore + ] if self.parameters else None internal_entity.compatibility_level = RULE_SQL_COMPATIBILITY_LEVEL internal_entity.requires_preprocessing = self.requires_preprocessing return internal_entity From 011856d74826a3b8f36b9f54494d2ebbb6bf8e83 Mon Sep 17 00:00:00 2001 From: Yijun Xie <48257664+YijunXieMS@users.noreply.github.com> Date: Thu, 23 Jul 2020 10:13:17 -0700 Subject: [PATCH 16/22] Update correlation filter properties dict data type --- .../azure-servicebus/azure/servicebus/management/_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_models.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_models.py index ee3559cd4672..687cefee36f1 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_models.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_models.py @@ -632,7 +632,7 @@ class CorrelationRuleFilter(object): :param content_type: Content type of the message. :type content_type: str :param properties: dictionary object for custom filters - :type properties: dict[str, str] + :type properties: dict[str, Union[str, int, float, bool, datetime, timedelta]] """ def __init__(self, **kwargs): # type: (Any) -> None From 1b118ba0f2e9431c01ee7c00a2a3d26d30924be3 Mon Sep 17 00:00:00 2001 From: Yijun Xie <48257664+YijunXieMS@users.noreply.github.com> Date: Thu, 23 Jul 2020 15:53:39 -0700 Subject: [PATCH 17/22] note on isodate limitations Co-authored-by: KieranBrantnerMagee --- .../azure-servicebus/azure/servicebus/management/_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py index 65eb1c1c6cfd..0cccbd7495e5 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py @@ -87,7 +87,7 @@ def deserialize_value(value, value_type): elif value_type == "dateTime": value = isodate.parse_datetime(value) elif value_type == "duration": - value = isodate.parse_duration(value) + value = isodate.parse_duration(value) # Note: If value ever includes a month or year, will return an isodate type, and should be reassessed return value From 3d981a132be3ed4b87f7b5a27262c25d8b7d7568 Mon Sep 17 00:00:00 2001 From: Yijun Xie <48257664+YijunXieMS@users.noreply.github.com> Date: Thu, 23 Jul 2020 16:23:34 -0700 Subject: [PATCH 18/22] Fix line too long --- .../azure-servicebus/azure/servicebus/management/_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py index 0cccbd7495e5..6132c4626ba0 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py @@ -87,7 +87,8 @@ def deserialize_value(value, value_type): elif value_type == "dateTime": value = isodate.parse_datetime(value) elif value_type == "duration": - value = isodate.parse_duration(value) # Note: If value ever includes a month or year, will return an isodate type, and should be reassessed + value = isodate.parse_duration(value) + # Note: If value ever includes a month or year, will return an isodate type, and should be reassessed return value From 73712927404bb9914e4ff5aed19e31ae291a7f08 Mon Sep 17 00:00:00 2001 From: Yijun Xie <48257664+YijunXieMS@users.noreply.github.com> Date: Thu, 23 Jul 2020 18:07:34 -0700 Subject: [PATCH 19/22] use six.integer_types --- .../azure/servicebus/management/_utils.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py index 6132c4626ba0..879d120b4eb1 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py @@ -6,6 +6,7 @@ from typing import cast from xml.etree.ElementTree import ElementTree, SubElement, QName import isodate +import six # Refer to the async version of this module under ..\aio\management\_utils.py for detailed explanation. @@ -93,18 +94,17 @@ def deserialize_value(value, value_type): def serialize_value_type(value): - value_type = type(value) - if value_type == str: + if isinstance(value, six.string_types): return "string", value - if value_type == int: + if isinstance(value, six.integer_types): return "int" if value <= constants.INT32_MAX_VALUE else "long", str(value) - if value_type == float: + if isinstance(value, float): return "double", str(value) - if value_type == bool: + if isinstance(value, bool): return "boolean", str(value).lower() - if value_type == datetime: + if isinstance(value, datetime): return "dateTime", isodate.datetime_isoformat(value) - if value_type == timedelta: + if isinstance(value, timedelta): return "duration", isodate.duration_isoformat(value) raise ValueError("value {} of type {} is not supported for the key value".format(value, value_type)) From 73615919524a043a0bcb42c477fb587bf0dc3626 Mon Sep 17 00:00:00 2001 From: Yijun Xie <48257664+YijunXieMS@users.noreply.github.com> Date: Thu, 23 Jul 2020 19:10:43 -0700 Subject: [PATCH 20/22] small fix --- .../azure-servicebus/azure/servicebus/management/_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py index 879d120b4eb1..fa1980a91993 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py @@ -106,7 +106,7 @@ def serialize_value_type(value): return "dateTime", isodate.datetime_isoformat(value) if isinstance(value, timedelta): return "duration", isodate.duration_isoformat(value) - raise ValueError("value {} of type {} is not supported for the key value".format(value, value_type)) + raise ValueError("value {} of type {} is not supported for the key value".format(value, type(value))) def deserialize_key_values(xml_parent, key_values): From daf790047e874ee421476da77a27feaa018999c4 Mon Sep 17 00:00:00 2001 From: Yijun Xie <48257664+YijunXieMS@users.noreply.github.com> Date: Thu, 23 Jul 2020 19:15:20 -0700 Subject: [PATCH 21/22] Add six dependency --- sdk/servicebus/azure-servicebus/setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/servicebus/azure-servicebus/setup.py b/sdk/servicebus/azure-servicebus/setup.py index baad834d8d3c..1cecc3406a3c 100644 --- a/sdk/servicebus/azure-servicebus/setup.py +++ b/sdk/servicebus/azure-servicebus/setup.py @@ -84,6 +84,7 @@ 'msrest>=0.6.17,<2.0.0', 'azure-core<2.0.0,>=1.6.0', "isodate>=0.6.0", + "six>=1.6", ], extras_require={ ":python_version<'3.0'": ['azure-nspkg', 'futures'], From 7f664858517fb7d974350efc49b13b8f6f6744fb Mon Sep 17 00:00:00 2001 From: Yijun Xie <48257664+YijunXieMS@users.noreply.github.com> Date: Thu, 23 Jul 2020 22:49:24 -0700 Subject: [PATCH 22/22] Bug fix --- .../azure/servicebus/management/_utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py index fa1980a91993..8e233434f711 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py @@ -94,14 +94,14 @@ def deserialize_value(value, value_type): def serialize_value_type(value): + if isinstance(value, float): + return "double", str(value) + if isinstance(value, bool): # Attention: bool is subclass of int. So put bool ahead of int + return "boolean", str(value).lower() if isinstance(value, six.string_types): return "string", value if isinstance(value, six.integer_types): return "int" if value <= constants.INT32_MAX_VALUE else "long", str(value) - if isinstance(value, float): - return "double", str(value) - if isinstance(value, bool): - return "boolean", str(value).lower() if isinstance(value, datetime): return "dateTime", isodate.datetime_isoformat(value) if isinstance(value, timedelta):