|
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 |
|
17 | | - |
18 | 17 | // [START storage_s3_sdk_list_objects] |
19 | 18 | import com.amazonaws.auth.AWSStaticCredentialsProvider; |
20 | 19 | import com.amazonaws.auth.BasicAWSCredentials; |
21 | 20 | import com.amazonaws.client.builder.AwsClientBuilder; |
22 | | - |
23 | 21 | import com.amazonaws.services.s3.AmazonS3; |
24 | 22 | import com.amazonaws.services.s3.AmazonS3ClientBuilder; |
25 | 23 | import com.amazonaws.services.s3.model.ObjectListing; |
26 | 24 | import com.amazonaws.services.s3.model.S3ObjectSummary; |
27 | 25 |
|
28 | | -import java.util.List; |
29 | | - |
30 | 26 | public class ListGcsObjects { |
31 | | - public static void listGcsObjects(String googleAccessKeyId, |
32 | | - String googleAccessKeySecret, String bucketName) { |
| 27 | + public static void listGcsObjects( |
| 28 | + String googleAccessKeyId, String googleAccessKeySecret, String bucketName) { |
33 | 29 |
|
34 | 30 | // String googleAccessKeyId = "your-google-access-key-id"; |
35 | 31 | // String googleAccessKeySecret = "your-google-access-key-secret"; |
36 | 32 | // String bucketName = "bucket-name"; |
37 | 33 |
|
38 | 34 | // Create a BasicAWSCredentials using Cloud Storage HMAC credentials. |
39 | | - BasicAWSCredentials googleCreds = new BasicAWSCredentials(googleAccessKeyId, |
40 | | - googleAccessKeySecret); |
| 35 | + BasicAWSCredentials googleCreds = |
| 36 | + new BasicAWSCredentials(googleAccessKeyId, googleAccessKeySecret); |
41 | 37 |
|
42 | 38 | // Create a new client and do the following: |
43 | 39 | // 1. Change the endpoint URL to use the Google Cloud Storage XML API endpoint. |
44 | 40 | // 2. Use Cloud Storage HMAC Credentials. |
45 | | - AmazonS3 interopClient = AmazonS3ClientBuilder.standard() |
| 41 | + AmazonS3 interopClient = |
| 42 | + AmazonS3ClientBuilder.standard() |
46 | 43 | .withEndpointConfiguration( |
47 | 44 | new AwsClientBuilder.EndpointConfiguration( |
48 | 45 | "https://storage.googleapis.com", "auto")) |
|
0 commit comments