You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/09/08 09:09:23 UTC

[GitHub] [dolphinscheduler] SbloodyS commented on a diff in pull request #11859: [Feature][task-plugins] aws datasync task plugins

SbloodyS commented on code in PR #11859:
URL: https://github.com/apache/dolphinscheduler/pull/11859#discussion_r965702845


##########
dolphinscheduler-task-plugin/dolphinscheduler-task-datasync/src/main/java/org/apache/dolphinscheduler/plugin/task/datasync/DatasyncHook.java:
##########
@@ -0,0 +1,217 @@
+package org.apache.dolphinscheduler.plugin.task.datasync;
+
+import lombok.Data;
+import org.apache.dolphinscheduler.plugin.task.api.TaskConstants;
+import org.apache.dolphinscheduler.spi.utils.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
+import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
+import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
+import software.amazon.awssdk.regions.Region;
+import software.amazon.awssdk.services.datasync.DataSyncClient;
+import software.amazon.awssdk.services.datasync.model.CancelTaskExecutionRequest;
+import software.amazon.awssdk.services.datasync.model.CancelTaskExecutionResponse;
+import software.amazon.awssdk.services.datasync.model.CreateTaskRequest;
+import software.amazon.awssdk.services.datasync.model.CreateTaskResponse;
+import software.amazon.awssdk.services.datasync.model.DescribeTaskExecutionRequest;
+import software.amazon.awssdk.services.datasync.model.DescribeTaskExecutionResponse;
+import software.amazon.awssdk.services.datasync.model.DescribeTaskRequest;
+import software.amazon.awssdk.services.datasync.model.DescribeTaskResponse;
+import software.amazon.awssdk.services.datasync.model.FilterRule;
+import software.amazon.awssdk.services.datasync.model.StartTaskExecutionRequest;
+import software.amazon.awssdk.services.datasync.model.StartTaskExecutionResponse;
+import software.amazon.awssdk.services.datasync.model.TagListEntry;
+import software.amazon.awssdk.services.datasync.model.TaskExecutionStatus;
+import software.amazon.awssdk.services.datasync.model.TaskStatus;
+
+import java.util.Arrays;
+import java.util.List;
+
+@Data
+public class DatasyncHook {
+    protected final Logger logger = LoggerFactory.getLogger(String.format(TaskConstants.TASK_LOG_LOGGER_NAME_FORMAT, getClass()));
+    private DataSyncClient client;
+    private String taskArn;
+    private String taskExecArn;
+
+    public static TaskExecutionStatus[] doneStatus = {TaskExecutionStatus.ERROR,TaskExecutionStatus.SUCCESS,TaskExecutionStatus.UNKNOWN_TO_SDK_VERSION};
+    public static TaskStatus[] taskFinishFlags = {TaskStatus.UNAVAILABLE,TaskStatus.UNKNOWN_TO_SDK_VERSION};
+    public DatasyncHook() {
+        client = createClient();
+    }
+
+    protected DataSyncClient createClient() {
+        //final String awsAccessKeyId = PropertyUtils.getString(TaskConstants.AWS_ACCESS_KEY_ID);
+        //final String awsSecretAccessKey = PropertyUtils.getString(TaskConstants.AWS_SECRET_ACCESS_KEY);
+        final String awsAccessKeyId = "AKIAXTUKRINYVGPCDOBV";
+        final String awsSecretAccessKey = "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";

Review Comment:
   Please avoid doing that. This is a serious safety accident...



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org