Re: [PR] NIFI-12331: add new unified PublishSlack Processor [nifi]
exceptionfactory commented on PR #8047: URL: https://github.com/apache/nifi/pull/8047#issuecomment-1839995418 Thanks for your work on this new Processor @sporadek, it provided helpful background for subsequent follow-on work in PR #8120. Thanks for the review as well @krisztina-zsihovszki. The other pull request is close to completion, so I am closing this PR in favor of the others. -- 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. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-12331: add new unified PublishSlack Processor [nifi]
exceptionfactory closed pull request #8047: NIFI-12331: add new unified PublishSlack Processor URL: https://github.com/apache/nifi/pull/8047 -- 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. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] NIFI-12331: add new unified PublishSlack Processor [nifi]
krisztina-zsihovszki commented on code in PR #8047: URL: https://github.com/apache/nifi/pull/8047#discussion_r1414309808 ## nifi-nar-bundles/nifi-slack-bundle/nifi-slack-processors/src/main/java/org/apache/nifi/processors/slack/PublishSlack.java: ## @@ -0,0 +1,516 @@ +/* + * 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. + */ +package org.apache.nifi.processors.slack; + +import com.slack.api.bolt.App; +import com.slack.api.bolt.AppConfig; +import com.slack.api.methods.MethodsClient; +import com.slack.api.methods.SlackApiException; +import com.slack.api.methods.SlackFilesUploadV2Exception; +import com.slack.api.methods.request.chat.ChatPostMessageRequest; +import com.slack.api.methods.request.conversations.ConversationsListRequest; +import com.slack.api.methods.request.files.FilesUploadV2Request; +import com.slack.api.methods.response.chat.ChatPostMessageResponse; +import com.slack.api.methods.response.conversations.ConversationsListResponse; +import com.slack.api.methods.response.files.FilesUploadV2Response; +import com.slack.api.model.Conversation; +import com.slack.api.model.File; +import org.apache.nifi.annotation.behavior.DynamicProperty; +import org.apache.nifi.annotation.behavior.InputRequirement; +import org.apache.nifi.annotation.behavior.WritesAttribute; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.annotation.lifecycle.OnScheduled; +import org.apache.nifi.components.AllowableValue; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.ValidationContext; +import org.apache.nifi.components.ValidationResult; +import org.apache.nifi.components.Validator; +import org.apache.nifi.expression.AttributeExpression; +import org.apache.nifi.expression.ExpressionLanguageScope; +import org.apache.nifi.flowfile.FlowFile; +import org.apache.nifi.flowfile.attributes.CoreAttributes; +import org.apache.nifi.processor.AbstractProcessor; +import org.apache.nifi.processor.ProcessContext; +import org.apache.nifi.processor.ProcessSession; +import org.apache.nifi.processor.Relationship; +import org.apache.nifi.processor.exception.ProcessException; +import org.apache.nifi.processor.util.StandardValidators; +import org.apache.nifi.processors.slack.consume.ConsumeSlackUtil; +import org.apache.nifi.processors.slack.publish.ContentMessageStrategy; +import org.apache.nifi.processors.slack.publish.MessageOnlyStrategy; +import org.apache.nifi.processors.slack.publish.PublishConfig; +import org.apache.nifi.processors.slack.publish.PublishSlackClient; +import org.apache.nifi.processors.slack.publish.PublishStrategy; +import org.apache.nifi.processors.slack.publish.UploadAttachmentStrategy; +import org.apache.nifi.processors.slack.publish.UploadLinkStrategy; +import org.apache.nifi.processors.slack.publish.UploadOnlyStrategy; + +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Set; +import java.util.SortedSet; +import java.util.TreeSet; + +import static org.apache.nifi.util.StringUtils.isEmpty; + + +@Tags({"slack", "publish", "notify", "upload", "message"}) +@CapabilityDescription("Uploads the FlowFile content (e.g. an image) as a file, and/or Sends a message on Slack. The FlowFile content can be used as the message text or attached to the message.") +@InputRequirement(InputRequirement.Requirement.INPUT_REQUIRED) +@DynamicProperty(name = "", value = "JSON snippet specifying a Slack message \"attachment\"", +description = "The property value will be converted to JSON and will be added to the array of attachments in the JSON payload being sent to Slack." + +" The property name will not be used by the processor.", +expressionLanguageScope = ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) +@WritesAttribute(attribute="slack.file.url", description = "The Slack URL of the uploaded file. It will be added if 'Upload FlowFile' has been set to 'Yes'.") +public class PublishSlack extends AbstractProcessor { + +private static final String UPLOAD_ONLY = "upload-only";
Re: [PR] NIFI-12331: add new unified PublishSlack Processor [nifi]
markap14 commented on code in PR #8047: URL: https://github.com/apache/nifi/pull/8047#discussion_r1408428736 ## nifi-nar-bundles/nifi-slack-bundle/nifi-slack-processors/src/main/java/org/apache/nifi/processors/slack/PublishSlack.java: ## @@ -0,0 +1,516 @@ +/* + * 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. + */ +package org.apache.nifi.processors.slack; + +import com.slack.api.bolt.App; +import com.slack.api.bolt.AppConfig; +import com.slack.api.methods.MethodsClient; +import com.slack.api.methods.SlackApiException; +import com.slack.api.methods.SlackFilesUploadV2Exception; +import com.slack.api.methods.request.chat.ChatPostMessageRequest; +import com.slack.api.methods.request.conversations.ConversationsListRequest; +import com.slack.api.methods.request.files.FilesUploadV2Request; +import com.slack.api.methods.response.chat.ChatPostMessageResponse; +import com.slack.api.methods.response.conversations.ConversationsListResponse; +import com.slack.api.methods.response.files.FilesUploadV2Response; +import com.slack.api.model.Conversation; +import com.slack.api.model.File; +import org.apache.nifi.annotation.behavior.DynamicProperty; +import org.apache.nifi.annotation.behavior.InputRequirement; +import org.apache.nifi.annotation.behavior.WritesAttribute; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.annotation.lifecycle.OnScheduled; +import org.apache.nifi.components.AllowableValue; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.ValidationContext; +import org.apache.nifi.components.ValidationResult; +import org.apache.nifi.components.Validator; +import org.apache.nifi.expression.AttributeExpression; +import org.apache.nifi.expression.ExpressionLanguageScope; +import org.apache.nifi.flowfile.FlowFile; +import org.apache.nifi.flowfile.attributes.CoreAttributes; +import org.apache.nifi.processor.AbstractProcessor; +import org.apache.nifi.processor.ProcessContext; +import org.apache.nifi.processor.ProcessSession; +import org.apache.nifi.processor.Relationship; +import org.apache.nifi.processor.exception.ProcessException; +import org.apache.nifi.processor.util.StandardValidators; +import org.apache.nifi.processors.slack.consume.ConsumeSlackUtil; +import org.apache.nifi.processors.slack.publish.ContentMessageStrategy; +import org.apache.nifi.processors.slack.publish.MessageOnlyStrategy; +import org.apache.nifi.processors.slack.publish.PublishConfig; +import org.apache.nifi.processors.slack.publish.PublishSlackClient; +import org.apache.nifi.processors.slack.publish.PublishStrategy; +import org.apache.nifi.processors.slack.publish.UploadAttachmentStrategy; +import org.apache.nifi.processors.slack.publish.UploadLinkStrategy; +import org.apache.nifi.processors.slack.publish.UploadOnlyStrategy; + +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Set; +import java.util.SortedSet; +import java.util.TreeSet; + +import static org.apache.nifi.util.StringUtils.isEmpty; + + +@Tags({"slack", "publish", "notify", "upload", "message"}) +@CapabilityDescription("Uploads the FlowFile content (e.g. an image) as a file, and/or Sends a message on Slack. The FlowFile content can be used as the message text or attached to the message.") +@InputRequirement(InputRequirement.Requirement.INPUT_REQUIRED) +@DynamicProperty(name = "", value = "JSON snippet specifying a Slack message \"attachment\"", +description = "The property value will be converted to JSON and will be added to the array of attachments in the JSON payload being sent to Slack." + +" The property name will not be used by the processor.", +expressionLanguageScope = ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) +@WritesAttribute(attribute="slack.file.url", description = "The Slack URL of the uploaded file. It will be added if 'Upload FlowFile' has been set to 'Yes'.") +public class PublishSlack extends AbstractProcessor { + +private static final String UPLOAD_ONLY = "upload-only"; +
[PR] NiFi-12331: add new unified PublishSlack Processor [nifi]
sporadek opened a new pull request, #8047: URL: https://github.com/apache/nifi/pull/8047 # Summary [NIFI-12331](https://issues.apache.org/jira/browse/NIFI-12331) # Tracking Please complete the following tracking steps prior to pull request creation. ### Issue Tracking - [x] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue created ### Pull Request Tracking - [x] Pull Request title starts with Apache NiFi Jira issue number, such as `NIFI-0` - [x] Pull Request commit message starts with Apache NiFi Jira issue number, as such `NIFI-0` ### Pull Request Formatting - [x] Pull Request based on current revision of the `main` branch - [x] Pull Request refers to a feature branch with one commit containing changes # Verification Please indicate the verification steps performed prior to pull request creation. ### Build - [x] Build completed using `mvn clean install -P contrib-check` - [x] JDK 21 ### Licensing No new libraries. ### Documentation - [ ] Documentation formatting appears as expected in rendered files -- 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. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org