Lehel44 commented on a change in pull request #5088:
URL: https://github.com/apache/nifi/pull/5088#discussion_r676814470



##########
File path: 
nifi-nar-bundles/nifi-snmp-bundle/nifi-snmp-processors/src/main/java/org/apache/nifi/snmp/configuration/SNMPConfiguration.java
##########
@@ -104,4 +111,95 @@ public String getSecurityLevel() {
     public String getCommunityString() {
         return communityString;
     }
+
+    public static Builder builder() {
+        return new Builder();
+    }
+
+    public static class Builder {
+
+        private String managerPort = "0";
+        private String targetHost;
+        private String targetPort;
+        private int retries;
+        private int timeout = 500;
+        private int version;
+        private String authProtocol;
+        private String authPassphrase;
+        private String privacyProtocol;
+        private String privacyPassphrase;
+        private String securityName;
+        private String securityLevel;
+        private String communityString;
+
+        public Builder setManagerPort(final String managerPort) {
+            this.managerPort = managerPort;
+            return this;
+        }
+
+        public Builder setTargetHost(final String targetHost) {
+            this.targetHost = targetHost;
+            return this;
+        }
+
+        public Builder setTargetPort(final String targetPort) {
+            this.targetPort = targetPort;
+            return this;
+        }
+
+        public Builder setRetries(final int retries) {
+            this.retries = retries;
+            return this;
+        }
+
+        public Builder setTimeout(final int timeout) {
+            this.timeout = timeout;
+            return this;
+        }
+
+        public Builder setVersion(final int version) {
+            this.version = version;
+            return this;
+        }
+
+        public Builder setAuthProtocol(final String authProtocol) {
+            this.authProtocol = authProtocol;
+            return this;
+        }
+
+        public Builder setAuthPassphrase(final String authPassphrase) {
+            this.authPassphrase = authPassphrase;
+            return this;
+        }
+
+        public Builder setPrivacyProtocol(final String privacyProtocol) {
+            this.privacyProtocol = privacyProtocol;
+            return this;
+        }
+
+        public Builder setPrivacyPassphrase(final String privacyPassphrase) {
+            this.privacyPassphrase = privacyPassphrase;
+            return this;
+        }
+
+        public Builder setSecurityName(final String securityName) {
+            this.securityName = securityName;
+            return this;
+        }
+
+        public Builder setSecurityLevel(final String securityLevel) {
+            this.securityLevel = securityLevel;
+            return this;
+        }
+
+        public Builder setCommunityString(String communityString) {
+            this.communityString = communityString;
+            return this;
+        }
+
+        public SNMPConfiguration build() {

Review comment:
       No, I intentionally removed validation from here. E.g. for 
ListenTrapSnmp processor you don't need to set the target host and port and the 
other variables are optionals too. The tests use this builder extensively as 
well.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to