-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement server side bucket encryption service (#26)
- Loading branch information
Showing
23 changed files
with
340 additions
and
30 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
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
17 changes: 17 additions & 0 deletions
17
...ava/com/robothy/s3/core/exception/ServerSideEncryptionConfigurationNotFoundException.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,17 @@ | ||
package com.robothy.s3.core.exception; | ||
|
||
/** | ||
* Server side encryption not configured. | ||
*/ | ||
public class ServerSideEncryptionConfigurationNotFoundException extends LocalS3Exception { | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param bucketName the bucket that not configured server side encryption. | ||
*/ | ||
public ServerSideEncryptionConfigurationNotFoundException(String bucketName) { | ||
super(bucketName, S3ErrorCode.ServerSideEncryptionConfigurationNotFoundError); | ||
} | ||
|
||
} |
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
45 changes: 45 additions & 0 deletions
45
local-s3-core/src/main/java/com/robothy/s3/core/service/BucketEncryptionService.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,45 @@ | ||
package com.robothy.s3.core.service; | ||
|
||
import com.robothy.s3.core.annotations.BucketChanged; | ||
import com.robothy.s3.core.asserionts.BucketAssertions; | ||
import com.robothy.s3.core.model.internal.BucketMetadata; | ||
|
||
/** | ||
* Bucket encryption put/get/delete service. | ||
*/ | ||
public interface BucketEncryptionService extends LocalS3MetadataApplicable { | ||
|
||
/** | ||
* Put encryption configuration to the specified bucket. | ||
* | ||
* @param bucketName bucket name. | ||
* @param encryption encryption configuration. | ||
*/ | ||
@BucketChanged | ||
default void putBucketEncryption(String bucketName, String encryption) { | ||
BucketMetadata bucketMetadata = BucketAssertions.assertBucketExists(localS3Metadata(), bucketName); | ||
bucketMetadata.setEncryption(encryption); | ||
} | ||
|
||
/** | ||
* Get the encryption configuration of the specified bucket. | ||
* | ||
* @param bucketName the bucket name. | ||
* @return encryption configuration the specified bucket. | ||
*/ | ||
default String getBucketEncryption(String bucketName) { | ||
return BucketAssertions.assertBucketEncryptionExist(localS3Metadata(), bucketName); | ||
} | ||
|
||
/** | ||
* Remove bucket encryption configuration from the specified bucket. | ||
* | ||
* @param bucketName the bucket name. | ||
*/ | ||
@BucketChanged | ||
default void deleteBucketEncryption(String bucketName) { | ||
BucketMetadata bucketMetadata = BucketAssertions.assertBucketExists(localS3Metadata(), bucketName); | ||
bucketMetadata.setEncryption(null); | ||
} | ||
|
||
} |
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
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.