airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [airflow] shaikshakeel commented on a change in pull request #5694: [AIRFLOW-5082] add subject in aws sns hook
Date Tue, 29 Oct 2019 19:21:37 GMT
shaikshakeel commented on a change in pull request #5694: [AIRFLOW-5082] add subject in aws
sns hook
URL: https://github.com/apache/airflow/pull/5694#discussion_r340278526
 
 

 ##########
 File path: airflow/contrib/hooks/aws_sns_hook.py
 ##########
 @@ -53,8 +55,16 @@ def publish_to_target(self, target_arn, message):
             'default': message
         }
 
+        if subject is None:
 
 Review comment:
   @mik-laj  we need if condition because. boto3 is throwing an error when you call publish_to_target
method with subject as None. 
   
   Error message from boto3:
   ```
   botocore.exceptions.ParamValidationError: Parameter validation failed:
   ```
   
   Because boto3 expects the subject to be a string. not None.  To handle this case I added
if condition. 
   
   Example: 
   1. when you want to send SNS notification with the subject 
   ```
   AwsSnsHook().publish_to_target(target_arn='arn', message='test', subject='subject')
   ```
   2. when you want to send SNS notification witout subject (AWS will allocate default subject)
   ```
   AwsSnsHook().publish_to_target(target_arn='arn', message='test')
   ```
   
   Sorry, my understanding was wrong from your comment. 
   
   Let me know if you have any thoughts!

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message