-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial implementation of a current tenant id resolver and amazon s3 …
…client provider #201
- Loading branch information
1 parent
0e0ce6b
commit 3689eba
Showing
5 changed files
with
124 additions
and
12 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
17 changes: 17 additions & 0 deletions
17
.../src/main/java/org/springframework/content/s3/config/CurrentTenantIdentifierResolver.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 org.springframework.content.s3.config; | ||
|
||
|
||
/** | ||
* A callback, used by the S3 default store implementation when returning a Resource, for identifying the current | ||
* tenant identifier. Subsequently, used by the {@link MultiTenantAmazonS3Provider} to get a specific AmazonS3 client | ||
* to use for the Resource being returned. | ||
*/ | ||
public interface CurrentTenantIdentifierResolver { | ||
|
||
/** | ||
* Return the current tenant identifier, or null if one cannot be established | ||
* | ||
* @return current tenant identifer, or null | ||
*/ | ||
String resolveCurrentTenantIdentifier(); | ||
} |
20 changes: 20 additions & 0 deletions
20
...t-s3/src/main/java/org/springframework/content/s3/config/MultiTenantAmazonS3Provider.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,20 @@ | ||
package org.springframework.content.s3.config; | ||
|
||
import com.amazonaws.services.s3.AmazonS3; | ||
|
||
/** | ||
* A callback, used by the S3 default store implementation when returning a resource, in order to establish which | ||
* AmazonS3 client to provide to the Resource being returned. | ||
* | ||
* The tenantId is resolved by the {@link CurrentTenantIdentifierResolver} | ||
*/ | ||
public interface MultiTenantAmazonS3Provider { | ||
|
||
/** | ||
* The AmazonS3 client to use, or null | ||
* | ||
* @param tenantId the current tenant identifier | ||
* @return the AmazonS3 client to use, or null | ||
*/ | ||
AmazonS3 getAmazonS3(String tenantId); | ||
} |
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