diff --git a/plugins/modules/azure_rm_servicebusqueue.py b/plugins/modules/azure_rm_servicebusqueue.py index f50693cf3..edb810374 100644 --- a/plugins/modules/azure_rm_servicebusqueue.py +++ b/plugins/modules/azure_rm_servicebusqueue.py @@ -82,6 +82,11 @@ - The maximum delivery count. - A message is automatically deadlettered after this number of deliveries. type: int + max_message_size_in_kb: + description: + - Maximum size (in KB) of the message payload that can be accepted by the queue. + - This property is only used in Premium today and default is 1024. + type: int max_size_in_mb: description: - The maximum size of the queue in megabytes, which is the size of memory allocated for the queue. @@ -178,6 +183,7 @@ def __init__(self): forward_to=dict(type='str'), lock_duration_in_seconds=dict(type='int'), max_delivery_count=dict(type='int'), + max_message_size_in_kb=dict(type='int'), max_size_in_mb=dict(type='int'), requires_duplicate_detection=dict(type='bool'), requires_session=dict(type='bool'), @@ -206,6 +212,7 @@ def __init__(self): self.requires_duplicate_detection = None self.status = None self.requires_session = None + self.max_message_size_in_kb = None self.results = dict( changed=False, @@ -234,6 +241,7 @@ def exec_module(self, **kwargs): forward_dead_lettered_messages_to=self.forward_dead_lettered_messages_to, forward_to=self.forward_to, max_delivery_count=self.max_delivery_count, + max_message_size_in_kilobytes=self.max_message_size_in_kb, max_size_in_megabytes=self.max_size_in_mb, requires_session=self.requires_session, requires_duplicate_detection=self.requires_duplicate_detection @@ -270,6 +278,7 @@ def exec_module(self, **kwargs): return self.results def create_or_update(self, param): + try: client = self._get_client() return client.create_or_update(self.resource_group, self.namespace, self.name, param) @@ -317,6 +326,8 @@ def to_dict(self, instance): result[attribute] = to_native(value) elif attribute == 'max_size_in_megabytes': result['max_size_in_mb'] = value + elif attribute == 'max_size_in_kilobytes': + result['max_size_in_kb'] = value else: result[attribute] = value return result diff --git a/plugins/modules/azure_rm_servicebustopic.py b/plugins/modules/azure_rm_servicebustopic.py index 8d81d0f22..c2eb25e86 100644 --- a/plugins/modules/azure_rm_servicebustopic.py +++ b/plugins/modules/azure_rm_servicebustopic.py @@ -61,6 +61,11 @@ description: - A value that indicates whether the topic is to be partitioned across multiple message brokers. type: bool + max_message_size_in_kb: + description: + - Maximum size (in KB) of the message payload that can be accepted by the queue. + - This property is only used in Premium today and default is 1024. + type: int max_size_in_mb: description: - The maximum size of the topic in megabytes, which is the size of memory allocated for the topic. @@ -149,6 +154,7 @@ def __init__(self): enable_express=dict(type='bool'), enable_partitioning=dict(type='bool'), max_size_in_mb=dict(type='int'), + max_message_size_in_kb=dict(type='int'), name=dict(type='str', required=True), namespace=dict(type='str'), requires_duplicate_detection=dict(type='bool'), @@ -172,6 +178,7 @@ def __init__(self): self.requires_duplicate_detection = None self.status = None self.support_ordering = None + self.max_message_size_in_kb = None self.results = dict( changed=False, @@ -196,6 +203,7 @@ def exec_module(self, **kwargs): enable_express=self.enable_express, enable_partitioning=self.enable_partitioning, max_size_in_megabytes=self.max_size_in_mb, + max_message_size_in_kilobytes=self.max_message_size_in_kb, support_ordering=self.support_ordering ) if self.status: @@ -277,6 +285,8 @@ def to_dict(self, instance): result[attribute] = to_native(value) elif attribute == 'max_size_in_megabytes': result['max_size_in_mb'] = value + elif attribute == 'max_message_size_in_kilobyte': + result['max_message_size_in_kb'] = value else: result[attribute] = value return result diff --git a/tests/integration/targets/azure_rm_servicebus/tasks/main.yml b/tests/integration/targets/azure_rm_servicebus/tasks/main.yml index 11c2208aa..1bc4c11f9 100644 --- a/tests/integration/targets/azure_rm_servicebus/tasks/main.yml +++ b/tests/integration/targets/azure_rm_servicebus/tasks/main.yml @@ -7,6 +7,7 @@ azure_rm_servicebus: name: "ns{{ rpfx }}" resource_group: "{{ resource_group }}" + sku: premium tags: key1: value1 register: namespace @@ -32,6 +33,8 @@ name: "queue{{ rpfx }}" namespace: "ns{{ rpfx }}" resource_group: "{{ resource_group }}" + max_message_size_in_kb: 2048 + max_size_in_mb: 2048 register: queue - assert: @@ -45,6 +48,8 @@ resource_group: "{{ resource_group }}" namespace: "ns{{ rpfx }}" duplicate_detection_time_in_seconds: 600 + max_message_size_in_kb: 2048 + max_size_in_mb: 2048 check_mode: yes register: output @@ -58,6 +63,8 @@ resource_group: "{{ resource_group }}" namespace: "ns{{ rpfx }}" duplicate_detection_time_in_seconds: 600 + max_message_size_in_kb: 2048 + max_size_in_mb: 2048 register: output - assert: @@ -72,6 +79,8 @@ resource_group: "{{ resource_group }}" namespace: "ns{{ rpfx }}" duplicate_detection_time_in_seconds: 600 + max_message_size_in_kb: 2048 + max_size_in_mb: 2048 register: output - assert: