-
Notifications
You must be signed in to change notification settings - Fork 2.9k
storage: S3 SDK sample to list buckets #1343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
storage/s3-sdk/pom.xml
Outdated
@@ -0,0 +1,57 @@ | |||
<!-- | |||
Copyright 2016 Google Inc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update to 2018 Google LLC
storage/s3-sdk/pom.xml
Outdated
<maven.compiler.source>1.8</maven.compiler.source> | ||
</properties> | ||
|
||
<build> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are these lines for? Is it required?
storage/s3-sdk/pom.xml
Outdated
limitations under the License. | ||
--> | ||
<project> | ||
<parent> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parent should be:
<!--
The parent pom defines common style checks and testing strategies for our samples.
Removing or replacing it should not affect the execution of the samples in anyway.
-->
<parent>
<groupId>com.google.cloud.samples</groupId>
<artifactId>shared-configuration</artifactId>
<version>1.0.10</version>
</parent>
<relativePath>../..</relativePath> | ||
</parent> | ||
|
||
<modelVersion>4.0.0</modelVersion> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally these 4 lines lead the pom
@@ -0,0 +1,73 @@ | |||
/* | |||
* Copyright 2018 Google Inc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2019
*/ | ||
|
||
/** | ||
* """This sample shows how to list Google Cloud Storage (GCS) buckets using the AWS S3 SDK with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment necessary? Seems like stating it in the README is probably best, or else trimming it down and including it inside the snippet.
} | ||
// [END storage_s3_sdk_list_buckets] | ||
|
||
public static void main(String[] args) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the main function necessary? It's not used in the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left it in so the sample can be ran using the command line. Do you recommend I remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My suggestion is that it would be easier to remove it and instead of recommending mvn exec:java
in the read me, use mvn verify
(this should run the test, which will run the snippet)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
public class ListGcsBuckets { | ||
public static List<Bucket> listGcsBuckets() { | ||
// Change the endpoint_url to use the Google Cloud Storage XML API endpoint. | ||
AmazonS3 interopClient = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it might have some style violations - I would try to run google-java-format
or mvn checkstyle:check
to verify.
Thanks @kurtisvg, I have updated the PR. PTAL. |
Hi,
The PR adds a new sample to list GCS buckets using the S3 SDK in Java.