Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add max_message_size_in_kilobytes to azure_rm_servicebusqueue.py #1092

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions plugins/modules/azure_rm_servicebusqueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -179,6 +184,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'),
Expand Down Expand Up @@ -207,6 +213,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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions plugins/modules/azure_rm_servicebustopic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -150,6 +155,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'),
Expand All @@ -173,6 +179,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,
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion tests/integration/targets/azure_rm_servicebus/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
azure_rm_servicebus:
name: "ns{{ rpfx }}"
resource_group: "{{ resource_group }}"
sku: premium
register: namespace

- assert:
Expand All @@ -29,6 +30,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:
Expand All @@ -42,6 +45,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

Expand All @@ -55,6 +60,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:
Expand All @@ -69,6 +76,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:
Expand Down Expand Up @@ -166,4 +175,4 @@
azure_rm_servicebus:
name: "ns{{ rpfx }}"
resource_group: "{{ resource_group }}"
state: absent
state: absent