forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding test cases and replacing deprecated assertThat with MatcherAss…
…ert for the test file Signed-off-by: fahadshamiinsta <fshami@netapp.com>
- Loading branch information
1 parent
f7f3500
commit b922aed
Showing
4 changed files
with
132 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
29 changes: 29 additions & 0 deletions
29
...cs/src/main/java/org/opensearch/repositories/gcs/GoogleApplicationDefaultCredentials.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,29 @@ | ||
/* | ||
* 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.gcs; | ||
|
||
import com.google.auth.oauth2.GoogleCredentials; | ||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
|
||
import java.io.IOException; | ||
|
||
public class GoogleApplicationDefaultCredentials { | ||
private static final Logger logger = LogManager.getLogger(GoogleApplicationDefaultCredentials.class); | ||
|
||
public GoogleCredentials getApplicationDefaultCredentials() { | ||
GoogleCredentials credentials = null; | ||
try { | ||
credentials = SocketAccess.doPrivilegedIOException(GoogleCredentials::getApplicationDefault); | ||
} catch (IOException e) { | ||
logger.error("Failed to retrieve \"Application Default Credentials\"",e); | ||
} | ||
return 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