Skip to content

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

Merged
merged 13 commits into from
Mar 7, 2019
Merged

storage: S3 SDK sample to list buckets #1343

merged 13 commits into from
Mar 7, 2019

Conversation

frankyn
Copy link
Contributor

@frankyn frankyn commented Feb 25, 2019

Hi,

The PR adds a new sample to list GCS buckets using the S3 SDK in Java.

  • Sample and system test
  • Set up integration tests for HMAC key and secret.
  • Code review

@frankyn frankyn requested review from kurtisvg and a team February 25, 2019 20:50
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Feb 25, 2019
@frankyn frankyn added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Feb 25, 2019
@@ -0,0 +1,57 @@
<!--
Copyright 2016 Google Inc.
Copy link
Contributor

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

<maven.compiler.source>1.8</maven.compiler.source>
</properties>

<build>
Copy link
Contributor

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?

limitations under the License.
-->
<project>
<parent>
Copy link
Contributor

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>
Copy link
Contributor

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.
Copy link
Contributor

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
Copy link
Contributor

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) {
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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)

Copy link
Contributor Author

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 =
Copy link
Contributor

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.

@frankyn
Copy link
Contributor Author

frankyn commented Mar 7, 2019

Thanks @kurtisvg, I have updated the PR. PTAL.

@frankyn frankyn removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Mar 7, 2019
@frankyn frankyn merged commit 3466297 into master Mar 7, 2019
@frankyn frankyn deleted the s3-sdk branch March 7, 2019 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants