-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move S3 file configuration to SingularityService
- Loading branch information
Showing
23 changed files
with
695 additions
and
408 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
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
63 changes: 63 additions & 0 deletions
63
SingularityBase/src/main/java/com/hubspot/singularity/SingularityS3LogMetadata.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,63 @@ | ||
package com.hubspot.singularity; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.google.common.base.Optional; | ||
import com.wordnik.swagger.annotations.ApiModelProperty; | ||
|
||
public class SingularityS3LogMetadata { | ||
public static final String LOG_START_S3_ATTR = "starttime"; | ||
public static final String LOG_END_S3_ATTR = "endtime"; | ||
|
||
private final String key; | ||
private final long lastModified; | ||
private final long size; | ||
private final Optional<Long> startTime; | ||
private final Optional<Long> endTime; | ||
|
||
@JsonCreator | ||
public SingularityS3LogMetadata(@JsonProperty("key") String key, @JsonProperty("lastModified") long lastModified, @JsonProperty("size") long size, | ||
@JsonProperty("startTime") Optional<Long> startTime, @JsonProperty("endTime") Optional<Long> endTime) { | ||
this.key = key; | ||
this.lastModified = lastModified; | ||
this.size = size; | ||
this.startTime = startTime; | ||
this.endTime = endTime; | ||
} | ||
|
||
@ApiModelProperty("S3 key") | ||
public String getKey() { | ||
return key; | ||
} | ||
|
||
@ApiModelProperty("Last modified time") | ||
public long getLastModified() { | ||
return lastModified; | ||
} | ||
|
||
@ApiModelProperty("File size (in bytes)") | ||
public long getSize() { | ||
return size; | ||
} | ||
|
||
@ApiModelProperty("Time the log file started being written to") | ||
public Optional<Long> getStartTime() { | ||
return startTime; | ||
} | ||
|
||
@ApiModelProperty("Time the log file was finished being written to") | ||
public Optional<Long> getEndTime() { | ||
return endTime; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "SingularityS3Log{" + | ||
"key='" + key + '\'' + | ||
", lastModified=" + lastModified + | ||
", size=" + size + | ||
", startTime=" + startTime + | ||
", endTime=" + endTime + | ||
'}'; | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
SingularityBase/src/main/java/com/hubspot/singularity/SingularityS3UploaderFile.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,62 @@ | ||
package com.hubspot.singularity; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.google.common.base.Optional; | ||
|
||
public class SingularityS3UploaderFile { | ||
private final String filename; | ||
private final Optional<String> s3UploaderBucket; | ||
private final Optional<String> s3UploaderKeyPattern; | ||
private final Optional<String> s3UploaderFilenameHint; | ||
private final Optional<String> directory; | ||
|
||
@JsonCreator | ||
public static SingularityS3UploaderFile fromString(String value) { | ||
return new SingularityS3UploaderFile(value, Optional.<String>absent(), Optional.<String>absent(), Optional.<String>absent(), Optional.<String>absent()); | ||
} | ||
|
||
@JsonCreator | ||
public SingularityS3UploaderFile(@JsonProperty("filename") String filename, | ||
@JsonProperty("s3UploaderBucket") Optional<String> s3UploaderBucket, | ||
@JsonProperty("s3UploaderKeyPattern") Optional<String> s3UploaderKeyPattern, | ||
@JsonProperty("s3UploaderFilenameHint") Optional<String> s3UploaderFilenameHint, | ||
@JsonProperty("directory") Optional<String> directory) { | ||
this.filename = filename; | ||
this.s3UploaderBucket = s3UploaderBucket; | ||
this.s3UploaderKeyPattern = s3UploaderKeyPattern; | ||
this.s3UploaderFilenameHint = s3UploaderFilenameHint; | ||
this.directory = directory; | ||
} | ||
|
||
public String getFilename() { | ||
return filename; | ||
} | ||
|
||
public Optional<String> getS3UploaderBucket() { | ||
return s3UploaderBucket; | ||
} | ||
|
||
public Optional<String> getS3UploaderKeyPattern() { | ||
return s3UploaderKeyPattern; | ||
} | ||
|
||
public Optional<String> getS3UploaderFilenameHint() { | ||
return s3UploaderFilenameHint; | ||
} | ||
|
||
public Optional<String> getDirectory() { | ||
return directory; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "SingularityS3UploaderFile{" + | ||
"filename='" + filename + '\'' + | ||
", s3UploaderBucket=" + s3UploaderBucket + | ||
", s3UploaderKeyPattern=" + s3UploaderKeyPattern + | ||
", s3UploaderFilenameHint=" + s3UploaderFilenameHint + | ||
", directory=" + directory + | ||
'}'; | ||
} | ||
} |
Oops, something went wrong.