abaruni 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_r144407283
 
 

 ##########
 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:
   we will likely add flags in the future to adjust what is returned. 
@csantanapr wants to get this initial work out before focusing on that as this 
is highly desirable
 
----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to