Fokko commented on a change in pull request #4887: [AIRFLOW-4055] Add AWS SQS Sensor URL: https://github.com/apache/airflow/pull/4887#discussion_r274771356
########## File path: airflow/contrib/hooks/aws_sqs_hook.py ########## @@ -0,0 +1,72 @@ +# -*- coding: utf-8 -*- +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +from airflow.contrib.hooks.aws_hook import AwsHook + + +class SQSHook(AwsHook): + """ + Get the SQS client using boto3 library + :return: SQS client + :rtype: botocore.client.SQS + """ + + def get_conn(self): + return self.get_client_type('sqs') + + """ + Create queue using connection object + :param name: name of the queue. + :type name: str + :param attributes: additional attributes for the queue + :type attributes: dict + + For details of the attributes parameter see :py:meth:`botocore.client.SQS.create_queue` + + :return: dict with the information about the queue + :rtype: dict + + For details of the returned value see :py:meth:`botocore.client.SQS.create_queue` + """ + def create_queue(self, queue_name, attributes={}): + return self.get_conn().create_queue(QueueName=queue_name, Attributes=attributes) + + """ + Send message to the queue + :param queue_url: queue url + :type name: str Review comment: ```suggestion :type queue_url: str ``` ---------------------------------------------------------------- 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: [email protected] With regards, Apache Git Services
