clear-skies-aws 1.9.3__tar.gz → 1.9.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/PKG-INFO +2 -4
  2. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/pyproject.toml +2 -2
  3. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/actions/__init__.py +2 -0
  4. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/actions/sqs.py +22 -5
  5. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/actions/sqs_test.py +52 -0
  6. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/LICENSE +0 -0
  7. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/README.md +0 -0
  8. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/__init__.py +0 -0
  9. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/actions/action_aws.py +0 -0
  10. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/actions/assume_role.py +0 -0
  11. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/actions/assume_role_test.py +0 -0
  12. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/actions/ses.py +0 -0
  13. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/actions/ses_test.py +0 -0
  14. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/actions/sns.py +0 -0
  15. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/actions/sns_test.py +0 -0
  16. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/actions/step_function.py +0 -0
  17. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/actions/step_function_test.py +0 -0
  18. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/backends/__init__.py +0 -0
  19. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/backends/dynamo_db_backend.py +0 -0
  20. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/backends/dynamo_db_backend_test.py +0 -0
  21. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/backends/sqs_backend.py +0 -0
  22. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/backends/sqs_backend_test.py +0 -0
  23. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/contexts/__init__.py +0 -0
  24. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/contexts/__pycache__/aws_http_api_gateway.cpython-38.pyc +0 -0
  25. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/contexts/__pycache__/aws_lambda_api_gateway.cpython-38.pyc +0 -0
  26. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/contexts/__pycache__/aws_lambda_elb.cpython-38.pyc +0 -0
  27. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/contexts/cli.py +0 -0
  28. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/contexts/cli_websocket_mock.py +0 -0
  29. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/contexts/lambda_api_gateway.py +0 -0
  30. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/contexts/lambda_api_gateway_web_socket.py +0 -0
  31. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/contexts/lambda_elb.py +0 -0
  32. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/contexts/lambda_http_gateway.py +0 -0
  33. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/contexts/lambda_invocation.py +0 -0
  34. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/contexts/lambda_sns.py +0 -0
  35. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/contexts/lambda_sqs_standard_partial_batch.py +0 -0
  36. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/contexts/lambda_sqs_standard_partial_batch_test.py +0 -0
  37. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/contexts/wsgi.py +0 -0
  38. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/di/__init__.py +0 -0
  39. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/di/standard_dependencies.py +0 -0
  40. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/handlers/__init__.py +0 -0
  41. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/handlers/secrets_manager_rotation.py +0 -0
  42. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/handlers/simple_body_routing.py +0 -0
  43. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/input_outputs/__init__.py +0 -0
  44. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/input_outputs/__pycache__/aws_http_api_gateway.cpython-38.pyc +0 -0
  45. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/input_outputs/__pycache__/aws_lambda_api_gateway.cpython-38.pyc +0 -0
  46. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/input_outputs/__pycache__/aws_lambda_api_gateway_test.cpython-38.pyc +0 -0
  47. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/input_outputs/__pycache__/aws_lambda_elb.cpython-38.pyc +0 -0
  48. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/input_outputs/cli_websocket_mock.py +0 -0
  49. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/input_outputs/lambda_api_gateway.py +0 -0
  50. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/input_outputs/lambda_api_gateway_test.py +0 -0
  51. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/input_outputs/lambda_api_gateway_web_socket.py +0 -0
  52. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/input_outputs/lambda_elb.py +0 -0
  53. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/input_outputs/lambda_http_gateway.py +0 -0
  54. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/input_outputs/lambda_invocation.py +0 -0
  55. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/input_outputs/lambda_sns.py +0 -0
  56. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/input_outputs/lambda_sqs_standard.py +0 -0
  57. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/mocks/__init__.py +0 -0
  58. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/mocks/actions/__init__.py +0 -0
  59. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/mocks/actions/ses.py +0 -0
  60. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/mocks/actions/sns.py +0 -0
  61. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/mocks/actions/sqs.py +0 -0
  62. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/mocks/actions/step_function.py +0 -0
  63. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/secrets/__init__.py +0 -0
  64. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/secrets/additional_configs/__init__.py +0 -0
  65. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/secrets/additional_configs/iam_db_auth.py +0 -0
  66. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/secrets/additional_configs/iam_db_auth_with_ssm.py +0 -0
  67. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/secrets/additional_configs/mysql_connection_dynamic_producer_via_ssh_cert_bastion.py +0 -0
  68. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/secrets/additional_configs/mysql_connection_dynamic_producer_via_ssm_bastion.py +0 -0
  69. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/secrets/akeyless_with_ssm_cache.py +0 -0
  70. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/secrets/parameter_store.py +0 -0
  71. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/secrets/parameter_store_test.py +0 -0
  72. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/secrets/secrets_manager.py +0 -0
  73. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/secrets/secrets_manager_test.py +0 -0
  74. {clear_skies_aws-1.9.3 → clear_skies_aws-1.9.5}/src/clearskies_aws/web_socket_connection_model.py +0 -0
