clear-skies-aws 1.9.0__tar.gz → 1.9.2__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 (71) hide show
  1. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/PKG-INFO +1 -1
  2. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/pyproject.toml +4 -4
  3. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/actions/ses.py +15 -4
  4. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/actions/ses_test.py +39 -0
  5. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/LICENSE +0 -0
  6. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/README.md +0 -0
  7. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/__init__.py +0 -0
  8. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/actions/__init__.py +0 -0
  9. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/actions/action_aws.py +0 -0
  10. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/actions/assume_role.py +0 -0
  11. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/actions/assume_role_test.py +0 -0
  12. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/actions/sns.py +0 -0
  13. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/actions/sns_test.py +0 -0
  14. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/actions/sqs.py +0 -0
  15. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/actions/sqs_test.py +0 -0
  16. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/actions/step_function.py +0 -0
  17. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/actions/step_function_test.py +0 -0
  18. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/backends/__init__.py +0 -0
  19. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/backends/dynamo_db_backend.py +0 -0
  20. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/backends/dynamo_db_backend_test.py +0 -0
  21. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/backends/sqs_backend.py +0 -0
  22. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/backends/sqs_backend_test.py +0 -0
  23. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/contexts/__init__.py +0 -0
  24. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/contexts/__pycache__/aws_http_api_gateway.cpython-38.pyc +0 -0
  25. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/contexts/__pycache__/aws_lambda_api_gateway.cpython-38.pyc +0 -0
  26. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/contexts/__pycache__/aws_lambda_elb.cpython-38.pyc +0 -0
  27. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/contexts/cli.py +0 -0
  28. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/contexts/cli_websocket_mock.py +0 -0
  29. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/contexts/lambda_api_gateway.py +0 -0
  30. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/contexts/lambda_api_gateway_web_socket.py +0 -0
  31. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/contexts/lambda_elb.py +0 -0
  32. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/contexts/lambda_http_gateway.py +0 -0
  33. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/contexts/lambda_invocation.py +0 -0
  34. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/contexts/lambda_sns.py +0 -0
  35. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/contexts/lambda_sqs_standard_partial_batch.py +0 -0
  36. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/contexts/lambda_sqs_standard_partial_batch_test.py +0 -0
  37. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/contexts/wsgi.py +0 -0
  38. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/di/__init__.py +0 -0
  39. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/di/standard_dependencies.py +0 -0
  40. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/handlers/__init__.py +0 -0
  41. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/handlers/secrets_manager_rotation.py +0 -0
  42. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/handlers/simple_body_routing.py +0 -0
  43. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/input_outputs/__init__.py +0 -0
  44. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/input_outputs/__pycache__/aws_http_api_gateway.cpython-38.pyc +0 -0
  45. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/input_outputs/__pycache__/aws_lambda_api_gateway.cpython-38.pyc +0 -0
  46. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/input_outputs/__pycache__/aws_lambda_api_gateway_test.cpython-38.pyc +0 -0
  47. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/input_outputs/__pycache__/aws_lambda_elb.cpython-38.pyc +0 -0
  48. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/input_outputs/cli_websocket_mock.py +0 -0
  49. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/input_outputs/lambda_api_gateway.py +0 -0
  50. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/input_outputs/lambda_api_gateway_test.py +0 -0
  51. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/input_outputs/lambda_api_gateway_web_socket.py +0 -0
  52. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/input_outputs/lambda_elb.py +0 -0
  53. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/input_outputs/lambda_http_gateway.py +0 -0
  54. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/input_outputs/lambda_invocation.py +0 -0
  55. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/input_outputs/lambda_sns.py +0 -0
  56. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/input_outputs/lambda_sqs_standard.py +0 -0
  57. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/mocks/__init__.py +0 -0
  58. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/mocks/actions/__init__.py +0 -0
  59. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/mocks/actions/ses.py +0 -0
  60. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/secrets/__init__.py +0 -0
  61. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/secrets/additional_configs/__init__.py +0 -0
  62. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/secrets/additional_configs/iam_db_auth.py +0 -0
  63. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/secrets/additional_configs/iam_db_auth_with_ssm.py +0 -0
  64. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/secrets/additional_configs/mysql_connection_dynamic_producer_via_ssh_cert_bastion.py +0 -0
  65. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/secrets/additional_configs/mysql_connection_dynamic_producer_via_ssm_bastion.py +0 -0
  66. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/secrets/akeyless_with_ssm_cache.py +0 -0
  67. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/secrets/parameter_store.py +0 -0
  68. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/secrets/parameter_store_test.py +0 -0
  69. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/secrets/secrets_manager.py +0 -0
  70. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/secrets/secrets_manager_test.py +0 -0
  71. {clear_skies_aws-1.9.0 → clear_skies_aws-1.9.2}/src/clearskies_aws/web_socket_connection_model.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: clear-skies-aws
