dubeejw commented on a change in pull request #217: Add ability to get trigger 
configuration and status
URL: 
https://github.com/apache/incubator-openwhisk-package-kafka/pull/217#discussion_r144566377
 
 

 ##########
 File path: action/kafkaFeedWeb.js
 ##########
 @@ -61,6 +61,35 @@ function main(params) {
 
                     resolve(common.webResponse(statusCode, body));
                 });
+        } else if (params.__ow_method === "get") {
+            const triggerURL = common.getTriggerURL(params.authKey, 
params.endpoint, params.triggerName);
+
+            return common.verifyTriggerAuth(triggerURL)
+                .then(() => {
+                    db = new Database(params.DB_URL, params.DB_NAME);
+                    return db.getTrigger(params.triggerName);
+                })
+                .then((triggerDoc) => {
+                    var body = {
+                        config: {
+                            triggerName: triggerDoc.triggerName,
+                            topic: triggerDoc.topic,
+                            isJSONData: triggerDoc.isJSONData,
+                            isBinaryValue: triggerDoc.isBinaryValue,
+                            isBinaryKey: triggerDoc.isBinaryKey,
+                            isMessageHub: triggerDoc.isMessageHub,
+                            brokers: triggerDoc.brokers,
+                            kafka_admin_url: triggerDoc.kafka_admin_url,
+                            username: triggerDoc.username,
+                            password: triggerDoc.password
 
 Review comment:
   The code is not entirely duplicated. messageHubFeedWeb.js has a different 
method to validate parameters. Most of the shared code there is separated out 
into functions that is shared amongst the new files.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to