generated from kestra-io/plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from kestra-io/feat/multiple_file_editor_storage
feat: multi file editor
- Loading branch information
Showing
5 changed files
with
243 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package io.kestra.storage.s3; | ||
|
||
import io.kestra.core.storages.FileAttributes; | ||
import lombok.Builder; | ||
import lombok.Value; | ||
import software.amazon.awssdk.services.s3.model.HeadObjectResponse; | ||
|
||
@Value | ||
@Builder | ||
public class S3FileAttributes implements FileAttributes { | ||
|
||
String fileName; | ||
HeadObjectResponse head; | ||
boolean isDirectory; | ||
|
||
@Override | ||
public long getLastModifiedTime() { | ||
return head.lastModified().getEpochSecond(); | ||
} | ||
|
||
/** | ||
* https://docs.aws.amazon.com/AmazonS3/latest/userguide/intro-lifecycle-rules.html | ||
* Amazon S3 maintains only the last modified date for each object. For example, the Amazon S3 console shows | ||
* the Last Modified date in the object Properties pane. When you initially create a new object, this date reflects | ||
* the date the object is created. If you replace the object, the date changes accordingly. So when we use the term | ||
* creation date, it is synonymous with the term last modified date. | ||
* @return | ||
*/ | ||
@Override | ||
public long getCreationTime() { | ||
return head.lastModified().getEpochSecond(); | ||
} | ||
|
||
@Override | ||
public FileType getType() { | ||
if (isDirectory || fileName.endsWith("/") || head.contentType().equals("application/x-directory")) { | ||
return FileType.Directory; | ||
} | ||
return FileType.File; | ||
} | ||
|
||
@Override | ||
public long getSize() { | ||
return head.contentLength(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.