@@ -1,16 +1,14 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: clear-skies-aws
3
- Version: 1.9.3
3
+ Version: 1.9.5
4
4
  Summary: clearskies bindings for working in AWS
5
5
  Home-page: https://github.com/cmancone/clearskies-aws
6
6
  License: MIT
7
7
  Author: Conor Mancone
8
8
  Author-email: cmancone@gmail.com
9
- Requires-Python: >=3.8,<4.0
9
+ Requires-Python: >=3.10,<4.0
10
10
  Classifier: License :: OSI Approved :: MIT License
11
11
  Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.8
13
- Classifier: Programming Language :: Python :: 3.9
14
12
  Classifier: Programming Language :: Python :: 3.10
15
13
  Classifier: Programming Language :: Python :: 3.11
16
14
  Provides-Extra: akeyless
@@ -2,7 +2,7 @@
2
2
 
3
3
  [tool.poetry]
4
4
  name = "clear-skies-aws"
5
- version = "1.9.3"
5
+ version = "1.9.5"
6
6
  description = "clearskies bindings for working in AWS"
7
7
  authors = [
8
8
  "Conor Mancone <cmancone@gmail.com>",
@@ -16,7 +16,7 @@ packages = [
16
16
  ]
17
17
 
18
18
  [tool.poetry.dependencies]
19
- python = "^3.8"
19
+ python = "^3.10"
20
20
  clear-skies = "^1.14.4"
21
21
  boto3 = "^1.26.148"
22
22
 
@@ -60,6 +60,7 @@ def sqs(
60
60
  message_callable=None,
61
61
  when=None,
62
62
  assume_role=None,
63
+ message_group_id=None,
63
64
  ):
64
65
  return clearskies.BindingConfig(
65
66
  SQS,
@@ -69,6 +70,7 @@ def sqs(
69
70
  message_callable=message_callable,
70
71
  when=when,
71
72
  assume_role=assume_role,
73
+ message_group_id=message_group_id,
72
74
  )
73
75
  def step_function(
74
76
  arn: str = "",
@@ -8,7 +8,7 @@ from clearskies.model import Model
8
8
  from collections.abc import Sequence
9
9
  from collections import OrderedDict
10
10
  from types import ModuleType
11
- from typing import List, Optional, Callable
11
+ from typing import List, Optional, Callable, Union
12
12
 
13
13
  from ..di import StandardDependencies
14
14
  from . import assume_role
@@ -28,12 +28,14 @@ class SQS(ActionAws):
28
28
  message_callable: Optional[Callable] = None,
29
29
  when: Optional[Callable] = None,
30
30
  assume_role: Optional[assume_role.AssumeRole] = None,
31
+ message_group_id: Optional[Union[str, Callable]] = None,
31
32
  ) -> None:
32
33
  super().configure(message_callable=message_callable, when=when, assume_role=assume_role)
33
34
 
34
35
  self.queue_url = queue_url
35
36
  self.queue_url_environment_key = queue_url_environment_key
36
37
  self.queue_url_callable = queue_url_callable
38
+ self.message_group_id = message_group_id
37
39
 
38
40
  queue_urls = 0
39
41
  for value in [queue_url, queue_url_environment_key, queue_url_callable]:
@@ -47,13 +49,28 @@ class SQS(ActionAws):
47
49
  raise ValueError(
48
50
  "You must provide at least one of 'queue_url', 'queue_url_environment_key', or 'queue_url_callable'."
49
51
  )
52
+ if message_group_id and not callable(message_group_id) and not isinstance(message_group_id, str):
53
+ raise ValueError(
54
+ "If provided, 'message_group_id' must be a string or callable, but the provided value was neither."
55
+ )
50
56
 
51
57
  def _execute_action(self, client: ModuleType, model: Model) -> None:
52
58
  """Send a notification as configured."""
53
- client.send_message(
54
- QueueUrl=self.get_queue_url(model),
55
- MessageBody=self.get_message_body(model),
56
- )
59
+ params = {
60
+ "QueueUrl": self.get_queue_url(model),
61
+ "MessageBody": self.get_message_body(model),
62
+ }
63
+
64
+ if self.message_group_id:
65
+ if callable(self.message_group_id):
66
+ message_group_id = self.di.call_function(self.message_group_id, model=model)
67
+ if not isinstance(message_group_id, str):
68
+ raise ValueError(f"I called the message_group_id function for SQS for model '{model.__class__.__name__}' but the value it returned was not a string. The message group id must be a string.")
69
+ else:
70
+ message_group_id = self.message_group_id
71
+ params["MessageGroupId"] = message_group_id
72
+
73
+ client.send_message(**params)
57
74
 
58
75
  def get_queue_url(self, model: Model):
59
76
  if self.queue_url:
@@ -59,6 +59,58 @@ class SQSTest(unittest.TestCase):
59
59
  ])
