-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
- Loading branch information
Showing
6 changed files
with
107 additions
and
25 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
47 changes: 47 additions & 0 deletions
47
...s/repository-s3/src/main/java/org/opensearch/repositories/s3/AmazonS3WithCredentials.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,47 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.repositories.s3; | ||
|
||
import com.amazonaws.auth.AWSCredentialsProvider; | ||
import com.amazonaws.services.s3.AmazonS3; | ||
|
||
import org.opensearch.common.Nullable; | ||
|
||
/** | ||
* The holder of the AmazonS3 and AWSCredentialsProvider | ||
*/ | ||
final class AmazonS3WithCredentials { | ||
private final AmazonS3 client; | ||
private final AWSCredentialsProvider credentials; | ||
|
||
private AmazonS3WithCredentials(final AmazonS3 client, @Nullable final AWSCredentialsProvider credentials) { | ||
this.client = client; | ||
this.credentials = credentials; | ||
} | ||
|
||
AmazonS3 getClient() { | ||
return client; | ||
} | ||
|
||
AWSCredentialsProvider getCredentials() { | ||
return credentials; | ||
} | ||
|
||
AmazonS3 client() { | ||
return client; | ||
} | ||
|
||
AWSCredentialsProvider credentials() { | ||
return credentials; | ||
} | ||
|
||
static AmazonS3WithCredentials create(final AmazonS3 client, @Nullable final AWSCredentialsProvider credentials) { | ||
return new AmazonS3WithCredentials(client, credentials); | ||
} | ||
} |
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