forked from bazelbuild/bazel
-
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.
Implementation of AWS S3 as a caching backend
This commit implements the usage of S3 as a cache backend for bazel. This backend acts in a similar fashion to the general HTTP and google datastorage backends.
- Loading branch information
1 parent
019f13b
commit b4823be
Showing
21 changed files
with
1,249 additions
and
88 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
55 changes: 55 additions & 0 deletions
55
src/main/java/com/google/devtools/build/lib/authandtls/AwsAuthUtils.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,55 @@ | ||
// Copyright 2018 The Bazel Authors. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package com.google.devtools.build.lib.authandtls; | ||
|
||
import com.amazonaws.auth.AWSCredentialsProvider; | ||
import com.amazonaws.auth.AWSCredentialsProviderChain; | ||
import com.amazonaws.auth.AWSStaticCredentialsProvider; | ||
import com.amazonaws.auth.BasicAWSCredentials; | ||
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain; | ||
import com.amazonaws.auth.profile.ProfileCredentialsProvider; | ||
import com.google.common.collect.ImmutableList; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
|
||
/** Utility methods for using {@link AuthAndTLSOptions} with Amazon Web Services. */ | ||
public final class AwsAuthUtils { | ||
|
||
/** | ||
* Create a new {@link com.amazonaws.auth.AWSCredentialsProvider} object. | ||
* | ||
* @throws IOException in case the credentials can't be constructed. | ||
*/ | ||
public static AWSCredentialsProvider newCredentials(AuthAndTLSOptions options) throws IOException { | ||
final ImmutableList.Builder<AWSCredentialsProvider> creds = ImmutableList.builder(); | ||
|
||
if (options.awsAccessKeyId != null && options.awsSecretAccessKey != null) { | ||
final BasicAWSCredentials basicAWSCredentials = new BasicAWSCredentials(options.awsAccessKeyId, options.awsSecretAccessKey); | ||
creds.add(new AWSStaticCredentialsProvider(basicAWSCredentials)); | ||
} | ||
|
||
if (options.awsProfile != null) { | ||
creds.add(new ProfileCredentialsProvider(options.awsProfile)); | ||
} | ||
|
||
if (options.useAwsDefaultCredentials) { | ||
creds.add(DefaultAWSCredentialsProviderChain.getInstance()); | ||
} | ||
|
||
final List<AWSCredentialsProvider> providers = creds.build(); | ||
return providers.isEmpty() ? null : new AWSCredentialsProviderChain(providers); | ||
} | ||
} |
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
Oops, something went wrong.