dominikriemer commented on code in PR #3824:
URL: https://github.com/apache/streampipes/pull/3824#discussion_r2412846618


##########
streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeResource.java:
##########
@@ -416,6 +417,14 @@ private boolean checkProvidedQueryParams(Map<String, 
String> providedParams) {
   public ResponseEntity<?> setDataLakeRetention(
       @PathVariable String elementId,
       @RequestBody RetentionTimeConfig retention){
+        try {
+          
+          
retention.getRetentionExportConfig().getExportProviderSettings().setSecretKey(
+          
SecretEncryptionManager.encrypt(retention.getRetentionExportConfig().getExportProviderSettings().getSecretKey()));
+          
+        } catch (Exception e) {
+          e.printStackTrace();

Review Comment:
   Use `LOG.error` do log errors instead of printing the stack trace
   Do we want to return a bad request/internal server error in this case?



##########
streampipes-data-explorer-export/src/main/java/org/apache/streampipes/dataexplorer/export/ObjectStorge/S3.java:
##########
@@ -0,0 +1,85 @@
+/*
+ * 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.streampipes.dataexplorer.export.ObjectStorge;
+
+
+import org.apache.streampipes.model.datalake.ExportProviderSettings;
+import 
org.apache.streampipes.user.management.encryption.SecretEncryptionManager;
+
+import 
org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;
+import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
+import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
+import software.amazon.awssdk.core.sync.RequestBody;
+import software.amazon.awssdk.regions.Region;
+import software.amazon.awssdk.services.s3.S3Client;
+import software.amazon.awssdk.services.s3.model.PutObjectRequest;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.net.URI;
+import java.time.Instant;
+
+
+public class S3 implements IObjectStorage{
+
+    private final String fileName;
+    private final S3Client s3;
+    private final String bucketName;
+
+    public S3(String measurementName, String format, ExportProviderSettings 
settings) throws Exception {
+        
+          this.s3 = S3Client.builder()
+                .endpointOverride(URI.create(settings.getEndPoint())) 
+                .region(Region.of("us-east-1"))

Review Comment:
   Should region be configurable?



##########
ui/src/app/configuration/dialog/data-retention-dialog/components/select-export/select-format.component.scss:
##########
@@ -15,3 +15,23 @@
  *  limitations under the License.
  *
  */
+.invalid-uri {
+    border: 1px solid red !important;

Review Comment:
   var(--color-warn)



##########
ui/src/app/configuration/dialog/data-retention-dialog/components/select-export/select-format.component.scss:
##########
@@ -15,3 +15,23 @@
  *  limitations under the License.
  *
  */
+.invalid-uri {
+    border: 1px solid red !important;
+}
+
+.s3-config-container {
+    margin-top: 5px;
+    padding: 15px;
+    background-color: #f9f9f9;

Review Comment:
   Use CSS variables (e.g., color-bg-2) instead of fixed colors



##########
streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeResource.java:
##########
@@ -416,6 +417,14 @@ private boolean checkProvidedQueryParams(Map<String, 
String> providedParams) {
   public ResponseEntity<?> setDataLakeRetention(
       @PathVariable String elementId,
       @RequestBody RetentionTimeConfig retention){
+        try {
+          
+          
retention.getRetentionExportConfig().getExportProviderSettings().setSecretKey(
+          
SecretEncryptionManager.encrypt(retention.getRetentionExportConfig().getExportProviderSettings().getSecretKey()));

Review Comment:
   If we update the RetentionTimeConfig and users do not change the secret key, 
will the secret be encrypted twice?



##########
streampipes-model/src/main/java/org/apache/streampipes/model/datalake/ProviderType.java:
##########
@@ -0,0 +1,37 @@
+/*
+ * 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.streampipes.model.datalake;
+
+public enum ProviderType {
+    FOLDER("local"),
+    S3("S3");
+
+    private String providerValue;
+
+    // Constructor to assign the value
+    ProviderType(String providerValue) {
+        this.providerValue = providerValue;
+    }
+
+    // Method to get the value of the provider
+    public String getProviderValue() {

Review Comment:
   This is currently unused, can we remove `providerValue` and just use the 
enum keys?



##########
streampipes-model/src/main/java/org/apache/streampipes/model/datalake/ExportProviderSettings.java:
##########
@@ -17,6 +17,70 @@
  */
 package org.apache.streampipes.model.datalake;
 
-public record ExportProviderSettings(
-      String providerType
-) {}
\ No newline at end of file
+public class ExportProviderSettings {
+
+    private ProviderType providerType;
+    private String accessKey;
+    private String secretKey;
+    private String bucketName;
+    private String endPoint;
+
+    // Constructor
+    public ExportProviderSettings(ProviderType providerType, String accessKey, 
String secretKey, String bucketName, String endPoint) {
+        this.providerType = providerType;
+        this.accessKey = accessKey;
+        this.secretKey = secretKey;
+        this.bucketName = bucketName;
+        this.endPoint = endPoint;
+    }
+
+    // Getter for providerType
+    public ProviderType getProviderType() {
+        return providerType;
+    }
+
+    // Setter for providerType
+    public void setProviderType(ProviderType providerType) {
+        this.providerType = providerType;
+    }
+
+    // Getter for accessKey
+    public String getAccessKey() {
+        return accessKey;
+    }
+
+    // Setter for accessKey
+    public void setAccessKey(String accessKey) {
+        this.accessKey = accessKey;
+    }
+
+    // Getter for secretKey

Review Comment:
   No comments for getters and setters



##########
ui/src/app/configuration/dialog/data-retention-dialog/components/select-export/select-format.component.scss:
##########
@@ -15,3 +15,23 @@
  *  limitations under the License.
  *
  */
+.invalid-uri {
+    border: 1px solid red !important;
+}
+
+.s3-config-container {
+    margin-top: 5px;
+    padding: 15px;
+    background-color: #f9f9f9;
+    border-radius: 8px;
+    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);

Review Comment:
   box-shadow can be removed



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