3
- Version: 1.9.0
3
+ Version: 1.9.2
4
4
  Summary: clearskies bindings for working in AWS
5
5
  Home-page: https://github.com/cmancone/clearskies-aws
6
6
  License: MIT
@@ -2,7 +2,7 @@
2
2
 
3
3
  [tool.poetry]
4
4
  name = "clear-skies-aws"
5
- version = "1.9.0"
5
+ version = "1.9.2"
6
6
  description = "clearskies bindings for working in AWS"
7
7
  authors = [
8
8
  "Conor Mancone <cmancone@gmail.com>",
@@ -26,9 +26,9 @@ priority = "primary"
26
26
 
27
27
  [tool.poetry.group.dev.dependencies]
28
28
  pre-commit = "^3.2.2"
29
- akeyless = "^3.3.6"
30
- akeyless-cloud-id = "^0.2.0"
31
- jinja2 = "^3.1.2"
29
+ jinja2 = {version = "^3.1.2", optional = true}
30
+ akeyless = {version = "^4.0.0", optional = true}
31
+ akeyless-cloud-id = {version = "^0.2.3", optional = true}
32
32
 
33
33
  [tool.poetry.extras]
34
34
  akeyless = ["akeyless-cloud-id", "akeyless"]
@@ -22,9 +22,9 @@ class SES(ActionAws):
22
22
  def configure(
23
23
  self,
24
24
  sender,
25
- to: Optional[Union[list, str]] = None,
26
- cc: Optional[Union[list, str]] = None,
27
- bcc: Optional[Union[list, str]] = None,
25
+ to: Optional[Union[list, str, Callable]] = None,
26
+ cc: Optional[Union[list, str, Callable]] = None,
27
+ bcc: Optional[Union[list, str, Callable]] = None,
28
28
  subject: Optional[str] = None,
29
29
  message: Optional[str] = None,
30
30
  subject_template: Optional[str] = None,
@@ -48,7 +48,7 @@ class SES(ActionAws):
48
48
  destination_values = locals()[key]
49
49
  if not destination_values:
50
50
  continue
51
- if type(destination_values) == str:
51
+ if type(destination_values) == str or callable(destination_values):
52
52
  self.destinations[key] = [destination_values]
53
53
  else:
54
54
  self.destinations[key] = destination_values
@@ -136,6 +136,17 @@ class SES(ActionAws):
136
136
  resolved = []
137
137
  destinations = self.destinations[name]
138
138
  for destination in destinations:
139
+ if callable(destination):
140
+ more = self.di.call_function(destination, model=model)
141
+ if not isinstance(more, list):
142
+ more = [more]
143
+ for entry in more:
144
+ if not isinstance(entry, str):
145
+ raise ValueError(f"I invoked a callable to fetch the '{name}' addresses for model '{model.__class__.__name__}' but it returned something other than a string. Callables must return a valid email address or a list of email addresses.")
146
+ if "@" not in entry:
147
+ raise ValueError(f"I invoked a callable to fetch the '{name}' addresses for model '{model.__class__.__name__}' but it returned a non-email address. Callables must return a valid email address or a list of email addresses.")
148
+ resolved.extend(more)
149
+ continue
139
150
  if "@" in destination:
140
151
  resolved.append(destination)
141
152
  continue
@@ -48,3 +48,42 @@ class SESTest(unittest.TestCase):
48
48
  Source='test@example.com'
49
49
  ),
50
50
  ])
51
+
52
+ def test_send_callable(self):
53
+ ses = SES(self.environment, self.boto3, self.di)
54
+ ses.configure(
55
+ 'test@example.com',
56
+ to=lambda model: 'jane@example.com',
57
+ bcc=lambda model: ['bob@example.com', 'greg@example.com'],
58
+ subject='welcome!',
59
+ message_template='hi {{ model.id }}!'
60
+ )
61
+ model = MagicMock()
62
+ model.id = 'asdf'
63
+ ses(model)
64
+ self.ses.send_email.assert_has_calls([
65
+ call(
66
+ Destination={
67
+ 'ToAddresses': ['jane@example.com'],
68
+ 'CcAddresses': [],
69
+ 'BccAddresses': ['bob@example.com', 'greg@example.com']
70
+ },
71
+ Message={
72
+ 'Body': {
73
+ 'Html': {
74
+ 'Charset': 'utf-8',
75
+ 'Data': 'hi asdf!'
76
+ },
77
+ 'Text': {
78
+ 'Charset': 'utf-8',
79
+ 'Data': 'hi asdf!'
80
+ }
81
+ },
82
+ 'Subject': {
83
+ 'Charset': 'utf-8',
84
+ 'Data': 'welcome!'
85
+ }
86
+ },
87
+ Source='test@example.com'
88
+ ),
89
+ ])
File without changes