turcsanyip commented on code in PR #7644:
URL: https://github.com/apache/nifi/pull/7644#discussion_r1330557343


##########
nifi-nar-bundles/nifi-zendesk-bundle/nifi-zendesk-common/src/main/java/org/apache/nifi/common/zendesk/ZendeskProperties.java:
##########
@@ -0,0 +1,92 @@
+/*
+ * 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.common.zendesk;
+
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.expression.ExpressionLanguageScope;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.web.client.provider.api.WebClientServiceProvider;
+
+public final class ZendeskProperties {
+
+    public static final String WEB_CLIENT_SERVICE_PROVIDER_NAME = 
"web-client-service-provider";
+    public static final String ZENDESK_SUBDOMAIN_NAME = "zendesk-subdomain";
+    public static final String ZENDESK_USER_NAME = "zendesk-user";
+    public static final String ZENDESK_AUTHENTICATION_TYPE_NAME = 
"zendesk-authentication-type-name";
+    public static final String ZENDESK_AUTHENTICATION_CREDENTIAL_NAME = 
"zendesk-authentication-value-name";
+    public static final String ZENDESK_TICKET_COMMENT_BODY_NAME = 
"zendesk-comment-body";
+    public static final String ZENDESK_TICKET_SUBJECT_NAME = "zendesk-subject";
+    public static final String ZENDESK_TICKET_PRIORITY_NAME = 
"zendesk-priority";
+    public static final String ZENDESK_TICKET_TYPE_NAME = "zendesk-type";
+    public static final String HTTPS = "https";
+    public static final String APPLICATION_JSON = "application/json";
+    public static final String ZENDESK_HOST_TEMPLATE = "%s.zendesk.com";
+    public static final String ZENDESK_CREATE_TICKET_RESOURCE = 
"/api/v2/tickets";
+    public static final String ZENDESK_CREATE_TICKETS_RESOURCE = 
"/api/v2/tickets/create_many";
+
+    public static final String ZENDESK_TICKET_ROOT_NODE = "/ticket";
+    public static final String ZENDESK_TICKETS_ROOT_NODE = "/tickets";
+
+    public static final String REL_SUCCESS_NAME = "success";
+    public static final String REL_FAILURE_NAME = "failure";
+
+    private ZendeskProperties() {}
+
+    public static final PropertyDescriptor WEB_CLIENT_SERVICE_PROVIDER = new 
PropertyDescriptor.Builder()
+            .name(WEB_CLIENT_SERVICE_PROVIDER_NAME)
+            .displayName("Web Client Service Provider")
+            .description("Controller service for HTTP client operations.")
+            .identifiesControllerService(WebClientServiceProvider.class)
+            .required(true)
+            .build();
+
+    public static final PropertyDescriptor ZENDESK_SUBDOMAIN = new 
PropertyDescriptor.Builder()
+            .name(ZENDESK_SUBDOMAIN_NAME)
+            .displayName("Zendesk Subdomain Name")

Review Comment:
   I know these are not new properties but I would suggest removing the 
"Zendesk" prefix from the display name. Typically we don't add prefix because 
the context is already given by the processor and all properties would start 
with the same tag.



##########
nifi-nar-bundles/nifi-zendesk-bundle/nifi-zendesk-processors/src/main/java/org/apache/nifi/processors/zendesk/PutZendeskTicket.java:
##########
@@ -0,0 +1,283 @@
+/*
+ * 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.zendesk;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.apache.nifi.annotation.behavior.DynamicProperty;
+import org.apache.nifi.annotation.behavior.WritesAttribute;
+import org.apache.nifi.annotation.behavior.WritesAttributes;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import 
org.apache.nifi.common.zendesk.validation.JsonPointerPropertyNameValidator;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.expression.ExpressionLanguageScope;
+import org.apache.nifi.flowfile.FlowFile;
+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.schema.access.SchemaNotFoundException;
+import org.apache.nifi.serialization.MalformedRecordException;
+import org.apache.nifi.serialization.RecordReader;
+import org.apache.nifi.serialization.RecordReaderFactory;
+import org.apache.nifi.serialization.record.Record;
+import org.apache.nifi.web.client.api.HttpResponseEntity;
+import org.apache.nifi.web.client.api.HttpUriBuilder;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import static 
org.apache.nifi.common.zendesk.ZendeskProperties.APPLICATION_JSON;
+import static 
org.apache.nifi.common.zendesk.ZendeskProperties.REL_FAILURE_NAME;
+import static 
org.apache.nifi.common.zendesk.ZendeskProperties.WEB_CLIENT_SERVICE_PROVIDER;
+import static 
org.apache.nifi.common.zendesk.ZendeskProperties.ZENDESK_AUTHENTICATION_CREDENTIAL;
+import static 
org.apache.nifi.common.zendesk.ZendeskProperties.ZENDESK_AUTHENTICATION_TYPE;
+import static 
org.apache.nifi.common.zendesk.ZendeskProperties.ZENDESK_CREATE_TICKETS_RESOURCE;
+import static 
org.apache.nifi.common.zendesk.ZendeskProperties.ZENDESK_CREATE_TICKET_RESOURCE;
+import static 
org.apache.nifi.common.zendesk.ZendeskProperties.ZENDESK_SUBDOMAIN;
+import static 
org.apache.nifi.common.zendesk.ZendeskProperties.ZENDESK_TICKET_COMMENT_BODY_NAME;
+import static 
org.apache.nifi.common.zendesk.ZendeskProperties.ZENDESK_TICKET_PRIORITY_NAME;
+import static 
org.apache.nifi.common.zendesk.ZendeskProperties.ZENDESK_TICKET_SUBJECT_NAME;
+import static 
org.apache.nifi.common.zendesk.ZendeskProperties.ZENDESK_TICKET_TYPE_NAME;
+import static org.apache.nifi.common.zendesk.ZendeskProperties.ZENDESK_USER;
+import static 
org.apache.nifi.common.zendesk.util.ZendeskRecordPathUtils.addDynamicField;
+import static 
org.apache.nifi.common.zendesk.util.ZendeskRecordPathUtils.resolveFieldValue;
+import static 
org.apache.nifi.common.zendesk.util.ZendeskUtils.createRequestObject;
+import static 
org.apache.nifi.common.zendesk.util.ZendeskUtils.getDynamicProperties;
+import static org.apache.nifi.common.zendesk.util.ZendeskUtils.getResponseBody;
+import static 
org.apache.nifi.expression.ExpressionLanguageScope.FLOWFILE_ATTRIBUTES;
+import static org.apache.nifi.flowfile.attributes.CoreAttributes.MIME_TYPE;
+import static 
org.apache.nifi.processors.zendesk.AbstractZendesk.RECORD_COUNT_ATTRIBUTE_NAME;
+import static 
org.apache.nifi.processors.zendesk.PutZendeskTicket.ERROR_CODE_ATTRIBUTE_NAME;
+import static 
org.apache.nifi.processors.zendesk.PutZendeskTicket.ERROR_MESSAGE_ATTRIBUTE_NAME;
+import static org.apache.nifi.web.client.api.HttpResponseStatus.CREATED;
+import static org.apache.nifi.web.client.api.HttpResponseStatus.OK;
+
+@Tags({"zendesk, ticket"})
+@CapabilityDescription("Create Zendesk tickets using the Zendesk API.")
+@DynamicProperty(
+        name = "The path in the request object to add. The value needs be a 
valid JsonPointer.",
+        value = "The path in the incoming record to get the value from.",
+        expressionLanguageScope = ExpressionLanguageScope.FLOWFILE_ATTRIBUTES,
+        description = "Additional property to be added to the Zendesk request 
object.")
+@WritesAttributes({
+        @WritesAttribute(attribute = RECORD_COUNT_ATTRIBUTE_NAME, description 
= "The number of records processed."),
+        @WritesAttribute(attribute = ERROR_CODE_ATTRIBUTE_NAME, description = 
"The error code of from the response."),
+        @WritesAttribute(attribute = ERROR_MESSAGE_ATTRIBUTE_NAME, description 
= "The error message of from the response.")})
+public class PutZendeskTicket extends AbstractZendesk {
+
+    static final String ZENDESK_RECORD_READER_NAME = "zendesk-record-reader";
+    static final String ERROR_CODE_ATTRIBUTE_NAME = "error.code";
+    static final String ERROR_MESSAGE_ATTRIBUTE_NAME = "error.message";
+
+    private static final ObjectMapper mapper = new ObjectMapper();
+
+    static final PropertyDescriptor RECORD_READER = new 
PropertyDescriptor.Builder()
+            .name(ZENDESK_RECORD_READER_NAME)
+            .displayName("Record Reader")
+            .description("Specifies the Controller Service to use for parsing 
incoming data and determining the data's schema.")
+            .identifiesControllerService(RecordReaderFactory.class)
+            .build();
+
+    public static final PropertyDescriptor ZENDESK_TICKET_COMMENT_BODY = new 
PropertyDescriptor.Builder()
+            .name(ZENDESK_TICKET_COMMENT_BODY_NAME)
+            .displayName("Comment Body")
+            .description("The content or the path to the comment body in the 
incoming record.")
+            .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+            .expressionLanguageSupported(FLOWFILE_ATTRIBUTES)
+            .required(true)
+            .dependsOn(RECORD_READER)
+            .build();
+
+    public static final PropertyDescriptor ZENDESK_TICKET_SUBJECT = new 
PropertyDescriptor.Builder()
+            .name(ZENDESK_TICKET_SUBJECT_NAME)
+            .displayName("Subject")
+            .description("The content or the path to the subject in the 
incoming record.")
+            .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+            .expressionLanguageSupported(FLOWFILE_ATTRIBUTES)
+            .dependsOn(RECORD_READER)
+            .build();
+
+    public static final PropertyDescriptor ZENDESK_TICKET_PRIORITY = new 
PropertyDescriptor.Builder()
+            .name(ZENDESK_TICKET_PRIORITY_NAME)
+            .displayName("Priority")
+            .description("The content or the path to the priority in the 
incoming record.")
+            .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+            .expressionLanguageSupported(FLOWFILE_ATTRIBUTES)
+            .dependsOn(RECORD_READER)
+            .build();
+
+    public static final PropertyDescriptor ZENDESK_TICKET_TYPE = new 
PropertyDescriptor.Builder()
+            .name(ZENDESK_TICKET_TYPE_NAME)
+            .displayName("Type")
+            .description("The content or the path to the type in the incoming 
record.")
+            .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+            .expressionLanguageSupported(FLOWFILE_ATTRIBUTES)
+            .dependsOn(RECORD_READER)
+            .build();
+
+    private static final List<PropertyDescriptor> PROPERTIES = 
Collections.unmodifiableList(Arrays.asList(
+            RECORD_READER,

Review Comment:
   Please move `RECORD_READER` down, just before its dependent properties 
(`ZENDESK_COMMENT_BODY`).



##########
nifi-nar-bundles/nifi-zendesk-bundle/nifi-zendesk-services-nar/src/main/resources/META-INF/NOTICE:
##########
@@ -0,0 +1,39 @@
+nifi-zendesk-nar
+Copyright 2015-2022 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+===========================================
+Apache Software License v2
+===========================================
+
+The following binary components are provided under the Apache Software License 
v2
+
+  (ASLv2) Apache Commons IO
+    The following NOTICE information applies:
+      Apache Commons IO
+      Copyright 2002-2017 The Apache Software Foundation

Review Comment:
   I cannot see `Commons IO` in the nar but other jars are present that are not 
mentioned in the NOTICE.



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

Reply via email to