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.
Implement new interface for multifile editor
- Loading branch information
Martin GUIBERT
committed
Oct 17, 2023
1 parent
2be9c15
commit 9581cf7
Showing
3 changed files
with
272 additions
and
20 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
src/main/java/io/kestra/storage/gcs/GcsFileAttributes.java
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,38 @@ | ||
package io.kestra.storage.gcs; | ||
|
||
import com.google.cloud.storage.BlobInfo; | ||
import io.kestra.core.storages.FileAttributes; | ||
import lombok.Builder; | ||
import lombok.Value; | ||
|
||
@Value | ||
@Builder | ||
public class GcsFileAttributes implements FileAttributes { | ||
|
||
String fileName; | ||
BlobInfo blobInfo; | ||
boolean isDirectory; | ||
|
||
@Override | ||
public long getLastModifiedTime() { | ||
return blobInfo.getUpdateTimeOffsetDateTime().toInstant().toEpochMilli(); | ||
} | ||
|
||
@Override | ||
public long getCreationTime() { | ||
return blobInfo.getCreateTimeOffsetDateTime().toInstant().toEpochMilli(); | ||
} | ||
|
||
@Override | ||
public FileType getType() { | ||
if (isDirectory || fileName.endsWith("/") || blobInfo.getContentType().equals("application/x-directory")) { | ||
return FileType.Directory; | ||
} | ||
return FileType.File; | ||
} | ||
|
||
@Override | ||
public long getSize() { | ||
return blobInfo.getSize(); | ||
} | ||
} |
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