60
60
  self.assertEqual(id(user), id(self.when))
61
61
 
62
+ def test_send_message_group_id(self):
63
+ sqs = SQS(self.environment, self.boto3, self.di)
64
+ sqs.configure(
65
+ queue_url='https://queue.example.com',
66
+ when=self.always,
67
+ message_group_id='heysup',
68
+ )
69
+ user = self.users.model({
70
+ "id": "1-2-3-4",
71
+ "name": "Jane",
72
+ "email": "jane@example.com",
73
+ })
74
+ sqs(user)
75
+ self.sqs.send_message.assert_has_calls([
76
+ call(
77
+ QueueUrl='https://queue.example.com',
78
+ MessageGroupId='heysup',
79
+ MessageBody=json.dumps({
80
+ "id": "1-2-3-4",
81
+ "name": "Jane",
82
+ "email": "jane@example.com",
83
+ }),
84
+ ),
85
+ ])
86
+ self.assertEqual(id(user), id(self.when))
87
+
88
+ def test_send_message_group_id_callable(self):
89
+ sqs = SQS(self.environment, self.boto3, self.di)
90
+ sqs.configure(
91
+ queue_url='https://queue.example.com',
92
+ when=self.always,
93
+ message_group_id=lambda model: model.id,
94
+ )
95
+ user = self.users.model({
96
+ "id": "1-2-3-4",
97
+ "name": "Jane",
98
+ "email": "jane@example.com",
99
+ })
100
+ sqs(user)
101
+ self.sqs.send_message.assert_has_calls([
102
+ call(
103
+ QueueUrl='https://queue.example.com',
104
+ MessageGroupId='1-2-3-4',
105
+ MessageBody=json.dumps({
106
+ "id": "1-2-3-4",
107
+ "name": "Jane",
108
+ "email": "jane@example.com",
109
+ }),
110
+ ),
111
+ ])
112
+ self.assertEqual(id(user), id(self.when))
113
+
62
114
  def test_not_now(self):
63
115
  sqs = SQS(self.environment, self.boto3, self.di)
64
116
  sqs.configure(
File without changes