[GitHub] nifi pull request: [NIFI-774] Create a DeleteS3Object Processor

2015-08-04 Thread yu-iskw
Github user yu-iskw commented on a diff in the pull request:

https://github.com/apache/nifi/pull/72#discussion_r36270059
  
--- Diff: 
nifi/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/DeleteS3Object.java
 ---
@@ -0,0 +1,125 @@
+/*
+ * 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.aws.s3;
+
+import java.io.IOException;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+
+import com.amazonaws.AmazonClientException;
+import com.amazonaws.services.s3.AmazonS3;
+import com.amazonaws.services.s3.model.*;
+import org.apache.nifi.annotation.behavior.*;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.SeeAlso;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.flowfile.FlowFile;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.util.StandardValidators;
+
+@SupportsBatching
+@SeeAlso({PutS3Object.class})
+@Tags({Amazon, S3, AWS, Archive, Delete})
+@CapabilityDescription(Deletes FlowFiles on an Amazon S3 Bucket)
+@DynamicProperty(name = The name of a User-Defined Metadata field to add 
to the S3 Object,
+value = The value of a User-Defined Metadata field to add to the 
S3 Object,
+description = Allows user-defined metadata to be added to the S3 
object as key/value pairs,
+supportsExpressionLanguage = true)
+@ReadsAttribute(attribute = filename, description = Uses the FlowFile's 
filename as the filename for the S3 object)
+@WritesAttributes({
+@WritesAttribute(attribute = s3.bucket, description = The name 
of the S3 bucket),
+@WritesAttribute(attribute = s3.version, description = The 
version of the S3 Object),
+@WritesAttribute(attribute = path, description = The path of 
the file),
+})
+public class DeleteS3Object extends AbstractS3Processor {
+
+public static final PropertyDescriptor VERSION_ID = new 
PropertyDescriptor.Builder()
+.name(Version)
+.description(The Version of the Object to delete)
+.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+.expressionLanguageSupported(true)
+.required(false)
+.build();
+
+public static final ListPropertyDescriptor properties = 
Collections.unmodifiableList(
+Arrays.asList(KEY, BUCKET, ACCESS_KEY, SECRET_KEY, 
CREDENTAILS_FILE, REGION, TIMEOUT,
+FULL_CONTROL_USER_LIST, READ_USER_LIST, 
WRITE_USER_LIST, READ_ACL_LIST, WRITE_ACL_LIST, OWNER));
+
+@Override
+protected ListPropertyDescriptor getSupportedPropertyDescriptors() {
+return properties;
+}
+
+@Override
+protected PropertyDescriptor 
getSupportedDynamicPropertyDescriptor(final String propertyDescriptorName) {
+return new PropertyDescriptor.Builder()
+.name(propertyDescriptorName)
+.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+.expressionLanguageSupported(true)
+.dynamic(true)
+.build();
+}
+
+public void onTrigger(final ProcessContext context, final 
ProcessSession session) {
+FlowFile flowFile = session.get();
+if (flowFile == null) {
+return;
+}
+
+final long startNanos = System.nanoTime();
+
+final String bucket = 
context.getProperty(BUCKET).evaluateAttributeExpressions(flowFile).getValue();
+final String key = 
context.getProperty(KEY).evaluateAttributeExpressions(flowFile).getValue();
+final String versionId = 
context.getProperty(VERSION_ID).evaluateAttributeExpressions(flowFile).getValue();
+
+

[GitHub] nifi pull request: [NIFI-774] Create a DeleteS3Object Processor

2015-08-04 Thread yu-iskw
Github user yu-iskw commented on a diff in the pull request:

https://github.com/apache/nifi/pull/72#discussion_r36267498
  
--- Diff: 
nifi/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/DeleteS3Object.java
 ---
@@ -0,0 +1,125 @@
+/*
+ * 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.aws.s3;
+
+import java.io.IOException;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+
+import com.amazonaws.AmazonClientException;
+import com.amazonaws.services.s3.AmazonS3;
+import com.amazonaws.services.s3.model.*;
+import org.apache.nifi.annotation.behavior.*;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.SeeAlso;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.flowfile.FlowFile;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.util.StandardValidators;
+
+@SupportsBatching
+@SeeAlso({PutS3Object.class})
+@Tags({Amazon, S3, AWS, Archive, Delete})
+@CapabilityDescription(Deletes FlowFiles on an Amazon S3 Bucket)
+@DynamicProperty(name = The name of a User-Defined Metadata field to add 
to the S3 Object,
--- End diff --

Alright.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] nifi pull request: [NIFI-774] Create a DeleteS3Object Processor

2015-08-04 Thread yu-iskw
Github user yu-iskw commented on a diff in the pull request:

https://github.com/apache/nifi/pull/72#discussion_r36267548
  
--- Diff: 
nifi/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/DeleteS3Object.java
 ---
@@ -0,0 +1,125 @@
+/*
+ * 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.aws.s3;
+
+import java.io.IOException;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+
+import com.amazonaws.AmazonClientException;
+import com.amazonaws.services.s3.AmazonS3;
+import com.amazonaws.services.s3.model.*;
+import org.apache.nifi.annotation.behavior.*;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.SeeAlso;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.flowfile.FlowFile;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.util.StandardValidators;
+
+@SupportsBatching
+@SeeAlso({PutS3Object.class})
+@Tags({Amazon, S3, AWS, Archive, Delete})
+@CapabilityDescription(Deletes FlowFiles on an Amazon S3 Bucket)
+@DynamicProperty(name = The name of a User-Defined Metadata field to add 
to the S3 Object,
+value = The value of a User-Defined Metadata field to add to the 
S3 Object,
+description = Allows user-defined metadata to be added to the S3 
object as key/value pairs,
+supportsExpressionLanguage = true)
+@ReadsAttribute(attribute = filename, description = Uses the FlowFile's 
filename as the filename for the S3 object)
+@WritesAttributes({
--- End diff --

I got it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


Re: Route Original Flow File Base on InvokeHTTP Response

2015-08-04 Thread Joe Witt
Again with adam.  Will make a jira and knock that out.  Will also pursue
what bryan mentioned though that will take longer
On Aug 4, 2015 12:44 PM, Adam Taft a...@adamtaft.com wrote:

 One option I think we kicked around at some point was to capture the
 response body as a flowfile attribute in the original flowfile.  For
 reasonably sized response bodies, this would work OK.  It would be a nice
 way to handle your situation, because then the response becomes an
 attribute of the request.

 This would obviously take a code change, but adding a property to the
 effect of Capture response body as flowfile attribute might be a nice
 feature.


 On Tue, Aug 4, 2015 at 11:57 AM, steveM stephen.c.metc...@lmco.com
 wrote:

  My use case is I pull the doc id from the file, call a web service with
  that
  id. The service responds with json that I would then parse to determine
  where to route the document next. Sometimes the document might be new,
  sometimes an update is allowed, sometimes duplicates need to be put
  somewhere else.
  I was hoping I was missing something that allowed you to handle a
 response
  and just add an attribute to the original file (or something similar to
  handle this case).
 
 
 
  --
  View this message in context:
 
 http://apache-nifi-incubating-developer-list.39713.n7.nabble.com/Route-Original-Flow-File-Base-on-InvokeHTTP-Response-tp2317p2343.html
  Sent from the Apache NiFi (incubating) Developer List mailing list
 archive
  at Nabble.com.
 



Re: Route Original Flow File Base on InvokeHTTP Response

2015-08-04 Thread Adam Taft
One option I think we kicked around at some point was to capture the
response body as a flowfile attribute in the original flowfile.  For
reasonably sized response bodies, this would work OK.  It would be a nice
way to handle your situation, because then the response becomes an
attribute of the request.

This would obviously take a code change, but adding a property to the
effect of Capture response body as flowfile attribute might be a nice
feature.


On Tue, Aug 4, 2015 at 11:57 AM, steveM stephen.c.metc...@lmco.com wrote:

 My use case is I pull the doc id from the file, call a web service with
 that
 id. The service responds with json that I would then parse to determine
 where to route the document next. Sometimes the document might be new,
 sometimes an update is allowed, sometimes duplicates need to be put
 somewhere else.
 I was hoping I was missing something that allowed you to handle a response
 and just add an attribute to the original file (or something similar to
 handle this case).



 --
 View this message in context:
 http://apache-nifi-incubating-developer-list.39713.n7.nabble.com/Route-Original-Flow-File-Base-on-InvokeHTTP-Response-tp2317p2343.html
 Sent from the Apache NiFi (incubating) Developer List mailing list archive
 at Nabble.com.



[GitHub] nifi pull request: [NIFI-774] Create a DeleteS3Object Processor

2015-08-04 Thread danbress
Github user danbress commented on a diff in the pull request:

https://github.com/apache/nifi/pull/72#discussion_r36205772
  
--- Diff: 
nifi/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/DeleteS3Object.java
 ---
@@ -0,0 +1,125 @@
+/*
+ * 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.aws.s3;
+
+import java.io.IOException;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+
+import com.amazonaws.AmazonClientException;
+import com.amazonaws.services.s3.AmazonS3;
+import com.amazonaws.services.s3.model.*;
+import org.apache.nifi.annotation.behavior.*;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.SeeAlso;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.flowfile.FlowFile;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.util.StandardValidators;
+
+@SupportsBatching
+@SeeAlso({PutS3Object.class})
+@Tags({Amazon, S3, AWS, Archive, Delete})
+@CapabilityDescription(Deletes FlowFiles on an Amazon S3 Bucket)
+@DynamicProperty(name = The name of a User-Defined Metadata field to add 
to the S3 Object,
+value = The value of a User-Defined Metadata field to add to the 
S3 Object,
+description = Allows user-defined metadata to be added to the S3 
object as key/value pairs,
+supportsExpressionLanguage = true)
+@ReadsAttribute(attribute = filename, description = Uses the FlowFile's 
filename as the filename for the S3 object)
+@WritesAttributes({
+@WritesAttribute(attribute = s3.bucket, description = The name 
of the S3 bucket),
+@WritesAttribute(attribute = s3.version, description = The 
version of the S3 Object),
+@WritesAttribute(attribute = path, description = The path of 
the file),
+})
+public class DeleteS3Object extends AbstractS3Processor {
+
+public static final PropertyDescriptor VERSION_ID = new 
PropertyDescriptor.Builder()
+.name(Version)
+.description(The Version of the Object to delete)
+.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+.expressionLanguageSupported(true)
+.required(false)
+.build();
+
+public static final ListPropertyDescriptor properties = 
Collections.unmodifiableList(
+Arrays.asList(KEY, BUCKET, ACCESS_KEY, SECRET_KEY, 
CREDENTAILS_FILE, REGION, TIMEOUT,
--- End diff --

Shouldn't this list contain the VERSION_ID PropertyDescriptor?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---