本文整理汇总了Python中azure.servicebus.ServiceBusService.update_event_hub方法的典型用法代码示例。如果您正苦于以下问题:Python ServiceBusService.update_event_hub方法的具体用法?Python ServiceBusService.update_event_hub怎么用?Python ServiceBusService.update_event_hub使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类azure.servicebus.ServiceBusService
的用法示例。
在下文中一共展示了ServiceBusService.update_event_hub方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ServiceBusEventHubTest
# 需要导入模块: from azure.servicebus import ServiceBusService [as 别名]
# 或者: from azure.servicebus.ServiceBusService import update_event_hub [as 别名]
#.........这里部分代码省略.........
# Act
hub = EventHub()
hub.authorization_rules.append(
AuthorizationRule(
claim_type='SharedAccessKey',
claim_value='None',
rights=['Manage', 'Send', 'Listen'],
key_name='Key1',
primary_key='Wli4rewPGuEsLam95nQEwGR+e8b+ynlupZQ7VfjbQnw=',
secondary_key='jS+lERPBmbBVGJ5JzIwVRtSGYoFUeunRoADNTjwU3jU=',
)
)
created = self.sbs.create_event_hub(self.event_hub_name, hub)
# Assert
self.assertTrue(created)
created_hub = self.sbs.get_event_hub(self.event_hub_name)
self.assertEqual(created_hub.name, self.event_hub_name)
self.assertEqual(len(created_hub.authorization_rules), 1)
self.assertEqual(created_hub.authorization_rules[0].claim_type,
hub.authorization_rules[0].claim_type)
self.assertEqual(created_hub.authorization_rules[0].claim_value,
hub.authorization_rules[0].claim_value)
self.assertEqual(created_hub.authorization_rules[0].key_name,
hub.authorization_rules[0].key_name)
self.assertEqual(created_hub.authorization_rules[0].primary_key,
hub.authorization_rules[0].primary_key)
self.assertEqual(created_hub.authorization_rules[0].secondary_key,
hub.authorization_rules[0].secondary_key)
@record
def test_update_event_hub(self):
# Arrange
self._create_event_hub(self.event_hub_name)
# Act
hub = EventHub(message_retention_in_days=3)
result = self.sbs.update_event_hub(self.event_hub_name, hub)
# Assert
self.assertIsNotNone(result)
self.assertEqual(result.name, self.event_hub_name)
self.assertEqual(result.message_retention_in_days,
hub.message_retention_in_days)
@record
def test_update_event_hub_with_authorization(self):
# Arrange
self._create_event_hub(self.event_hub_name)
# Act
hub = EventHub()
hub.authorization_rules.append(
AuthorizationRule(
claim_type='SharedAccessKey',
claim_value='None',
rights=['Manage', 'Send', 'Listen'],
key_name='Key1',
primary_key='Wli4rewPGuEsLam95nQEwGR+e8b+ynlupZQ7VfjbQnw=',
secondary_key='jS+lERPBmbBVGJ5JzIwVRtSGYoFUeunRoADNTjwU3jU=',
)
)
result = self.sbs.update_event_hub(self.event_hub_name, hub)
示例2: EventHubServiceTest
# 需要导入模块: from azure.servicebus import ServiceBusService [as 别名]
# 或者: from azure.servicebus.ServiceBusService import update_event_hub [as 别名]
#.........这里部分代码省略.........
# Arrange
# Act
hub = EventHub()
hub.authorization_rules.append(
AuthorizationRule(
claim_type='SharedAccessKey',
claim_value='None',
rights=['Manage', 'Send', 'Listen'],
key_name='Key1',
primary_key='Wli4rewPGuEsLam95nQEwGR+e8b+ynlupZQ7VfjbQnw=',
secondary_key='jS+lERPBmbBVGJ5JzIwVRtSGYoFUeunRoADNTjwU3jU=',
)
)
created = self.sbs.create_event_hub(self.event_hub_name, hub)
# Assert
self.assertTrue(created)
created_hub = self.sbs.get_event_hub(self.event_hub_name)
self.assertEqual(created_hub.name, self.event_hub_name)
self.assertEqual(len(created_hub.authorization_rules), 1)
self.assertEqual(created_hub.authorization_rules[0].claim_type,
hub.authorization_rules[0].claim_type)
self.assertEqual(created_hub.authorization_rules[0].claim_value,
hub.authorization_rules[0].claim_value)
self.assertEqual(created_hub.authorization_rules[0].key_name,
hub.authorization_rules[0].key_name)
self.assertEqual(created_hub.authorization_rules[0].primary_key,
hub.authorization_rules[0].primary_key)
self.assertEqual(created_hub.authorization_rules[0].secondary_key,
hub.authorization_rules[0].secondary_key)
def test_update_event_hub(self):
# Arrange
self._create_event_hub(self.event_hub_name)
# Act
hub = EventHub(message_retention_in_days=3)
result = self.sbs.update_event_hub(self.event_hub_name, hub)
# Assert
self.assertIsNotNone(result)
self.assertEqual(result.name, self.event_hub_name)
self.assertEqual(result.message_retention_in_days,
hub.message_retention_in_days)
def test_update_event_hub_with_authorization(self):
# Arrange
self._create_event_hub(self.event_hub_name)
# Act
hub = EventHub()
hub.authorization_rules.append(
AuthorizationRule(
claim_type='SharedAccessKey',
claim_value='None',
rights=['Manage', 'Send', 'Listen'],
key_name='Key1',
primary_key='Wli4rewPGuEsLam95nQEwGR+e8b+ynlupZQ7VfjbQnw=',
secondary_key='jS+lERPBmbBVGJ5JzIwVRtSGYoFUeunRoADNTjwU3jU=',
)
)
result = self.sbs.update_event_hub(self.event_hub_name, hub)
# Assert